How We Built a Clinic Management SaaS in 90 Days with Next.js
No endless planning. No feature creep. Just a focused, production-ready product that solves a real problem — the chaos of running an independent medical clinic.
Here's exactly how we did it.
The Problem We Were Solving
Walk into most independent clinics in India today and you'll find paper registration forms, handwritten prescriptions, and billing calculated on a calculator. The software that does exist is either desktop-only, expensive, or built for hospitals — not a 2-doctor practice in a tier-2 city.
We wanted to fix that. A web-based, mobile-friendly, affordable clinic OS that handles:
- Patient registration and records
- Doctor consultations with digital prescriptions
- Automated billing and receipts
- The entire patient journey, end to end
Week 1–2: Talking to Doctors Before Writing a Line of Code
The worst thing we could have done was start coding immediately. Instead, we spent the first two weeks doing user interviews with doctors and clinic staff in Surendranagar.
Key insights from those conversations:
Speed is everything. A registration process that takes 3 minutes is too slow. Doctors see 50–80 patients a day — every second matters. Prescription printing is non-negotiable. We had naively assumed digital prescriptions would replace paper. Wrong. Patients want a printed copy. So our system needed one-click printing baked in from day one. Billing is chaotic. Most clinics had no system for tracking which services were charged, whether payments were collected, or generating receipts. This was the biggest pain point.These insights shaped every architectural decision we made.
Week 3–5: Tech Stack Decisions
We chose Next.js 15 (App Router) as our foundation. Here's why:
Server Components for data-heavy views. Patient records pages needed to load fast. With React Server Components, we could fetch and render patient data entirely on the server — no client-side loading states on the most critical screens. API Routes for the backend. Rather than spinning up a separate Express or FastAPI server, Next.js API routes gave us everything we needed for authentication, CRUD operations, and PDF generation in one codebase. PostgreSQL + Prisma for the database. Patient data has strict relational requirements — a patient has many encounters, each encounter has many prescriptions, each prescription has many drugs. Prisma's type-safe query builder caught data bugs at compile time rather than runtime.For the UI, we used Tailwind CSS + shadcn/ui for rapid component building, and Resend for email notifications (appointment confirmations, billing receipts).
Week 6–10: The Hard Parts
Patient Search at Scale
With thousands of patients potentially in the database, search needed to be instant. We implemented a full-text search index on patient name and phone number using PostgreSQL's tsvector and tsquery — no external search service needed.
``sql
This gave us sub-50ms search across 100,000+ patient records.
Prescription PDF Generation
This was our biggest technical challenge. Doctors needed professional-looking prescriptions with the clinic's letterhead, doctor's signature area, and drug details — all generated server-side and printable immediately.
We used Puppeteer running in a serverless function to render a React component as HTML, then convert it to PDF. The trick was warming up the browser instance to avoid cold start delays.
Offline-First Billing
Internet connectivity in smaller clinics can be unreliable. We built the billing module to work offline using IndexedDB and sync when connection was restored — a design pattern borrowed from progressive web apps.
Week 11–12: Security Hardening Before Launch
Healthcare data is sensitive. Before shipping, we:
- Implemented row-level security in PostgreSQL so clinic A can never query clinic B's patients
- Added AES-256 encryption for sensitive fields (diagnosis notes, prescription history)
- Set up audit logging for every data access and modification
- Ran a penetration test on the API endpoints
The Numbers After Launch
ClinicOS went live in January 2026. Three months in:
- 12 clinics actively using the platform
- 4,200+ patients registered across all clinics
- 18,000+ prescriptions generated
- Average registration time: 47 seconds (down from 4–5 minutes on paper)
- Average billing time: 23 seconds (down from 8–10 minutes manually)
What We'd Do Differently
Start with mobile. We built desktop-first and retrofitted mobile responsiveness. Given that most clinic staff use smartphones, we should have inverted that. Add a proper onboarding flow earlier. The first 3 clinics needed hand-holding to set up. A guided setup wizard would have saved everyone time. Invest in observability sooner. We added proper error tracking and logging in week 8. It should have been week 1.Try ClinicOS
If you run an independent clinic or know someone who does, ClinicOS is live at cms.zidbit.com with a 30-day free trial.
And if you're a startup or business looking to build something similar — a vertical SaaS, an operations platform, or a customer-facing application — we'd love to talk.
This post is part of our ongoing "Built by ZidBit" series where we share technical deep-dives on products we've shipped.
