Engineering Plan

How we build it — on a $9M seed.

The system architecture, the AI architecture, the security model for attorney-client-privileged data, and the lean ten-engineer trajectory that funds the whole 15-state, 46-category footprint on a single seed.

Read the full written planSee the audit

System architecture

Architecture — secured, end to end

Clients reach Lawma only through a security perimeter; case data lives in a privileged, tenant-isolated zone walled both by firm and by party; the AI layer sits behind a zero-data-retention boundary; integrations connect through a vetted API edge. All services (category framework, credential verifier, traps engine, advertiser portal, filing-envelope manager) sit in the same application zone, with the advertiser surface isolated from the privileged data zone by schema.

Clients

LitigantOn a phone — mobile-first
Attorney / accredited repReviews & approves the law
Firm adminManages clients & access codes
AdvertiserInsurance carriers, malpractice insurers, vendors

Lawma platform

Security perimeter · multi-factor auth · role-based access control · audit logging
Edge & identity · CloudFront + WAF + Shield + Auth0
TLS / SSLEncrypted in transit (CloudFront edge)
Auth0 — mandatory multi-factor authenticationOne identity provider, separate role-based-access-control roles per audience
Role-based access + row-level securityApplication-layer roles plus database row-level checks
▼
Application · Next.js on AWS ECS Fargate
Marketing site
Client app
Attorney portal
Advertiser portal
Category service
Credential verifier
Traps engine
Filing-envelope manager
▼
 Privileged data zone · AWS US region

Attorney-client privileged — encrypted at rest with a managed key service, tenant-isolated, party-walled, never sold, never used to train outside models. AWS business associate agreement, SOC 2, HIPAA-eligible.

▼ (separate schema, no join)
Non-privileged data zone · separate Aurora schema
Demand log/help triage outcomes — no personally-identifiable data, feeds the category-expansion signal
Advertiser accountsVendor identities, campaigns, billing, reporting — zero join to privileged data
Public contentEditorial articles, public-forum threads, programmatic-SEO pages
▼  zero-data-retention boundary
AI layer & document service
Anthropic ClaudeZero-data-retention agreement
Retrieval-augmented corpusCalifornia and federal legal corpus
Deterministic PDF serviceFills state and federal AcroForms (USCIS, USPTO, VA, IRS by Year 5)

No storage, no training on case data. Every legal-bearing AI output is gated by attorney review.

Integrations · Growth phase

Attorney case-management systemsClio, MyCase, PracticePanther, Smokeball, Filevine, Rocket Matter, CARET Legal, Litify
State court electronic-filing service providersInfoTrack (California), FileTime (Texas), Tyler Odyssey — as a customer first, then as Lawma-certified where volume justifies
Federal forumsFederal bankruptcy court electronic filing, USCIS, USPTO TEAS+, Board of Veterans Appeals, IRS — adapters per federal category
Credential registriesState bar lookups, EOIR BIA list, VA-accredited representative search, IRS Enrolled Agent lookup, USPTO patent-practitioner search
MessagingPostmark (email), Twilio (SMS, multi-factor)

AI architecture

The AI assists — it never decides the law.

Court forms are generated by deterministic code; legal reasoning is grounded in real sources and gated by an attorney. Two paths, one rule — and a third current: the traps-detection engine runs as deterministic rules over structured case data, with the AI used only to phrase attorney-facing flags.

Court forms — deterministic

Validated intake answers
▼
Typed field-mapping layer (code)
▼
Fill the official AcroForm PDF
▼
Apply the DRAFT watermark
▼
Attorney approval gate

Same answers in → same PDF out. Testable, auditable, no invented or omitted fields.

Legal reasoning — grounded AI

Retrieval over the California and federal corpus
▼
Claude under zero-data-retention
▼
Citation verification — every cite traces to a source
▼
Mandatory attorney review

Claude paraphrases real sources, not memory. Every legal-bearing output is reviewed by an attorney.

Trap detection — deterministic rules

Structured case-data input
▼
Rule engine evaluates 28 trap definitions
▼
Matched traps create detection records
▼
AI phrases attorney-facing summary
▼
Surfaced inline in the attorney portal

Detection is rule-based — deterministic, testable. Only the attorney-facing phrasing uses the AI.

Security architecture

Built for privileged data — six layers.

Case data is attorney-client privileged. Security is the highest-priority engineering concern: "as strong as banking."

Layer 1 · Identity

Mandatory multi-factor authentication on every account, every login; role-based access control across Client, Attorney, Firm Admin, Implementer, and Advertiser.

▼

Layer 2 · Tenant and party isolation

PostgreSQL row-level security. Firm-level wall plus the per-party wall (petitioner and respondent never see each other's data; conflict-of-interest detection is server-side only).

▼

Layer 3 · Data protection

Encryption in transit and at rest; documents behind short-lived signed URLs; secrets in AWS Secrets Manager, never in source control.

▼

Layer 4 · Privileged AI

Legal-reasoning calls go only to a zero-data-retention provider. No storage, no training on case data. Kovel-style posture.

▼

Layer 5 · Advertiser-zone isolation

Advertiser identities and campaigns live in a separate database schema with no join to privileged tables. The targeting layer enforces that no client-identity signal ever crosses to the advertiser surface.

▼

Layer 6 · Auditability and recovery

Immutable audit log of every case-data access; tested backups; a written breach-response plan.

Technology stack

Chosen for a small team and a high bar.

Next.js + TypeScript + React

One framework for user interface and server rendering; mobile-first. Self-hosted as a container — not tied to a single hosting vendor.

AWS ECS Fargate

Serverless container compute for the application plus the microservices (category service, credential verifier, traps engine, advertiser portal). Auto-scales without managing servers.

AWS Aurora PostgreSQL with pgvector

Managed relational and vector data in one engine. Multi-availability-zone failover, encrypted at rest with a managed key service, row-level security enforces firm and per-party walls.

Auth0

Identity for clients, attorneys, and advertisers — single identity provider, separate role-based-access-control roles. Mandatory multi-factor authentication on every login. FedRAMP-authorized, SOC 2 Type II.

AWS S3 with managed key encryption

Encrypted document storage with versioning and multi-factor-delete protection on production buckets; short-lived pre-signed URLs scoped to authorized users.

AWS CloudFront + WAF + Shield

Edge content-delivery network, web-application firewall, and managed DDoS protection. Public marketing surface cached at the edge; the authenticated application passes through with strict origin policy.

Anthropic Claude under zero-data-retention agreement

Frontier legal reasoning under zero-data-retention terms. Used by the AI-guided intake mode, the attorney-only case analysis, and traps-engine phrasing.

pdf-lib

Pure-JavaScript AcroForm filling and DRAFT-watermarking. A build script generates AcroForm replicas; runtime serves filled PDFs. Federal forms (USCIS, USPTO, Board of Veterans Appeals, IRS) are added to the build pipeline as federal categories launch.

Postmark + Twilio

Postmark for branded transactional email; Twilio for multi-factor SMS and advertiser pacing alerts. Used sparingly.

Sentry, Datadog, CloudWatch, CloudTrail

Error tracking, application observability, platform metrics, and an immutable audit log. Privileged surfaces strip personally-identifiable information before it reaches observability vendors.

Data model

Core entities

Every privileged-zone table carries a firm_id and a party_side — the keys to database-enforced firm and party-wall isolation. Advertiser tables live in a separate non-privileged schema with no join to the privileged plane.

Firmthe tenant boundary
UserAttorney, Firm Admin, Client, Implementer, Advertiser; role plus multi-factor authentication via Auth0
AccessCodesingle-use, binds a Client to a Firm
Clienta litigant; one Firm, one or more Cases
Casea matter; case type, jurisdiction, status; the per-party-wall row
Categorystructured case-category definition; scope, jurisdiction, forms, prompts, traps, pricing
InterviewSession + Answercoached intake (the three intake modes)
PreparerAuditEventprivileged record of every preparer-mode interaction
Documentgenerated or uploaded; type, version, status; the DRAFT-watermark workflow
CaseAnalysisattorney-only AI briefing plus client translation
TrapDetectionflag record per case × trap × detection-rule version
AttorneyCredentialstate bar, BIA, VA, EA, CPA, USPTO; verified registry URL, ID, and date
AttorneyListing + SponsoredPlacementattorney profile and offerings, optional sponsored slot (flat-fee only)
AdvertiserAccountvendor account, KYC, billing — separate schema from privileged data
AdCampaignplacement type, targeting, pacing, reporting; no client-identity targeting allowed
EFSPEnvelopeenvelope record; attorney-approved-by, court reference, audit chain
ContentItemversioned tooltip, question, or explainer
AuditEventimmutable access-and-change record
corpus_chunkembedded California legal corpus, federal corpus expansion (retrieval-augmented)
TriageDemandLognon-privileged demand signal from /help (separate schema)

Engineering team

Lean by design — two to ten engineers on a single $9M seed.

The single-seed trajectory funds engineering through retained earnings beyond Year 2. Hires are sequenced so each year's new engineer corresponds to a specific capability milestone.

YearHeadcountFocus and capability milestones
Year 12 engineersFounding engineer (full-stack lead) and AI/ML engineer. Build the prototype, California family-law category, national bankruptcy product.
Year 24 engineersAdd platform engineer (category framework) and DevOps/security engineer (production cutover from prototype). California full-load and Texas/New York family-law launch.
Year 36 engineersAdd frontend engineer (matchmaking and traps engine) and backend engineer (credential verifier). Florida and Illinois launches; all five states fully loaded.
Year 48 engineersAdd data engineer (corpus and outcome analytics) and integrations engineer (case-management and electronic-filing adapters). Ten-state expansion; Social Security federal.
Year 510 engineersAdd senior architect (Lawma-as-EFSP) and advertiser-platform engineer. Fifteen-state expansion plus immigration, intellectual property, VA, IRS federal.

By Year 5, roughly 2.15 million paying engagements divided by 10 engineers equals about 215,000 engagements per engineer per year. Achievable only because the AI does the heavy lifting, the deterministic PDF service owns every court form, and category expansions are data changes rather than code changes.

Build sequence

Thirteen milestones — prototype through platform leverage.

Each milestone ends with tests and a security check. The first eight are the supervised-pipeline prototype. The final five are the platform-leverage milestones surfaced by the requirements audit.

FoundationRepository, application shell, schema and row-level security, continuous-integration pipeline.
→
Authentication and tenancyMulti-factor authentication, roles, access codes, isolation tests including the per-party wall.
→
Content frameworkTooltips, question sets, AI-assisted authoring.
→
Intake engineCoached questions and answers — three modes (self, AI-guided, preparer). Save and resume.
→
Document assemblyDeterministic AcroForm fill; DRAFT watermark; versioning.
→
Attorney portalClient and document tables; status workflow; review and approve.
→
AI case analysisRetrieval-augmented corpus; summary, next steps, strategy.
→
Prototype polishBranded email and in-app notifications; accessibility and security review.
→
Category frameworkStructured category definitions; a second case category lights up via data, not code.
→
Matchmaking and sponsored placementsDirectory plus scope/budget filter, sponsored zone, and advertiser-portal compliance flagging.
→
Traps engineThe 28 procedural traps as detection rules surfaced inline in the attorney portal.
→
Federal categories and credentialsCredential verification against issuing-authority registries; federal-category match pre-filter; bankruptcy first, then Social Security, immigration, intellectual property, VA, IRS.
→
Advertiser portal and self-EFSPAdvertiser self-serve (campaigns, targeting, pacing, reporting). Lawma-as-EFSP envelope manager for jurisdictions where Lawma certifies as its own electronic-filing service provider.
Read the full written engineering plan
Where we are today, and how we're getting to production posture

The architecture, security posture, and technology stack described above are the enterprise-grade production stateLawma is being built toward. Some pieces are live today; others activate as we move through the enterprise transition plan we've locked in. This section describes today, and the plan that gets us to the target state.

Where we are today

  • Application layer: the full Lawma product runs today on TypeScript, Next.js, React, PostgreSQL, Drizzle, and the Anthropic SDK. The application code is substantially complete and mature.
  • Hosting (pre-scale): the application is hosted on Netlify and the database on Neon (serverless PostgreSQL). Both run on AWS underneath, but through managed layers. This is convenient for pre-scale development; it is not our long-term posture.
  • Identity and authentication: the Auth0 integration is built and smoke-tested. Multi-factor authentication is briefly relaxed pre-launch to reduce demo-account friction; it re-enables as a launch-day gate.
  • Database isolation: the schema is stamped with a firm-identity column on every row and per-party wall columns on every case-scoped table. Row-level security is designed; the policies activate in the security-foundation phase before real client data lands in the system.
  • AI posture: Claude is called directly under a zero-data-retention posture. The formal enterprise agreement with committed capacity and Amazon Bedrock integration comes in the scale phase.
  • Observability: Sentry is live for error tracking. Datadog, CloudWatch, and CloudTrail integrations activate during the migration to AWS.
  • Messaging: Postmark and Twilio are planned integrations, not live today.

How we get to enterprise-grade production

A four-phase transition plan governs the move to production posture:

  1. Security foundation (first few months) — automated scans block malicious dependencies, leaked secrets, and missing authorization checks on every code change. Written threat models and policies. Off-provider nightly backups with quarterly tested restore drills. Public security page.
  2. Pre-audit readiness (months three through nine) — Auth0 with mandatory multi-factor authentication live in production. Row-level security policies active in the database. Independent penetration test complete. SOC 2 auditor engaged.
  3. Attestation and scale migration (months nine through fifteen) — SOC 2 Type I report in hand. The application migrates from Netlify to AWS ECS Fargate; the database migrates from Neon to AWS Aurora PostgreSQL. Managed cloud services replaced with AWS-native equivalents so the compliance surface, cost economics, and disaster-recovery posture inherit directly from a tier-one cloud provider. Anthropic Enterprise Agreement with committed capacity. CloudFront, WAF, CloudTrail, Datadog, and Redis all come online.
  4. Full enterprise posture (months fifteen through twenty-four) — SOC 2 Type II report published. Multi-region active-passive failover with tested recovery under one hour. Uptime service-level agreement published. Bug bounty program live. Independent third-party security assessment.

Beyond that: ISO 27001, HIPAA-adjacent posture, or FedRAMP are pursued if and when specific business signals demand them.

The gating principle: engineered scale never outruns engineered trust. We do not ship at scale to real clients without the attestations that back the claims on this page.

Source trace — production architecture in the Engineering Plan — per-tool rationale and security details. Capability specifications in the Product Requirements Specification. Architectural decisions in the Decisions Log.