Multi-clinic, bilingual (ar-DZ/fr-DZ), offline-first EMR for Algeria — Law 18-07 compliant
# Clinic Management SaaS
**Multi-clinic, bilingual (Arabic RTL + French LTR), offline-first, fully self-hostable Electronic Medical Record & practice-management SaaS for Algeria**, compliant with Algerian data-protection Law 18-07 (amended by Law 25-11) and health-records Law 18-11.
Target geography: Algeria (Algiers, Oran, Constantine). Hosting model: fully self-hosted on Algerian sovereign infrastructure (local clinic server + offsite encrypted backup; sovereign cloud as optional DR).
> **AI agents: read `AGENTS.md` before writing any code.** It is the single source of truth for build commands, architecture rules, i18n/RTL rules, and the Do-NOT list.
## Status
Build-Ready. Architecture, data model, regulatory analysis, and phased MVP scope are specified in the Technical Blueprint v2.0. The atomic, step-by-step delivery plan is in the Atomic Delivery Roadmap v2.1.
## Reference Stack
Turborepo · pnpm · Next.js 16 PWA (App Router) · NestJS modular monolith · PostgreSQL 17 + Row-Level Security · Drizzle ORM · Better Auth (Organization plugin) · tRPC v11 · Dexie→PowerSync · Serwist · Orthanc · Socket.IO + Redis adapter.
## Prerequisites
- Node.js 24 LTS (v24.18.0)
- pnpm 11.10.0 (via Corepack)
- Docker 27+ (Postgres 17, Orthanc for imaging dev)
- Git 2.45+
## Setup
```bash
# Phase 1 — toolchain (one-time per sandbox)
./scripts/setup-workstation.sh
./scripts/verify-workstation.sh
cp .env.example .env.local && $EDITOR .env.local # fill in tokens
# Phase 3+ — install workspace deps and run
pnpm install
pnpm dev # starts web + api + worker via Turborepo
```
See `docs/runbooks/workstation-setup.md` for the full workstation setup procedure.
## Testing
```bash
pnpm test # Vitest unit/integration
pnpm test:e2e # Playwright end-to-end
pnpm lint
pnpm typecheck
```
## Workspace Layout
Turborepo + pnpm workspaces. Phase 3 (Monorepo Scaffold) introduces the
following structure; subsequent phases fill in the implementation.
```
clinic-saas/
├ …