Architecture gallery

How the systems fit together.

Production diagrams from LegalTech SaaS, document intelligence, and edge-native infrastructure — drawn the way I explain them to practitioners and engineers.

Document intelligence

OCR bulletin intake pipeline.

Click each stage for technology, reason, and tradeoff. Flow animates until you interact.

Upload

Technology
Reason
Tradeoff

Human review sits between extraction and merge — AI accelerates intake; experts stay accountable for the matter record.

LegalTech SaaS

NepalIPMS application architecture.

Next.js client · firm portal + admin Workers API · 300+ REST endpoints auth · matters · deadlines · litigation · search · OCR hooks D1 · SQLite matters · register · migrations R2 · documents filings · bulletins · exports KV · cache sessions · rate limits Domain model: Company → File → Matter → Asset (TM / patent / design)

A single API surface serves firm staff and automation. Persistent state lives in D1 and R2; the data model mirrors how Nepalese IP desks already organize client portfolios.

Edge infrastructure

Cloudflare deployment topology.

Cloudflare global edge · TLS · WAF · CDN Pages / Assets static UI shell Workers API + cron + queues Durable Objects optional coordination D1 R2 KV

Traffic terminates at the edge; compute runs close to users across Nepal and abroad. Bindings connect Workers to D1, R2, and KV without managing regional servers.

Register search

130k trademark lookup flow.

Search UI mark · app no · class Query planner FTS5 + filters normalized tokens D1 index 130k+ rows Rank + paginate <200ms target Results KV caches hot queries · migrations keep register in sync with DoI imports

Paralegals search by mark text, application number, or class during live client calls. Full-text indexes and careful normalization keep responses fast enough to stay on the phone.

Applied AI

Retrieval and generation pipeline.

User prompt Embed query Workers AI / API Vector + FTS retrieve Context pack matter docs · statutes LLM Draft + citations Human review before anything enters a client file Guardrails: scope limits · source attribution · no auto-filing

Legal AI features retrieve grounded context before generation. Outputs are drafts with citations — experts stay in control of what reaches a matter record.

NepalIPMS case study · Back to portfolio