ClinicFlow: The Open-Source Clinic Manager That Treats Time Like a Hard Constraint

FastAPI, React, and MongoDB are the surface. The real story is how ClinicFlow keeps identity, scheduling, and patient reminders from drifting out of sync.

7 to 8 min read • View on GitHub • More from Mitesh0710

A clinic reception desk rendered like a mechanical control panel. A calendar card slides into place while a barrier blocks overlapping appointments from entering the same lane. Behind it sits a locked schedule ledger, with a phone and envelope leading outward to patients.
ClinicFlow’s core idea is not the dashboard. It is the machinery that prevents bad appointments from being created in the first place.
Key Takeaways

When a Clinic Booking Becomes a Constraint Problem

Most clinic software looks simple until two people try to use the same slot. ClinicFlow starts with the harder truth: appointment software is only useful if it can refuse bad bookings before they land in the database. That is why the scheduler matters more here than the dashboard.

The backend treats time as a finite resource. It checks requested slots against existing booked appointments, uses timedelta arithmetic to measure overlap, and only then allows persistence. The shape of the system is less “save form” and more “gatekeep reality.”

A clinic appointment is not created in one step. It passes through identity, role, scheduling, and notification gates before it becomes operationally real.

Two interlocking mechanisms in close-up. A Clerk token lock can open a new identity gate or fall back to an older internal latch. Beside it, calendar gears stop when two appointment teeth collide, while a messenger wire splits into an envelope and a phone icon.
ClinicFlow’s three linked systems are easier to understand together than apart: identity, scheduling, and reminders.

The Scheduler Decides What Can Exist

The key function is not booking. It is validation. In practical terms, check_slot_available acts like a policy engine: if an existing appointment already occupies the requested window, the new one never becomes real. That is the right place to enforce the rule, because cleanup after insertion is already too late.

ProblemTypical simple appClinicFlow approachWhy it matters
Two patients claim the same time slotInsert the record, then fix conflicts laterReject overlaps before database writePrevents invalid state from ever existing
Appointment duration changes the collision windowHard-code a form field and hope for the bestUse time arithmetic to compute boundariesKeeps availability logic consistent
Booked and available states drift apartLet the UI decide what looks openMake the API gate the bookingBackend stays authoritative under load

That difference sounds small until the system gets used for real. A clinic does not need more rows in MongoDB. It needs fewer impossible rows.

Auth Without a Rewrite

ClinicFlow’s authentication story is quietly practical. It supports Clerk JWTs for modern identity, then falls back to an internal JWT path when needed. That is not just a security detail. It is a migration pattern for a repo moving from an early prototype toward a cleaner production boundary.

ProblemTypical simple appClinicFlow approachWhy it matters
Identity needs to evolve without breaking usersReplace the old auth system in one shotTry Clerk first, then fall back to internal JWTLets the project transition safely
Roles must survive across layersStore a token and infer the rest in the UISync local metadata with clinic-specific rolesBackend and frontend share the same model
Access control has to be explicitDepend on route names and client stateUse dependency checks and role-aware routesReduces accidental privilege drift

The interesting part is the shape of the transition. ClinicFlow does not force the codebase to choose between an internal login and an external identity provider. It uses both until the new path can stand on its own.

WhatsApp Is Not a Bolt-On Here

Reminders are part of the product loop, not a marketing extra. An APScheduler job checks for pending appointments in a 60-minute window, then sends notifications by email and WhatsApp. The point is not just to alert people. It is to close the gap between a booked slot and an actual patient showing up.

That design is smart because it recognizes where clinic software lives in the real world. Email is useful. WhatsApp is often more immediate. ClinicFlow treats both as first-class output channels instead of pretending one channel fits every patient.

def send_pending_reminders():
    appointments = find_appointments(
        reminder_sent=False,
        start_within_minutes=60,
        status="booked",
    )

    for appointment in appointments:
        send_email(appointment)
        send_whatsapp(appointment)
        mark_reminder_sent(appointment)

Frontend Guards That Match Backend Roles

The frontend is not decorative here. Protected routes check the user’s role, and a mismatch triggers a dedicated banner instead of a silent failure. That sounds minor, but it keeps the interface aligned with the backend’s permission model instead of inventing a second one.

For a clinic, that matters. Receptionists and doctors can share a system without sharing the same surface area. ClinicFlow uses that split cleanly, so each user sees the work they are actually allowed to do.

ProblemTypical simple appClinicFlow approachWhy it matters
A user opens the wrong dashboardRender the page and fail laterDetect the role mismatch immediatelyFewer confusing dead ends
Role state has to persist across navigationLet the UI infer access from one session checkUse route guards plus a mismatch bannerMakes permission errors legible
Frontend and backend permission rules driftDuplicate logic in disconnected placesKeep the same role model on both sidesCuts down on security and UX mismatch

What ClinicFlow Gets Right, and What It Will Have to Outgrow

The repo is strongest when it behaves like an operations engine. FastAPI dependency injection keeps authorization and role checks composable. MongoDB gives the model room to grow. The reminder loop shows real product thinking, not just CRUD hygiene.

The main limitation is also obvious. In-memory scheduling is fine for a small deployment, but it will eventually need a distributed job system if usage grows. That is not a flaw so much as the next boundary the project will have to cross.

That is what makes ClinicFlow worth attention. It does not merely store clinic data. It encodes the rules that keep clinic data sane.