LawSaaS — Legal Case Management Platform
A bilingual (Arabic RTL / English) SaaS that runs an entire law firm from one screen: matters, court sessions, billing and staff in a single role-scoped system of record, with a daily dashboard that surfaces what needs attention today. Built on Django and Next.js, and shipped to each client's own server through an automated one-command deploy pipeline.

Key Metrics
Tech Stack
Key Features
- 8 matter types in 3 groups: Litigation, Corporate & Compliance, and Advisory
- Court-degree tracking (first instance, appeal, cassation) with its own number, court and judge per degree
- Hearing scheduling with a calendar, rescheduling/cancelling, and a seeded Egyptian courts directory in Arabic and English
- Payments and expenses (including recurring ones) with an approval workflow and finance breakdowns
- 4 strictly separated roles: Head Lawyer, Junior Lawyer, Client portal, and back-office Admin
- Legal notices, powers of attorney, and documents with previews and PDF export via Gotenberg
- Per-entity audit trail plus a diagnostics layer: reference codes, request log, user timeline and alerts
- Arabic (RTL) and English (LTR) as first-class locales, with per-client branding
- One-command, repeatable deployment to each client's own server: HTTPS, firewall, backups and instant rollback
Project Impact
- Replaces scattered paper files and spreadsheets with one auditable system, gives every person in the firm exactly the access they need, and reaches each client through a repeatable, safe deployment.
Project Overview
Overview
LawSaaS is a legal case management platform built for law firms in Egypt. It replaces paper files, spreadsheets and chat threads with one role-scoped system of record: every matter, client, hearing, payment and task lives in one place, and each person sees exactly what they should. Arabic (RTL) and English are both first-class, not a translation layer bolted on afterwards.
The problem
A busy firm juggles dozens of open matters across multiple courts and degrees. Hearing dates live in a diary, payments in a spreadsheet, documents in a shared drive, and the head lawyer has no single view of what needs action today. Junior lawyers either see too much or too little, and clients keep calling for status updates.
What it does
- Matters – eight matter types across Litigation, Corporate & Compliance, and Advisory work, with matter groups, duplication, and primary and co-clients.
- Court degrees – first instance, appeal and cassation, each with its own case number, court and judge.
- Sessions and calendar – schedule, reschedule and cancel hearings, backed by a seeded Egyptian courts directory in Arabic and English.
- Finance – payments, recurring expenses with approval, and summaries and breakdowns by matter.
- Documents and notices – attachments with generated previews, PDF exports, legal notices and powers of attorney.
- Tasks and reminders – assignment, overdue detection and due-date reminders.
- Role-based dashboards – each role opens to a dashboard of what needs action today.
- Client portal – clients see their own matters, payments and sessions, and nothing else.
Roles and access
| Role | Sees | | --- | --- | | Head Lawyer | The whole firm: matters, clients, employees, finances and the approvals queue | | Junior Lawyer | Only assigned matters, tasks and notes | | Client | Read-only view of their own matters, payments, notes and sessions | | Admin | Back-office superuser, outside the firm hierarchy |
Engineering
Backend. Django 5.2 and Django REST Framework, organised as 19 domain-scoped apps. Each one follows the same shape: thin views, validation-only serializers, and a services/ layer that owns the business logic so it can be reused by the API, management commands and Celery jobs. Errors are typed (ServiceError subclasses carrying an error key and HTTP status), responses use one envelope, and most models are soft-deleted.
Frontend. Next.js 15 (App Router) with React 19, next-intl, TanStack Query and Tailwind 4. Every request goes through one API client that handles cookie auth, silent 401 → refresh → retry, and cross-tab refresh coordination. Lists use a shared data table that becomes cards on phones, so nothing is hidden on mobile.
Async and documents. PostgreSQL 17, Redis 7, and Celery workers plus beat for recurring expenses, overdue checks, reminders, export cleanup and health checks. A Gotenberg sidecar renders document previews and PDF exports.
Security. JWT in httpOnly cookies with rotating, blacklisted refresh tokens, forced password change on first login, and per-role scoping enforced server-side.
Observability. Per-entity activity log, reference codes on errors, a request log, user timelines, alerts and a /api/health/ endpoint.
Quality. Django unit tests, a generated Postman/Newman API suite, and Playwright end-to-end tests, run through four GitHub Actions workflows.
Deployment: one command per client
LawSaaS is delivered to each client's own Ubuntu server by a dedicated Ansible-based deploy tool.
./quick-deploy.sh <client> init # first-time install
./quick-deploy.sh <client> update # push a new release
./deploy.sh <client> rollback # back to the previous release, no rebuild
What that single command takes care of:
- Server preparation – Docker engine install, a default-deny firewall (only SSH, HTTP and HTTPS open), and optional key-only SSH hardening.
- HTTPS – automatic Let's Encrypt for clients with a public domain, or a self-signed certificate for internal installs.
- Source protection – the backend ships as a Nuitka-compiled binary, and images travel as checksum-verified tarballs, so it works on sites with unreliable internet.
- Safe updates – a database snapshot is taken before every migration, releases are kept side by side, and rollback repoints to the previous one.
- Backups – nightly database and uploaded-media backups with 14-day retention, plus a documented restore procedure.
- Secrets – kept in Ansible Vault, never committed in plaintext.
- Post-deploy verification – the script probes the live endpoints and reports what it observed against what it expected.
- Per-client branding – names in Arabic and English plus a logo, supplied as configuration.
For a firm, this means a new installation is a repeatable procedure rather than a project, and an update is a controlled event with a way back.