Case 04
Clinavi medical practice platform
I am cofounding a medical practice platform in pilot, with patient files, consultations and documents, CNSS billing, and WhatsApp reminders.
Pilot · 2026 · French and ArabicCofounder and full-stack engineer
I am cofounding Clinavi, a medical practice platform developed with Moroccan doctors and currently in pilot. My work spans architecture, backend and frontend, product decisions, infrastructure and security.
Visit Clinavi- The problem
- Practices enter patient, consultation and payment details for prescriptions, certificates, invoices and CNSS care sheets. Clinical records also need to stay within the right practice and role.
- What I built
- I build patient files, scheduling, consultations with five document types, CNSS billing and WhatsApp reminders in four languages. A fully paid CNSS invoice triggers an attempt to draft its care sheet.
- What changed
- In pilot, five consultation documents share draft, finalized and superseded states. A fully paid CNSS invoice prompts an attempt to draft a care sheet, and pre-visit reminders retry transient failures within a three-attempt limit.
One consultation shows patient, visit, and payment details entered once. The prescription, certificate, invoice, and care sheet fill in from the visit and record details; the care sheet waits until the invoice is fully paid. A WhatsApp reminder appears before the next visit.
Patient · e.g. 34 y
Visit reason · Follow-up
Fee · €40
From the visit.
From the visit and the patient record.
From the visit and its fee.
Invoice ↔ consultation linkFrom the invoice, once it is paid in full.
draft · finalized · superseded
Transcript
This is an illustrative flow, not a recording: the consultation is entered once, with patient, reason and fee. From it, the prescription, medical certificate, invoice and care sheet fill in, shown in reading order, not execution order; the care sheet starts once the invoice is paid in full. The patient details are examples.
Work across a medical practice
A medical practice handles patient files, appointments and the waiting queue, consultations, documents, billing and reminders. I am building Clinavi with Moroccan doctors around these workflows, with the interface in French and Arabic.
Clinavi is in pilot. I describe the work and product scope here; the case makes no claims about adoption, commercial traction, compliance certification or clinical outcomes.
Documents and billing share consultation details
A consultation can produce five document types: a prescription, certificate, examination request, referral letter and CNSS care sheet. Each moves through draft, finalized and superseded states.
Each issued CNSS invoice links to its consultation. After recording a payment that brings the invoice to fully paid, the system attempts to draft a care sheet. Partial payments create no draft. A failed draft does not undo the payment, and the care sheet remains a draft until someone finalizes it.
The session sets practice and role boundaries
The authenticated session supplies the practice identity and clinic role, doctor or assistant, and database constraints tie roles to clinics. Clinical workflows follow those session boundaries. Platform, authentication and reference data remain outside any single practice.
WhatsApp templates are available in French, Arabic, English and Darija. A background worker sends pre-visit reminders, while booking confirmations are sent once at booking time.
Roles
Clinic and platform roles
Doctors and assistants work within a clinic. The platform admin role stays outside clinic workflows.
Messaging
Reminder retries
The worker retries only transient failures, up to three attempts at two and then ten minutes apart.
Logging
Reminder error logging
The reminder worker excludes phone numbers and message bodies from error logs.
Ongoing pilot readiness work
Patient records, scheduling, billing, consultations, documents and reminders have written specifications. My ongoing pilot-readiness review checks one area at a time, including tenancy, roles and deployment, and fixes clear findings in small changes. This review is not a certification.
The source tree contains more than 150 test files.
Scope
What I built
Platform work
01- Architecture and backend systems.
- Frontend and product decisions.
- Infrastructure and deployment.
Practice workflows
02- Consultation documents and CNSS billing.
- Scheduling and WhatsApp reminders in four languages.
Practice boundaries and readiness
03- Session-derived practice and role boundaries.
- Pilot-readiness review and testing.
Stack
- Next.js
- TypeScript
- PostgreSQL