Back to Projects
React 19TypeScriptDjango 4.2Django ChannelsPostgreSQL 16RedisWebSocketGeminiOpenAI AgentsFAISSSSLCommerzDockerJWT

Complete Legal Aid

Legal help in Bangladesh is hard to price, hard to verify, and hard to reach. CLA puts citizens, verified lawyers, and administrators on one platform in both Bangla and English, and treats the awkward parts of the problem — proving a lawyer is real, holding money safely until work is done, and keeping evidence private — as first-class features rather than afterthoughts.

Full-Stack Developer & AI Integration Lead
Complete Legal Aid

The Problem

A citizen looking for legal help has no reliable way to check that a lawyer is genuine, no protection when paying up front, and no safe channel for sensitive documents. Lawyers, meanwhile, lose hours drafting standard filings by hand. Both sides fall back on personal referrals, which excludes anyone without the right contacts.

The Solution

Every role gets its own dashboard over a shared Django backend. Payments run through an escrow flow with an immutable ledger, so money is only released against completed work and the books can be proven consistent. Evidence never sits at a public URL — nginx denies /media by default and files are reachable only through short-lived signed links. Four server-side AI agents handle triage, case-strength estimation, drafting, and emergency routing, each restricted to an allow-listed set of tools and scoped to the caller's role.

System Architecture

The stack is event-driven rather than poll-driven: a service or signal pushes through a Redis channel layer into Django Channels, and the browser's WebSocket provider updates the UI directly. Polling exists only as a fallback. The AI layer is deliberately isolated — all keys stay server-side, and every AI feature degrades gracefully to a non-AI path when a key or an optional ML dependency is missing, so a missing API key never takes the platform down.

Complete Legal Aid pushes state changes outward through Redis and Django Channels; the browser subscribes rather than polls.CLIENTS - REACT 19 + VITECitizencases, booking, vaultLawyerdrafting, earningsAdminverification, ledgerJWT over HTTPS and WSSEDGE - NGINXTLS + SPAcertbot auto-renewalMedia Policydefault-deny, signed links onlyproxies /api /ws /adminAPPLICATION - DJANGO 4.2 ON DAPHNE (ASGI)DRF ViewsHTTP layerChannels Consumersnotifications, dashboard, presenceAgent RuntimeSSE, tool allow-listservice callsSERVICESWalletescrow + immutable ledgerDocumentbilingual generationAIGemini + FAISS RAGSearchstatutes, case law, newspersistedINFRASTRUCTUREPostgreSQL 16SQLite for local devRedis 7channel layerSecure Media Storesigned-link access
Complete Legal Aid pushes state changes outward through Redis and Django Channels; the browser subscribes rather than polls.Scroll sideways to see the full diagram

Key Features

Innovative solutions developed to solve complex technical challenges.

Four scoped AI agents

Counsel Match triages a citizen's problem into a ranked lawyer shortlist; Justice Lens gives a calibrated case-strength estimate with cited articles; Document Forge drafts from a lawyer's own cases and flags unfilled placeholders; Sentinel handles emergency triage with anonymity-respecting NGO routing. All use function-calling against allow-listed tools, stream over SSE, and are throttled per user.

Escrow payments on an immutable ledger

SSLCommerz payments flow through a single audited path that writes append-only WalletLedgerEntry records. A reconcile_wallets management command proves the ledger and balances agree.

Signed-link evidence vault

Evidence, identity papers, and chat attachments are never served from public URLs. nginx default-denies /media except explicit public folders; everything else is reachable only via short-lived signed links, behind extension, MIME, and magic-byte validation with a 25 MB cap.

Constitution RAG in plain Bangla

A Gemini-backed assistant answers in everyday Bangla, retrieving over the Constitution with FAISS so answers cite real articles instead of paraphrasing from memory.

Ban-aware JWT sessions

One-hour access tokens with seven-day rotating refresh and a blacklist. Banning a user invalidates their existing tokens immediately rather than waiting for expiry.

Court-ready bilingual drafting

Generates bail applications, deeds, notices, and affidavits in Bangla or English from lawyer-owned, database-backed templates that can be shared across the firm.

Challenges & Breakthroughs

1

Challenge: Keeping money movement auditable when payments, refunds, and withdrawals all touch the same balance.

Growth: Routed every balance change through one service instead of letting views update wallets directly, and made the ledger append-only so a mistake produces a correcting entry rather than a silent edit. That made a reconciliation command possible — consistency became something to verify on demand rather than assume.

2

Challenge: Confidential uploads are easy to leak, because the obvious setup serves them from a guessable static path.

Growth: Inverted the default: nginx denies everything under /media unless explicitly allowed, and private files are reachable only through expiring signed links. Deny-by-default means a new upload type is private until someone deliberately publishes it — the opposite of the usual failure mode.

3

Challenge: The on-box ML extras (FAISS, sentence-transformers) pull in torch at roughly 2.5 GB, which is unacceptable in a CI image.

Growth: Split them into a separate requirements-ml.txt and made every dependent feature detect their absence and fall back. The Docker image and CI skip them entirely, and the same codebase runs in both shapes without branching.

4

Challenge: Giving LLM agents real capability without giving them free rein over the database.

Growth: Each agent gets an explicit allow-list of tools and inherits the caller's role, so a citizen's agent cannot reach a lawyer's cases. Capability is granted per tool rather than withheld per query, which is far easier to reason about when reviewing what an agent can actually do.

Results & Impact

4
AI Agents
Counsel Match, Justice Lens, Document Forge, Sentinel — each role-scoped and tool-restricted
3
User Roles
Citizen, lawyer, and admin, each with a separate code-split dashboard
বাংলা + EN
Languages
Full i18n with Bangla code-split from the main bundle
5 services
Production Stack
PostgreSQL 16, Redis 7, Daphne, nginx, and certbot via one Docker Compose deploy

Next Project

SkillEx