# danielxjones/ccps-ltd architecture

> Architecture diagram of the GitHub repository danielxjones/ccps-ltd, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/danielxjones/ccps-ltd
- Repository: https://github.com/danielxjones/ccps-ltd

## Overview

Check-In App is a private, mobile-first wellbeing service: a user registers or signs in, submits a three-state check-in, and shares it with explicitly connected people; the app also supports communities, alerts, and subscriptions. The React client reaches the Express REST API through its query client; routes own domain operations, storage persists them in PostgreSQL, and notification scheduling handles reminders and missed check-ins. The README documents additional admin, organisation, privacy, and billing capabilities. Unsampled screens and route internals are represented at their exact paths; links are limited to relationships visible in excerpts or README statements.

Main entry points: [`server/routes.ts`](https://github.com/danielxjones/ccps-ltd/blob/master/server/routes.ts) (Express API), [`client/src/App.tsx`](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/App.tsx) (React app and routes), [`server/notifications.ts`](https://github.com/danielxjones/ccps-ltd/blob/master/server/notifications.ts) (Alert delivery rules), [`server/storage.ts`](https://github.com/danielxjones/ccps-ltd/blob/master/server/storage.ts) (Domain data access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_clientapp["React app and routes<br/>[App.tsx]"]
  node_apiclient["API query client<br/>[queryClient.ts]"]
  node_authclient["Auth and account state<br/>[auth-context.tsx]"]
  node_checkinui["Check-in screens<br/>[check-in.tsx]"]
  node_connections["Connections and communities<br/>[communities.tsx]"]
  node_adminui["Admin console<br/>[admin.tsx]"]
  node_billingui["Plans and purchase UI<br/>[choose-plan.tsx]"]
end

subgraph group_api["API and domain"]
  node_api["Express API<br/>[routes.ts]"]
  node_auth["Token authentication<br/>[auth.ts]"]
  node_export["Admin data export<br/>[export.ts]"]
end

subgraph group_ops["Notifications and billing"]
  node_scheduler["Reminder scheduler<br/>[scheduler.ts]"]
  node_notifications["Alert delivery rules<br/>[notifications.ts]"]
  node_sms["SMS provider adapter<br/>[sms.ts]"]
  node_time["UK time handling<br/>[time.ts]"]
  node_revenuecat["RevenueCat purchases<br/>[revenuecat.ts]"]
  node_stripe["Legacy Stripe billing<br/>[stripe.ts]"]
end

subgraph group_data["Persistence and contracts"]
  node_storage["Domain data access<br/>[storage.ts]"]
  node_schema["Shared schema<br/>[schema.ts]"]
  node_database[("PostgreSQL")]
end

subgraph group_mobile["Native apps"]
  node_native["Capacitor native shell<br/>[capacitor.ts]"]
  node_ios["iOS host<br/>[AppDelegate.swift]"]
  node_android["Android host<br/>[MainActivity.java]"]
end

node_user(("User"))
node_smsservice{{"The SMS Works"}}
node_rcservice{{"RevenueCat service"}}
node_stripeext{{"Stripe service"}}

node_user -->|"uses"| node_clientapp
node_clientapp -->|"gates routes"| node_authclient
node_clientapp -->|"provides query client"| node_apiclient
node_clientapp -.->|"routes to"| node_checkinui
node_clientapp -.->|"routes to"| node_connections
node_clientapp -.->|"routes to"| node_adminui
node_clientapp -.->|"routes to"| node_billingui
node_apiclient -->|"HTTP JSON"| node_api
node_authclient -->|"uses"| node_apiclient
node_api -->|"auth middleware"| node_auth
node_api -->|"reads and writes"| node_storage
node_storage -->|"queries"| node_database
node_storage -->|"uses tables"| node_schema
node_api -->|"validates domain data"| node_schema
node_api -->|"triggers alerts"| node_notifications
node_api -->|"sends SMS"| node_sms
node_notifications -->|"reads and records"| node_storage
node_notifications -->|"delivers messages"| node_sms
node_notifications -->|"resolves UK dates"| node_time
node_sms -->|"sends messages"| node_smsservice
node_scheduler -->|"runs reminders"| node_notifications
node_scheduler -->|"checks jobs"| node_storage
node_scheduler -->|"checks local time"| node_time
node_api -->|"starts or triggers"| node_scheduler
node_api -->|"builds CSV export"| node_export
node_api -.->|"handles purchases"| node_revenuecat
node_revenuecat -->|"purchase integration"| node_rcservice
node_api -.->|"legacy billing"| node_stripe
node_stripe -->|"checkout integration"| node_stripeext
node_clientapp -->|"initializes"| node_native
node_ios -->|"hosts bundle"| node_native
node_android -->|"hosts bundle"| node_native

click node_clientapp "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/App.tsx"
click node_apiclient "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/queryClient.ts"
click node_authclient "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/auth-context.tsx"
click node_checkinui "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/check-in.tsx"
click node_connections "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/communities.tsx"
click node_adminui "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/admin.tsx"
click node_billingui "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/choose-plan.tsx"
click node_api "https://github.com/danielxjones/ccps-ltd/blob/master/server/routes.ts"
click node_auth "https://github.com/danielxjones/ccps-ltd/blob/master/server/auth.ts"
click node_storage "https://github.com/danielxjones/ccps-ltd/blob/master/server/storage.ts"
click node_schema "https://github.com/danielxjones/ccps-ltd/blob/master/shared/schema.ts"
click node_scheduler "https://github.com/danielxjones/ccps-ltd/blob/master/server/scheduler.ts"
click node_notifications "https://github.com/danielxjones/ccps-ltd/blob/master/server/notifications.ts"
click node_sms "https://github.com/danielxjones/ccps-ltd/blob/master/server/sms.ts"
click node_time "https://github.com/danielxjones/ccps-ltd/blob/master/server/time.ts"
click node_revenuecat "https://github.com/danielxjones/ccps-ltd/blob/master/server/revenuecat.ts"
click node_stripe "https://github.com/danielxjones/ccps-ltd/blob/master/server/stripe.ts"
click node_export "https://github.com/danielxjones/ccps-ltd/blob/master/server/export.ts"
click node_native "https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/capacitor.ts"
click node_ios "https://github.com/danielxjones/ccps-ltd/blob/master/ios/App/App/AppDelegate.swift"
click node_android "https://github.com/danielxjones/ccps-ltd/blob/master/android/app/src/main/java/com/ccwellbeing/app/MainActivity.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_clientapp,node_apiclient,node_authclient,node_checkinui,node_connections,node_adminui,node_billingui,node_user toneBlue
class node_api,node_auth,node_export toneAmber
class node_scheduler,node_notifications,node_sms,node_time,node_revenuecat,node_stripe toneMint
class node_storage,node_schema,node_database toneRose
class node_native,node_ios,node_android,node_smsservice,node_rcservice,node_stripeext toneIndigo
```

## Components

### Client experience

- [React app and routes](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/App.tsx): `client/src/App.tsx`
- [API query client](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/queryClient.ts): `client/src/lib/queryClient.ts`
- [Auth and account state](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/auth-context.tsx): `client/src/lib/auth-context.tsx`
- [Check-in screens](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/check-in.tsx): `client/src/pages/check-in.tsx`
- [Connections and communities](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/communities.tsx): `client/src/pages/communities.tsx`
- [Admin console](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/admin.tsx): `client/src/pages/admin.tsx`
- [Plans and purchase UI](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/pages/choose-plan.tsx): `client/src/pages/choose-plan.tsx`

### API and domain

- [Express API](https://github.com/danielxjones/ccps-ltd/blob/master/server/routes.ts): `server/routes.ts`
- [Token authentication](https://github.com/danielxjones/ccps-ltd/blob/master/server/auth.ts): `server/auth.ts`
- [Admin data export](https://github.com/danielxjones/ccps-ltd/blob/master/server/export.ts): `server/export.ts`

### Notifications and billing

- [Reminder scheduler](https://github.com/danielxjones/ccps-ltd/blob/master/server/scheduler.ts): `server/scheduler.ts`
- [Alert delivery rules](https://github.com/danielxjones/ccps-ltd/blob/master/server/notifications.ts): `server/notifications.ts`
- [SMS provider adapter](https://github.com/danielxjones/ccps-ltd/blob/master/server/sms.ts): `server/sms.ts`
- [UK time handling](https://github.com/danielxjones/ccps-ltd/blob/master/server/time.ts): `server/time.ts`
- [RevenueCat purchases](https://github.com/danielxjones/ccps-ltd/blob/master/server/revenuecat.ts): `server/revenuecat.ts`
- [Legacy Stripe billing](https://github.com/danielxjones/ccps-ltd/blob/master/server/stripe.ts): `server/stripe.ts`

### Persistence and contracts

- [Domain data access](https://github.com/danielxjones/ccps-ltd/blob/master/server/storage.ts): `server/storage.ts`
- [Shared schema](https://github.com/danielxjones/ccps-ltd/blob/master/shared/schema.ts): `shared/schema.ts`
- **PostgreSQL**

### Native apps

- [Capacitor native shell](https://github.com/danielxjones/ccps-ltd/blob/master/client/src/lib/capacitor.ts): `client/src/lib/capacitor.ts`
- [iOS host](https://github.com/danielxjones/ccps-ltd/blob/master/ios/App/App/AppDelegate.swift): `ios/App/App/AppDelegate.swift`
- [Android host](https://github.com/danielxjones/ccps-ltd/blob/master/android/app/src/main/java/com/ccwellbeing/app/MainActivity.java): `android/app/src/main/java/com/ccwellbeing/app/MainActivity.java`

### Other components

- **User**
- **The SMS Works**
- **RevenueCat service**
- **Stripe service**

## Connections

- User → React app and routes: uses (evidence: `README.md`)
- React app and routes → Auth and account state: gates routes (evidence: `client/src/App.tsx`)
- React app and routes → API query client: provides query client (evidence: `client/src/App.tsx`)
- React app and routes → Check-in screens: routes to
- React app and routes → Connections and communities: routes to
- React app and routes → Admin console: routes to
- React app and routes → Plans and purchase UI: routes to
- API query client → Express API: HTTP JSON (evidence: `README.md`)
- Auth and account state → API query client: uses (evidence: `client/src/lib/auth-context.tsx`)
- Express API → Token authentication: auth middleware (evidence: `server/index.ts`)
- Express API → Domain data access: reads and writes (evidence: `server/routes.ts`)
- Domain data access → PostgreSQL: queries
- Domain data access → Shared schema: uses tables
- Express API → Shared schema: validates domain data (evidence: `README.md`)
- Express API → Alert delivery rules: triggers alerts (evidence: `server/routes.ts`)
- Express API → SMS provider adapter: sends SMS (evidence: `server/routes.ts`)
- Alert delivery rules → Domain data access: reads and records (evidence: `server/notifications.ts`)
- Alert delivery rules → SMS provider adapter: delivers messages (evidence: `server/notifications.ts`)
- Alert delivery rules → UK time handling: resolves UK dates (evidence: `server/notifications.ts`)
- SMS provider adapter → The SMS Works: sends messages (evidence: `README.md`)
- Reminder scheduler → Alert delivery rules: runs reminders (evidence: `server/scheduler.ts`)
- Reminder scheduler → Domain data access: checks jobs (evidence: `server/scheduler.ts`)
- Reminder scheduler → UK time handling: checks local time (evidence: `server/scheduler.ts`)
- Express API → Reminder scheduler: starts or triggers (evidence: `server/index.ts`)
- Express API → Admin data export: builds CSV export (evidence: `server/routes.ts`)
- Express API → RevenueCat purchases: handles purchases (evidence: `server/routes.ts`)
- RevenueCat purchases → RevenueCat service: purchase integration (evidence: `README.md`)
- Express API → Legacy Stripe billing: legacy billing (evidence: `server/routes.ts`)
- Legacy Stripe billing → Stripe service: checkout integration (evidence: `README.md`)
- React app and routes → Capacitor native shell: initializes (evidence: `client/src/main.tsx`)
- iOS host → Capacitor native shell: hosts bundle (evidence: `README.md`)
- Android host → Capacitor native shell: hosts bundle (evidence: `README.md`)
