Skip to Content
suntzu rcdocs
Architecture

System

What runs where, and how the pieces connect. Keep it current: a change to a piece, an integration or an environment updates this file in the same pull request.

Pieces

PieceWhatCodeURL
Site and appNext.js 16: the public pages (home, guides, events, places, community) and the signed-in screens; data only through the APIapps/app/https://www.suntzurc.com
APINestJS: sign-in (Better Auth), the public events API and calendar feeds, search across the site, business rules, dataapps/api/https://api.suntzurc.com
Events engineReads sources (ICS, schema.org JSON-LD, WordPress events API, Wild Apricot RSS, schedule tables) into sightings; pnpm engineapps/api/src/events/engine/runs from the command line
Places censusLoads the FAA registers (recognised areas, fixed sites, airports, airspace) and Census ZIP codes; pnpm censusapps/api/src/places/census/runs from the command line
DatabasePostgreSQL (Amazon RDS): users, events, places, hosts, sources and the evidence behind them; the search index (triggers)packages/db/private network only
ContractsZod schemas shared by API and app; typed client generated from openapi.jsonpackages/shared/, packages/api-client/—
Theme and UIshadcn/ui components and SunTzu RC's brand tokenspackages/ui/—
Docs portalEvery document of the repository as one website with search (Fumadocs, static), generated from docs/ on each buildapps/docs/GitHub Pages

SunTzu RC is an app-platform project (create-itaca@0.5.1): there is no separate Astro site, because its public pages are the product. apps/app has two areas: the public pages in src/app/(site)/ and the members' private area in src/app/(app)/ (/me, /crew, /organise/<club>), never indexed and listed in src/proxy.ts. Both share the same header and footer (see DECISIONS.md, 2026-10-21 and 2026-11-18).

Visitor ──► Cloudflare ──┬─► www: AWS (Next.js, apps/app) ──┐  x-request-id
                         └─► api: AWS (NestJS on Fargate) ◄─┘──► PostgreSQL (RDS)
Visitor's browser ──► api/search (as they type) and api/search/misses (searches that found nothing)
Calendar apps ──► www/events/calendar.ics ──► api/events/calendar.ics
Engine (schedule, 4×/day) ──► organisers' sites (robots.txt, 2 s per site) ──► PostgreSQL, S3
Notify (schedule, hourly) ──► SES ──► members and organisers; deletes old messages and search counts
Census (schedule, monthly) ──► FAA and Census public data ──► PostgreSQL
Census (command) ──► FAA open data (ArcGIS) + Census Bureau Gazetteer ──► PostgreSQL

Every API request gets a trace ID (x-request-id, or Cloudflare's cf-ray), returned in the response and written in one JSON log line together with the bit it belongs to (@Bit() on the route). To follow a bit end to end, search the logs for its name or for one request's ID. Public pages read through getPublicApi(), which sends no trace ID so that its responses stay cacheable; the API still logs each of those requests with its own ID.

Integrations

ServiceWhat forWhere it's configured
CloudflareDNS, TLS, WAF and DDoS protection in front of everythingCLOUDFLARE.md
AWSHosting (Terraform, region us-east-2): Fargate (site, API and scheduled jobs), RDS, S3 (engine snapshots), EventBridge SchedulerDEPLOY.md, infra/
Amazon SESSign-in links, change alerts, weekly digest, club reports, try-it requests (MAIL_TRANSPORT=ses)apps/api/src/mail/, docs/LAUNCH.md
Amazon BedrockClaude reads pasted flyers (BEDROCK_MODEL_ID), with quotes checkedapps/api/src/events/engine/ai.ts
Google (optional)"Continue with Google" (GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET)apps/api/src/auth/auth.ts
Cloudflare TurnstileProves a person sent a public form (TURNSTILE_SECRET_KEY, NEXT_PUBLIC_TURNSTILE_SITE_KEY)apps/api/src/common/turnstile.ts
FAA and US CensusPublic registers for places, airports, airspace and ZIP codes (pnpm census)apps/api/src/places/census/
GitHubCode, pull requests, CI, and the docs portal on GitHub PagesGITHUB.md
OpenFreeMapBase map tiles for the events maps (free, no key)apps/app/src/components/events/
Organisers' websitesWhat the engine reads (each one is a row in sources)pnpm db:seed, sources table
FAA open dataRecognised areas, fixed sites, airports, airspace (public, no key)apps/api/src/places/census/
US Census BureauZIP code centres (Gazetteer ZCTA file, public, no key)apps/api/src/places/census/

Environments

EnvironmentURLDeployed from
Localhttp://localhost:3000 and :3001 (README.md), docs portal :3002pnpm dev
Productionhttps://www.suntzurc.com (not deployed yet)main, see DEPLOY.md

On this page