How I built a modular system with deterministic pricing, auditability, and 146 automated tests — designed for real healthcare workflows.
Designed a modular SaaS architecture with clear domain boundaries
Built a deterministic 7-step pricing engine with immutable snapshots
Implemented full test coverage for pricing and invoicing logic from the start
10 signals frame the real scope before the solution appears
5 friction points identified before moving into execution
Medical transport operators manage scheduling, pricing, and invoicing through disconnected spreadsheets
No unified system exists for ambulance dispatch, home care visits, and coordination
Pricing rules are complex — urgency, staff type, distance, time, and holidays
Manual invoice generation leads to frequent errors and inconsistencies
5 business consequences made the problem impossible to ignore
Frequent pricing errors due to manual calculations
Revenue loss from inconsistent invoicing and tracking
No visibility into operational performance or financial metrics
Compliance risks due to lack of audit logs
6 trade-offs explain how the solution took shape
A focused view of the structural decisions that shaped the final system.
Adopted modular DDD-style architecture with strict boundaries per domain
Used Server Actions as the only mutation layer (no REST API complexity)
Built a deterministic pricing engine with 7 explicit steps
Introduced immutable snapshots to preserve financial history
A shorter systems view up front, with deeper engineering details available later.
5 structural patterns describe the blueprint without dropping into full technical depth
8 modular domains (clients, patients, services, invoices, payments, pricing, users, dashboard)
Deterministic pricing engine resolving through 7 steps with full traceability
Immutable pricing snapshots stored alongside services
PostgreSQL with Prisma ORM ensuring relational integrity
5 measurable improvements surface the outcome without forcing a deep read
A concise outcome layer first, with the full set available on demand.
146 automated tests ensuring reliability of pricing and invoicing logic
Clean modular codebase with clear domain boundaries
Scalable foundation ready for production deployment
Deterministic pricing system eliminating calculation ambiguity
This is not a demo project — it is a production-grade SaaS platform designed to handle real-world healthcare operations.
Detailed architecture, guarantees, and code paths stay available for engineers without overwhelming the main story.