CareMatrix
Multi-hospital patient & bed management
A system for hospital wards. Nurses and doctors see which rooms and beds are free or taken at a glance, follow every patient from admission to discharge, and each hospital runs its own departments and staff accounts. A Next.js web dashboard and an Expo app for Android and iOS.
rospitality.vercel.app
- Role
- Solo: design, front end, database, auth, deployment
- Platforms
- Web dashboard · Android & iOS app
- Tech
- Next.js 16React 19TypeScriptTailwind CSS v4TanStack QuerySupabasePostgreSQLExpoReact NativeVercel
198
commits since April 2026
53
database migrations
3
roles: admin, doctor, nurse
2
apps sharing one data layer
The problem
One screen for the question every ward asks first
On a busy ward the first questions are always the same: which beds are free, who is in each one, and what is planned for them today. CareMatrix answers them on one screen, without clicking through patient records.
Every department works a little differently, so the product had to adapt to the department instead of the other way round, and stay in sync on every device on the ward, including phones with patchy connectivity.
01 · Floor plan
Every room and bed, live
The home screen is the ward itself. Each room shows its beds with the patient's name, operation and status indicators, and the header shows free rooms, free beds and occupancy.
- One colour per clinical indicator: operated, scanner appointment, planned reoperation, ICU (ОАИЛ)
- Changes from any user appear on every screen through Supabase Realtime
- An admission made offline shows as “waiting for connection” and is sent when the device is back online
02 · Patient stay
From admission to discharge
Clicking a free bed opens the admission form; clicking an occupied one opens the patient's care plan. The whole stay lives in one record.
- Admission with clinical pathway, diagnosis and reusable care presets
- Therapies, procedures, operations, scanner appointments and ICU stays
- Transfer and discharge, with an archive of discharged patients and filters
03 · Care plan
Today's work, per patient
Nurses tick off therapies as they go; doctors plan operations and scanner appointments. The same rules decide what appears on the work lists on the web and on the phone.
- Care plan grouped by day, with times and completion
- Work lists for therapies, operations, scanner and ICU
- Clinical pathway changes flagged ahead of their date
04 · Administration
Hospitals, departments, roles and an audit trail
Each hospital has its own departments and staff. Admins add staff, pick their role and send an email invite, and manage departments from the same place.
- Admin, doctor and nurse roles; hospital data isolated with row-level security
- Department features switched on and off from configuration, so a new department needs no deploy
- Everything done in a department is written to an audit log
05 · Mobile
The same ward in your pocket
A separate Expo app for Android and iOS gives staff the floor plan and care plans on the move, with an offline cache so the last known state is always there.
- Shares types, queries and rules with the web app
- Offline query cache and a queue for changes made without signal
- Dark and light themes, Bulgarian interface
Under the hood
How it's built
- 01
One data layer for two apps
Every Supabase query and mutation lives in a shared package (@carematrix/data); the web and native hooks are thin wrappers. If both apps show it, exactly one function computes it.
- 02
Configuration over code
Each department's modules, navigation order and labels come from a JSONB config in the database, so onboarding a department is a data change.
- 03
Postgres with row-level security
Supabase Auth plus RLS policies keep each hospital's data separate. 53 numbered migrations, each with its prerequisites and a verification block.
- 04
Realtime and offline
A single Realtime channel keeps every client in sync; TanStack Query with a persisted cache and an offline queue covers lost connectivity.
- 05
Deployment
Web: GitHub to Vercel (Frankfurt region), only the main branch deploys. Mobile: Expo SDK 54 builds for Android and iOS.
Process
Built by directing Claude Code
I designed and built CareMatrix alone, mostly by directing an AI agent rather than typing every line myself. The quality comes from the process around the agent.
- 1
Plan first
I write and review the plan before any code is written.
- 2
Rules in AGENTS.md
Data access only in the shared package, update existing components instead of adding new ones, keep them modular.
- 3
Screenshots as the spec
Design references go in as screenshots, so the agent matches a target instead of guessing.
- 4
Audit before big features
Before offline mode, the agent audited the codebase; findings became GitHub issues instead of a stale checklist.