When you're building for a 4-dentist practice, the architecture needs to be proportional. No microservices, no Kubernetes, no event streaming platforms. Dandaansaz needed a system that a single developer could maintain, that worked on unreliable internet, and that cost less than $50/month to run. Here's the lightweight architecture that delivered.
The Three-Service Architecture
We designed the system as three loosely coupled services: (1) A Next.js web application handling the public website, booking widget, and admin dashboard. (2) A Supabase backend handling the database, authentication, and file storage. (3) A lightweight Node.js service handling WhatsApp API integration and SMS reminders. Each service can fail independently — if the reminder service goes down, the website and booking still work. This fault tolerance is critical for healthcare.
Database Schema for Dental Practices
We designed a PostgreSQL schema tailored to dental workflows: patients table (demographics, medical history, allergies), treatments table (procedure types, durations, pricing), appointments table (patient, practitioner, treatment, time slot, status), and a treatment_history table (linking patients to completed treatments with notes). The schema is simple — 8 tables total — but covers the full patient lifecycle from first inquiry to post-treatment follow-up.
Note
Dental schemas need a treatment_history table separate from appointments. An appointment is a scheduling event; a treatment record is a clinical event. Conflating them creates data integrity issues.
Offline Sync Strategy
The offline sync uses a queue-based approach: when the tablet submits a form offline, the data is stored in IndexedDB with a 'pending' status. A background sync script checks for pending data every 30 seconds when online. If sync fails, it retries with exponential backoff. The key constraint: no data is lost, but it may be temporarily unavailable in the cloud dashboard. For a dental clinic, this is acceptable — the data is safe on the tablet until sync completes.
Why Not a CMS?
We considered WordPress or a headless CMS for the content pages. We rejected both because: (1) WordPress plugins for healthcare (booking, forms, HIPAA considerations) are unreliable and create security surface area. (2) A headless CMS adds a layer of complexity that a 4-dentist practice doesn't need. (3) Next.js with static page generation gives better performance than any CMS, and the clinic's content changes infrequently (new procedures, new team members). A code-based content approach is simpler to maintain.
Conclusion
Small practice architecture should be proportional to the practice. Three services, eight database tables, and a simple offline sync strategy handles everything Dandaansaz needs. The architecture's greatest feature isn't what it does — it's what it doesn't do. No unnecessary complexity, no unused features, no infrastructure that requires a DevOps engineer to maintain.
Key Takeaways
- Three loosely coupled services provide fault tolerance without complexity
- Eight-table PostgreSQL schema covers the full dental patient lifecycle
- Queue-based offline sync with IndexedDB ensures no data loss during connectivity gaps
- Code-based content beats CMS for small practices — better performance, simpler maintenance