// CASE STUDY
LAW FIRM OPS
AUTOMATION
A full operations platform for AR&CO, a law firm, that automates the manual work around every client: intake, payment, account creation, case filing, billing, and the civic-complaint workflow, all wired into one secure system.
- NestJS
- Next.js
- Supabase
- PostgreSQL
- Row-Level Security
- Lemon Squeezy
- Cal.com
- SendGrid
- TypeScript
- Zod
// THE PROBLEM
THE FIRMWAS THEBOTTLENECK.
A law firm's front office runs on manual relay. Every new client means a staff member keying in details, chasing payment, opening an account, creating the case file, and numbering it by hand. Consultations get booked over email tag. Complaints get tracked in a spreadsheet. None of it scales past the hours in a day.
The firm wanted a single platform where a client could self-serve from the first form to a paid, filed case, and where staff only step in for the judgement calls, not the data entry. The hard part was doing that without loosening who can see what: client records, case files, and payments all sit behind strict access rules.
“Every step a paralegal did by hand between a form submission and an open case is now a pipeline that runs itself.”
// WHAT WAS BUILT
INTAKE TOOPEN CASE.
A guest submits one form and pays. From there the platform provisions the account, files the case, issues the reference number, and emails credentials, with no staff member in the loop until the work itself needs doing.
Self-Serve Intake
A multi-step form takes a client's details, documents, and payment with no account required. The account is created only once payment clears.
- Guest Flow
- Document Upload
Payment-Triggered Accounts
A Lemon Squeezy webhook confirms payment, then auto-creates the Supabase user, client profile, and login, and emails the credentials via SendGrid.
- Webhook Pipeline
- Auto Provisioning
Gated Consultation Booking
Consultations unlock a Cal.com booking only after the fee is paid; a webhook then links the booking back to the client record automatically.
- Cal.com
- Pay-to-Book
// HOW IT WORKS
ENGINEERINGDECISIONS.
A NestJS API sits over a Supabase Postgres database, with the automation split between deterministic database triggers and webhook-driven services.
Database-Generated References
Case, invoice, complaint, registration, and consultation numbers are all issued by Postgres triggers (CASE-YYYY-NNNN and friends), so numbering is atomic and never collides.
- DB Triggers
- Atomic Numbering
Row-Level Security
Access is enforced in the database, not just the app. Clients see only their own records, attorneys see assigned cases, and staff see all, checked on every query.
- RLS
- Role-Based Access
Subscription-Gated Workflows
The civic-complaint pipeline (submitted, under review, escalated, resolved) is gated behind an active retainer, verified server-side before a complaint is accepted.
- Access Gating
- Status Pipeline
Automatic Audit Trail
A global interceptor logs every action to an audit table on its own, so there is a complete record of who did what, with no manual logging.
- Global Interceptor
- Audit Logs
// OUTCOMES
RESULTS.
- Staff stopped keying in new clients: intake, payment, and account creation now run as one automated pipeline
- Case, invoice, and complaint numbers are issued by the database, removing a whole class of manual errors
- Every record sits behind row-level security, so automation never comes at the cost of who can see what
// LET'S TALK
WANT TOAUTOMATE OPS?
We scope everything in detail before payment is taken. You work directly with a senior engineer, not a project manager relaying messages to an offshore team.