
Nabodigonto
100,000+ LOC edge-native distributed monorepo and community platform for Nabodigonto Social Welfare Organization. Decomposed into fault-isolated applications (Vite public SPA, React 19 member portal, Expo mobile app), a modular Hono.js API worker on Cloudflare D1 with atomic batch transactions, an isolated Bengali PDF and media engine on R2, and a 4-channel queue notification engine (SMS, email, push).
The Problem
Nabodigonto Social Welfare Organization previously relied on fragmented paper records, scattered messaging groups, and manual receipt collection to manage hundreds of members, blood donation directories, and student aid. Serving both rural members on flaky mobile 3G/4G and administrative officers required high performance, resilient offline access, and unified communication without incurring monthly cloud subscription costs.
Technical Approach
Architected an edge-native distributed platform structured as a 100k+ LOC Turborepo monorepo: an auth-free public portal (Vite + React 19) with offline cached donor directories, an authenticated portal (React 19 + TanStack Router/Query + Clerk RBAC), a modular Hono API worker across 9 domain modules with atomic Cloudflare D1 batch mutations, a dedicated serverless media engine rendering Bengali Unicode vector PDFs (pdf-lib + fontkit) uploaded to Cloudflare R2, and an asynchronous notification worker consuming Cloudflare Queues for SMS, email, and mobile push delivery.
100k+ LOC Edge-Native Distributed Monorepo & Pipeline
services/api — 9 Modular Domains & D1 Batching
Modular edge router partitioned into 9 domain modules (members, dues, welfare, donors, notifications, etc.). Executes multi-table mutations atomically via Cloudflare D1 batch statements.
- ✓End-to-end type safety via packages/contracts & Hono RPC
- ✓D1 batch() transactions prevent race conditions on distributed SQLite
- ✓Zero long-lived TCP connection pool exhaustion risks
100k+ LOC Distributed Monorepo Architecture & Pipeline
Architecture: Decoupled public/portal frontends, modular Hono API on D1, dedicated media worker, and 4-channel queue notifications.
Key Highlights & Architecture
- Appointed as IT Secretary of the organization after designing and deploying this system
- Fault-isolated monorepo architecture separating public web (Vite SPA), member portal (React 19 + Clerk RBAC), and Expo mobile app
- Modular Hono.js API worker with 9 domain modules backed by Cloudflare D1 and atomic batch() transactions
- Serverless Bengali PDF & media engine using pdf-lib and fontkit for custom Bengali typography and digital member ID cards with QR verification
- 4-channel queue notification engine via Cloudflare Queues dispatching automated SMS (OneCodeSoft), Email (Resend), WebPush, and FCM with retry backoff
Engineering Challenges
- Rendering complex Bengali Unicode typography and ligatures in serverless vector PDFs within Cloudflare Worker 128MB memory constraints without headless browsers.
- Eliminating authentication bundle bloat on public informational and emergency blood donor directories to ensure sub-second loads on rural Bangladeshi mobile networks.
- Guaranteeing multi-statement ACID consistency across membership ledgers on distributed SQLite (Cloudflare D1) without long-running database locks.
Key Engineering Decisions
- Fault-Isolated Monorepo Architecture: Decoupled public web from authenticated portal and backend workers so auth downtime or heavy admin workloads never impact public availability.
- Atomic D1 Batch Transactions: Structured multi-table mutations into single-roundtrip atomic batch() statements, preventing race conditions on edge SQLite.
- Serverless Bengali Media Engine: Offloaded vector PDF rendering with custom TTF font embedding to an isolated media worker backed by Cloudflare R2, protecting API throughput.
- 4-Channel Queue-Driven Notifications: Decoupled slow external telecom SMS and email APIs using Cloudflare Queues with exponential retry backoff.
Trade-Off Analysis & Architectural Rationale
Fault-Isolated Monorepo over Single Monolith
Single All-in-One Next.js Application
Eliminates heavy auth bundle overhead from public landing pages and isolates PDF generation CPU load from API routing.
Requires monorepo workspace orchestration (pnpm + Turborepo) and shared packages.
Cloudflare D1 with Atomic Batch Statements
Unbounded Direct Edge Writes
Guarantees multi-table consistency across member ledgers and dues updates while maintaining edge colocation.
Requires batch statement structure rather than long-running interactive database transactions.
Dedicated Media Worker for Bengali Typography
Headless Chromium / Puppeteer
Puppeteer requires hundreds of MBs and cannot run in V8 isolates; pdf-lib + fontkit delivers in-memory vector PDFs in <40ms under 25MB RAM.
Requires manual coordinate layout calculations for vector PDF canvases.
Result & Outcome
Successfully launched into production as the organization's official operational backbone. Appointed IT Secretary by the executive board to oversee system governance, feature rollouts, and technical stewardship.