Back
03
SaaS Platform — In Development
2025Phase 1 complete
Source Code

Designing a SaaS platform for complex medical transport operations

How I built a modular system with deterministic pricing, auditability, and 146 automated tests — designed for real healthcare workflows.

Quick Highlights
01

Designed a modular SaaS architecture with clear domain boundaries

02

Built a deterministic 7-step pricing engine with immutable snapshots

03

Implemented full test coverage for pricing and invoicing logic from the start

SaaS ArchitectureHealthcare SystemPricing EngineTest-Driven
5
Problems
6
Decisions
5
Results
coreNext.js 14TypeScript (strict)
backendPostgreSQLPrisma 5ZodNextAuth
features7-Step Pricing EngineImmutable SnapshotsDomain Modules@react-pdf/renderer
systemTailwind CSSRechartsVercel
testingVitest@vitest/coverage-v8
01
Context

Start with the situation before the implementation

10 signals frame the real scope before the solution appears

Problem

What needed to change

5 friction points identified before moving into execution

01

Medical transport operators manage scheduling, pricing, and invoicing through disconnected spreadsheets

02

No unified system exists for ambulance dispatch, home care visits, and coordination

03

Pricing rules are complex — urgency, staff type, distance, time, and holidays

04

Manual invoice generation leads to frequent errors and inconsistencies

Impact

Why it mattered to the business

5 business consequences made the problem impossible to ignore

01

Frequent pricing errors due to manual calculations

02

Revenue loss from inconsistent invoicing and tracking

03

No visibility into operational performance or financial metrics

04

Compliance risks due to lack of audit logs

02
Solution

Move from diagnosis into deliberate decisions

6 trade-offs explain how the solution took shape

Decisions

Why these choices held up

A focused view of the structural decisions that shaped the final system.

01

Adopted modular DDD-style architecture with strict boundaries per domain

02

Used Server Actions as the only mutation layer (no REST API complexity)

03

Built a deterministic pricing engine with 7 explicit steps

04

Introduced immutable snapshots to preserve financial history

03
System

Keep the architecture readable at a glance

A shorter systems view up front, with deeper engineering details available later.

Architecture

How the core pieces fit together

5 structural patterns describe the blueprint without dropping into full technical depth

01

8 modular domains (clients, patients, services, invoices, payments, pricing, users, dashboard)

02

Deterministic pricing engine resolving through 7 steps with full traceability

03

Immutable pricing snapshots stored alongside services

04

PostgreSQL with Prisma ORM ensuring relational integrity

04
Results

What changed after shipping

5 measurable improvements surface the outcome without forcing a deep read

Results

What improved after launch

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

What's next?

This is not a demo project — it is a production-grade SaaS platform designed to handle real-world healthcare operations.

Next Project: Retail Inventory & POS SystemBack to HomepageStart a Conversation
Technical Deep Dive

Detailed architecture, guarantees, and code paths stay available for engineers without overwhelming the main story.