Skip to content

Architecture

The repo is one pnpm monorepo with two people at the center: the senior, who uses the phone app, and the Loved One, who curates content for them from a browser. Everything else exists to move content between those two safely.

flowchart LR
  subgraph people [The people]
    mobile["apps/mobile<br>Senior's phone app<br>Expo · React Native"]
    web["apps/web<br>Loved One's web app<br>React · Vite"]
  end

  subgraph cloudflare [Cloudflare]
    worker["apps/api<br>Data-plane API<br>Worker · Hono"]
    d1[("D1 senior-health<br>accounts, memory bank")]
    r2[("R2 senior-health-media<br>uploaded photos")]
    pages["Cloudflare Pages<br>this docs site"]
  end

  subgraph processing [Media processing]
    fastapi["backend/<br>FastAPI<br>Pillow · ffmpeg"]
  end

  deepgram["Deepgram<br>speech to text"]
  shared["packages/shared<br>role codes · API types"]
  docs["docs/ + mkdocs.yml<br>Material for MkDocs"]

  mobile -->|"Stories questions,<br>photo moments"| worker
  web -->|"sign in, author questions,<br>upload photos"| worker
  worker --> d1
  worker --> r2
  mobile -->|"thumbnails, video metadata,<br>voice answers"| fastapi
  fastapi -->|"/transcribe"| deepgram
  docs -->|"strict build on push"| pages
  shared -.->|"types"| worker
  shared -.->|"types"| web

The pieces

Piece What it is
apps/mobile The senior-facing Expo app (SDK 57, React Native 0.86, Expo Router). Routes in app/ are thin re-exports; real code lives in src/, built from the Daybreak tokens and primitives.
apps/web The Loved One web app (React + Vite). Sign in, author quiz questions, and upload photos to the senior's memory bank.
apps/api The data-plane API: a Cloudflare Worker (Hono) in front of D1 for accounts and the memory bank, and R2 for uploaded media.
backend/ A stateless FastAPI service for media processing: Pillow thumbnails, ffmpeg video metadata and thumbnails, and Deepgram transcription for Voice Answers.
packages/shared Role codes, display labels, and API types shared by the web app and the Worker.
docs/ This site, built with Material for MkDocs and published by Cloudflare Pages.

How the phone finds its backends

The mobile app talks to two services, and each has the same two-step URL resolution:

  • FastAPI (src/lib/api.ts): EXPO_PUBLIC_API_URL when set, as in preview and production builds. Otherwise the address is derived from the Expo dev server, so simulators, emulators, and physical devices reach the laptop backend with zero configuration.
  • Worker (src/features/bank/): EXPO_PUBLIC_DATA_API_URL when set, with the same dev-server derivation otherwise.

Stories merges the fetched memory-bank questions and photo moments with the bundled seed content in src/features/stories/use-story-pool.ts, keeping an offline cache in AsyncStorage so a dropped connection never empties the session.

How this site is published

Cloudflare Pages watches the repo and runs the strict MkDocs build on every push to main; the settings it needs are in the repository README. The same strict build runs as a check on every pull request, so a broken link is caught in review rather than in a deploy.