Building CareCircle: care-home software where a double-tap can't double a dose
How I built CareCircle, a multi-tenant elderly-care platform with a Laravel API and a Next.js front end, and the design decisions behind medication rounds, family updates, offline shifts and pilot readiness.
7 min read

A nurse on a care-home shift juggles twenty residents: morning hygiene, breakfast, fluids, a medication round, a blood-pressure reading that's a little high, a fall that needs follow-up, and a daughter calling to ask how her mum slept. Most of that is still recorded on paper charts, typed up later, or passed on verbally at handover.
CareCircle is my attempt to make that shift lighter. It's a multi-tenant platform for elderly-care facilities, built as two projects: elderly-care-api, a Laravel 13 API, and elderly-care-web, a Next.js 16 / React 19 front end. You can try the live demo, which runs on synthetic data.
The goal I wrote at the top of the plan: reduce nurse typing substantially while improving clinical traceability and family communication. This post walks through how that sentence turned into code.
Four roles, one resident
The same resident looks very different depending on who's looking:
- Nurses work from their assigned residents: daily care tasks, due medications, allergy alerts, abnormal vitals and shift handovers, on a phone-sized screen
- Families see a calm, non-medical view: only the update types the facility chose to share, opt-in photos, visit requests and structured questions
- Facility administrators manage residents, staff, nurse assignments, incidents, reports, compliance exports and billing
- Platform administrators provision facilities, subscriptions and invoices, with every cross-facility action audited
I wrote this as a one-page access matrix before writing a single controller, and every Laravel Policy is a direct translation of a row in it. A nurse can't open an unassigned resident; a family member can't see staff notes or incidents. The UI hides what you can't do, but the API is what actually says no.

Tenancy that's enforced three times
A care home's data is health data, so "a query forgot to filter by facility" can't be a possible bug. Isolation lives in layers:
- Policies on every operation, never checks in the UI.
- Scoped route bindings. Nested routes use scopeBindings() or explicit facility checks, and a mismatch returns 404 rather than 403, so the API doesn't even confirm another facility's record exists.
- Composite foreign keys like ['facility_id', 'resident_id'] and ['facility_id', 'medication_id'], so the database itself refuses a row that crosses tenants.
Around that, the code is deliberately boring: FormRequests for input, focused Action classes for multi-step workflows, JsonResources as strict allowlists for output. Audit logs and resident history are written explicitly inside the same transaction as the change. No model observers quietly doing things, so reading an Action tells you everything it does.
Medication rounds: the part that has to be right
In most apps, a duplicate request is an annoyance. In a medication round, it's a resident who appears to have had their blood-pressure tablet twice, or worse, a dose that looks given when it wasn't. So the medication flow is the most defensive code in the project.
A scheduled command generates due medication instances from each resident's active instructions every hour, idempotently. On the round, the nurse sees what's due and late, with life-threatening allergies pinned right on the card, and records one of three outcomes in a single tap: Administered, Declined or Unavailable.

Recording that tap does more than an insert:
- It locks the medication, the instruction and the due instance (lockForUpdate()), so someone updating the prescription and a nurse recording a dose can't race each other.
- It checks the instruction is still the one the instance was generated from, and was in effect at the recorded time. A stale schedule is rejected rather than silently recorded.
- It checks the instance is still scheduled, so two nurses can't both record the same dose.
- It uses the client's idempotency key: a retry with the same key and the same outcome returns the original record; the same key with a different outcome is a 409 Conflict, because that's a bug, not a retry. A unique-constraint race between two simultaneous requests is caught and resolved the same way.
One more decision I'm glad I made: medication administrations are never queued offline. Everything else can wait for the Wi-Fi to come back. A dose has to be confirmed by the server in the moment, because "I'll sync it later" is how two people end up giving the same tablet.
Vitals that flag themselves
When a nurse records a temperature or an oxygen saturation, the API evaluates it against thresholds and stores both the status and the rule that triggered it: spo2 < 92 is abnormal, temperature_c >= 37.5 is borderline, and so on. Abnormal readings surface on the nurse's dashboard until someone acknowledges them, and the acknowledgement is attributable like everything else. Storing the rule next to the reading means that months later you can see why something was flagged, not just that it was.
The web app: a BFF the browser can't see past
elderly-care-web uses a backend-for-frontend. The browser only talks to the Next.js app; a catch-all route handler forwards to Laravel and attaches the Sanctum token from an httpOnly cookie, so the token never reaches JavaScript. Token lifetime on the API (12 hours) matches the session cookie, so a forgotten token can't outlive the session that created it.
That proxy is where the hardening lives: path validation, cross-origin mutation checks, correlation IDs that follow a request from the browser to the audit log, and clean timeouts. proxy.ts adds a per-request CSP nonce, and analytics only load on the public marketing pages, after consent. The whole interface is translated into English, Romanian and Spanish with next-intl, and so are the notification emails, which never contain medical details.

Offline shifts without leaking health data
Care homes have thick walls and patchy Wi-Fi. Six kinds of writes (care events, their corrections, vitals, incidents, family requests and visit requests) keep working offline as TanStack Query mutations that pause and replay in order on reconnect. Because each one carries its idempotency key, replay is always safe, and the audit log records client_submitted_at and source: 'offline_sync' so you can tell a live entry from one that arrived later.
Storing those writes on a shared tablet means storing health data on a shared tablet, so the durable outbox is encrypted:
BFF derives a per-user key (HKDF, server secret)
→ browser imports it as a non-extractable AES-GCM CryptoKey
→ IndexedDB stores only ciphertext, with a 12-hour TTL (one shift)
→ logout or a user switch wipes the storeIf the connection stays down, the app escalates to an unreachable state after six failed probes or five minutes, whichever comes first. I was tempted to shorten that for medication rounds, but since doses are never queued anyway, a shorter threshold would mostly create false alarms. Instead, the pilot will measure time-to-unreachable, and the number gets revisited with real data.
Small product decisions that matter
Some of the most important choices weren't technical at all:
- Discharge, not delete. Discharge is a first-class button next to Delete. Delete is blocked (422) once a resident has clinical records, because the routine end of a stay shouldn't be one misclick away from destroying records a facility is legally required to keep.
- Billing never blocks care. Facilities are billed per active resident, and plan limits run in advisory mode for the whole pilot. Even later, enforcement will only ever apply to admin extras like exports and extra seats, never to logging care or recording medication.
- Families get structure, not chat. Requests and visit bookings are structured forms that land on the nurse's follow-up list, instead of an open chat channel that becomes a second job.
Proving it's ready, not just built
With V1 feature-complete, I treated launch as a set of engineering gates rather than a feeling:
- Query plans. I ran EXPLAIN against a deliberately tenant-skewed MySQL 8.4 dataset (about 37,000 care events and 14,000 medication instances), added five indexes and fixed the slow spots. One missing facility_id filter went from a full table scan at 7.18 ms to 0.06 ms; family timelines went from 8.93 ms to 0.48 ms.
- Failure drills. A real backup-and-restore (53 tables, 116 foreign keys, every row verified), instant account revocation, a simulated email outage with safe replay, an object-storage outage, and reconstructing a facility's audit trail from the logs. Each one became a runbook.
- Tests across both repos. 290 Pest tests on the API, 518 unit and guardrail tests plus 312 end-to-end tests on the web app, and a CI check that fails if the OpenAPI contract and the generated TypeScript types drift apart.
That contract sync deserves its own mention: the API exports an OpenAPI 3.1 spec with php artisan api:export-openapi, and the web app regenerates its types with pnpm api:sync. With two repos, it's the single thing that stops "works on my machine" from becoming "breaks on the ward".
What I'd tell myself at the start
- Find the one workflow that can't be wrong, and over-engineer it. For CareCircle, that's medication. Locks, effective-time checks and idempotency there; boring CRUD everywhere else.
- Decide what doesn't go offline. Offline support is easier to make safe when you're explicit about what's excluded.
- Make the routine action the easy one. Discharge over delete, advisory over enforced billing, structured requests over chat. Good defaults protect people more than warnings do.
CareCircle is ready for a pilot: the next step is shadowing a real nurse's shift and medication round, and checking every assumption against it. If you run or work in a care home and would like to be part of that, or you're building something similar and want to compare notes, I'd love to hear from you. In the meantime, the demo is open to explore.
Want something like this built? Let's talk.
Keep reading

2 December 2026
Building KidsCare: a kindergarten platform that works when the Wi-Fi doesn't
How I built KidsCare, a multi-tenant kindergarten platform with a Laravel API and a Next.js front end, and the design decisions behind tenancy, privacy and offline care logging.

2 December 2026
What I learned shipping my portfolio
Rebuilding raducea.eu: a design that shows the craft instead of describing it, moving from Slice Machine to the Prismic CLI, and why the content mattered more than the code.
1 December 2026
Why this portfolio runs on Prismic
How I use Prismic and Next.js to keep content out of the code, and how I publish posts straight from Markdown files.