Product architecture

From counter to record — one isolated, auditable stream.

ChronoCare Pro routes every watch through a deterministic pipeline. Each shop's data is sealed per subdomain. The milestone engine fires events that compose into the permanent Digital Service Record on completion.

Core flow

step.1
Intake
Job docket, photos, quote
step.2
Diagnose
Bench notes, parts list
step.3
In service
Timing, lubrication, reassembly
step.4
Ready
DSR draft generated
step.5
Collected
Payment + DSR sealed

Tenant isolation

Every request is scoped to a tenant resolved from subdomain. Database queries are partitioned by tenant_id with row-level enforcement. No shared query path exists.

request → resolveTenant(subdomain)
       ↓
middleware.attachTenantId(req)
       ↓
db.query.where({ tenant_id })  // enforced
       ↓
response (tenant-scoped)

Milestone engine

A state machine governs allowed transitions. Every change emits an event consumed by the messaging, notification and DSR builders.

received → diagnosed
diagnosed → in_service
in_service → ready
ready → collected (triggers dsr.issue)

Data model

Tenant
  • · id
  • · subdomain
  • · name
  • · plan
  • · branding
User
  • · id
  • · tenant_id
  • · role
  • · email
  • · name
Client
  • · id
  • · tenant_id
  • · name
  • · phone
  • · email
Job
  • · id
  • · tenant_id
  • · client_id
  • · watch_id
  • · status
  • · quote
Watch
  • · id
  • · brand
  • · model
  • · ref
  • · serial
  • · calibre
ServiceLog
  • · id
  • · job_id
  • · parts[]
  • · lubricants[]
  • · timing[]
DSR
  • · id
  • · job_id
  • · qr
  • · issued_at
  • · pdf_url
Message
  • · id
  • · job_id
  • · sender_id
  • · text
  • · at
Payment
  • · id
  • · job_id
  • · amount
  • · method
  • · stripe_id
iOS companion
Native client subscribes to job events via WebSocket. Push notifications dispatched via APNs on milestone change.
Messaging
Threaded per job. Watchmaker ↔ client. Photos inline. Optimistic UI with server reconciliation.
Reports engine
Materialised views recomputed nightly; deltas exposed under /api/reports for shop owner dashboards.

Stack

Edge runtime
Cloudflare Workers
API
TanStack Start · tRPC
Database
Postgres · RLS
Auth
Magic links · WebAuthn
Payments
Stripe Billing · Connect
Storage
R2 (photos · DSR PDFs)
Realtime
Durable Objects
iOS
SwiftUI · APNs · Combine