LawyerHub
On-demand lawyer consultations by chat, audio or video, billed per minute from a prepaid wallet — with the billing decided only on the server.

Purpose
Let a client start a consultation with a lawyer straight from a phone and pay only for the minutes used, while the platform keeps a share and the lawyer can withdraw earnings.
The problem
Getting a quick legal answer usually means booking and paying for a fixed appointment. Pay-per-minute consultation needs a trustworthy meter: a price the client cannot tamper with and a ledger that stays consistent when two parties settle at once.
What I built
- A NestJS API in an npm-workspaces monorepo with 15 modules, a Prisma schema of 11 models and JWT access and refresh tokens, with throttling on authentication and a global rate limit.
- Server-side billing: a consultation starts only if the wallet covers at least two minutes of the lawyer's rate; on ending, the duration is computed on the server and the deduction, the lawyer's 80% credit and the transaction records are written in one database transaction with decimal arithmetic.
- A Socket.IO chat gateway with join, send, typing and read events, and the active session cached in Redis.
- A wallet with top-up, transaction history and withdrawal requests for lawyers.
- An Expo Router mobile app (iOS, Android and a web export) with authentication, a lawyer list, bookings, wallet and profile screens.
- A react-admin panel for the main resources, plus a Docker image, a Render blueprint, a Vercel config and a CI workflow.
Features
- Register, sign in and refresh with short-lived JWT access tokens and refresh tokens.
- A lawyer list, lawyer profiles and an online heartbeat so clients see who is available.
- Consultations start as chat, audio or video with a per-minute rate; the start is refused when the balance covers less than two minutes.
- Per-minute billing computed on the server and settled in one database transaction.
- A prepaid wallet with balance, top-up, transaction history, withdrawal requests and lawyer earnings.
- Real-time chat over WebSockets with typing and read indicators.
- Bookings that lawyers accept, decline or cancel, reviews with ratings, and a notification list.
- Mobile tabs for lawyers, bookings, wallet and profile.
- An admin API (dashboard, user switch, withdrawal processing) and a react-admin panel.
Stack
- TypeScript
- NestJS
- PostgreSQL
- Redis
- React
- Expo / React Native
- WebSocket
- Docker
- GitHub Actions
AI in this project
In the product
The product itself uses no AI: no language model is called anywhere in the code. Its integrations are payments, calls and push notifications.
In how it was built
- All 12 commits of the one-week MVP were written with Claude as the pair engineer.
- The project rule file tells the assistant what it may never do: bill on the client, change the wallet outside a transaction, hard-code secrets or URLs. New rules are written back into that file.
- One commit resolved 10 penetration-test and static-analysis findings.
Key flows
Steps
From top-up to settlement
Step 1 of 5: Sign in
The client registers or signs in; the app keeps the tokens in secure storage.
Step 2 of 5: Top up
The wallet is credited with a recorded transaction.
Step 3 of 5: Start
The client picks a lawyer and a type; the server checks the balance covers at least two minutes.
Step 4 of 5: Consult
Messages travel over a WebSocket channel while the server tracks the active session.
Step 5 of 5: Settle
On ending, the server computes the seconds, deducts the cost, credits the lawyer's share and records both movements atomically.
Limitations
- An MVP from one week of work. Audio and video calls are not functional: the call token endpoint returns a placeholder.
- Wallet top-up credits a balance without a real payment provider, and push notifications are not sent yet.
- The admin panel is generated list, edit and show views without custom screens.
- Billing happens when a consultation ends, not minute by minute, and the 80% split is fixed in code.
- Two test files with 11 cases cover authentication and the wallet; coverage is not measured.
Want something like this?
Tell me about your project — I reply within two working days.
Start a project