Patterns

Updated

Reusable shapes from production systems.

Not frameworks — patterns proven on desks. Emphasis on when to use and what you trade away.

What
Architecture & AI product patterns
Who
Engineers and founders designing systems
Why
Reuse judgment, not copy-paste code
Next
Diagrams · Decisions

Pattern 01

Multi-tenant SaaS (desk-shaped)

Tenant isolation around firms and matters — not a generic CRM schema dressed as LegalTech.

TenantFirm / workspace boundary
DomainCompany → file → matter → asset
AccessRoles on desk work, not “deals”
OperateMigrations in desk slices

Tradeoff: Harder to pitch horizontally; easier daily use. NepalIPMS · Decision

Pattern 02

Document Intelligence

Turn messy documents into structured action — without pretending OCR is understanding.

InputPDF, bulletin, scan
ExtractionLayout OCR & fields
UnderstandingClassify, map, score
ActionReview, merge, remind

OCR Engine · Research · Diagram

Pattern 03

OCR processing pipeline

Staged pipeline with confidence gates — more components than a magic upload button.

StoreR2 + provenance
OCRLayout-aware text
MapFields + confidence
ReviewHuman before merge

Interactive · Engineering · Decision

Pattern 04

Search architecture (exact-first)

Normalize hard, match exact/prefix, expand later — trust on a live call beats fuzzy demos.

NormalizeCase, space, variants
Exact / FTSToken accuracy
LatencyDesk-call budgets
ExpandOptional, controlled

130K search · Decision · Diagram

Pattern 05

Cloudflare-first application

Workers + D1 + R2 + KV as the default stack when one person must ship and operate.

Edge appNext.js / assets
APIWorkers
StateD1 · KV
FilesR2

Engineering · D1 decision · Diagram

Pattern 06

AI review workflow

AI proposes; humans remain accountable. The review screen is the product.

AI SuggestionDraft or extract
Human VerificationAccept, edit, reject
System LearningThresholds & mapping

Playground · Decision · Playbook

Pattern 07

Document lifecycle

Ingest → store → extract → review → merge → act — provenance never orphaned.

IngestUpload / bulletin
ExtractFields + confidence
ConfirmHuman gate
ActMatter, remind, search

Systems · Diagram

Pattern 08

Workflow automation

Triggers attached to owned records — not bots that wander without accountability.

TriggerDeadline, upload, status
DecisionRules + confidence
ActionNotify, queue, draft
FeedbackHuman closes the loop

NepalIPMS · Lab · Changed my mind