Skip to content
OmniMatter
All insights

Engineering note · · 4 min read

Two clinics, one codebase: how ClinicPlus OS keeps tenants apart

How we run two independent dental practices on one release of ClinicPlus OS, with database-enforced isolation, retry-safe booking and onboarding by configuration.

One product, not a set of forks

ClinicPlus OS runs Mamatha Dental Care and Sumukha Dento Facial Care from the same release. Each practice has its own domain, branding, treatments, doctors and schedule, and none of that lives in the application code. A clinic is a configuration pack. Onboarding a new practice is a configuration change, never a source fork.

That rule is enforced, not aspirational. A test rejects any clinic-specific value that appears in reusable source, so one clinic’s name or phone number cannot leak into another clinic’s pages.

Isolation the database enforces

Both clinics share one PostgreSQL database, and every clinical row carries a clinic identifier. Filtering in application code is not enough on its own, so the database applies row-level security as well.

The application connects with a dedicated role that cannot bypass those policies. Before the second clinic went live we ran cross-tenant checks on the production database itself, not only on a local copy: a session scoped to one clinic could not read or change the other clinic’s records.

Booking that survives a weak connection

Most patients book from a phone, often on an unreliable network. If a request times out and the browser retries, a naive system creates a duplicate appointment. ClinicPlus attaches an idempotency key to each booking, scoped to the clinic, and the database treats a replay as the same request. We proved this against real PostgreSQL, including a replay after the server process was replaced.

Staff access and recovery

Reception and doctors sign in with individual accounts. Permissions are role-based and staff actions are written to an audit trail, so a clinic can see who changed an appointment and when.

Backups are only useful if they restore. Our backup procedure produces a clinic-scoped export and then restores it into a throwaway database to verify the rows came back, before we call a backup good.

Why this matters beyond clinics

The same pattern applies to most multi-customer software: configuration instead of forks, isolation enforced where the data lives, writes that are safe to retry, and recovery that is tested rather than assumed. It is how we approach custom SaaS work for other industries.

Want this kind of engineering on your system?

Start a project