This document describes the intended layout of the repo and how to set up the Cloudflare services used by the project.
/db-home-planner
/apps
/web # Angular app (Cloudflare Pages)
/workers
/api # Cloudflare Worker (TypeScript) API
/packages
/shared # Shared types, utilities, and models
/docs
STRUCTURE.md
TODOS.md
README.md
- Sign up at https://dash.cloudflare.com
- Verify your email.
npm install -g wrangler
wrangler login
- Create a new Pages project.
- Connect this GitHub repo.
- Set build settings (once Angular app exists):
- Build command:
npm run build - Build output:
dist/<app-name>
- Build command:
- Configure environment variables for API base URL.
- Initialize worker in
workers/api:wrangler init workers/api --type=typescript
- Create a Worker service in the Cloudflare dashboard or via Wrangler.
- Configure environment variables:
- No external credentials needed for VRR EFA endpoints.
- Store any future API keys here if we add authenticated services.
Decide based on access patterns:
- D1 for relational config data (stations, trains, travel profiles).
- KV for quick lookups or cached responses.
Recommended initial setup: D1 for configuration + KV for cached departure data.
wrangler d1 create db-home-planner
- Save the database ID into
wrangler.tomlonce created.
wrangler kv:namespace create DB_HOME_PLANNER_CACHE
- Add the KV namespace ID to
wrangler.toml.
Plan for separate dev/prod settings:
- Use
.dev.varsfor local secrets. - Use
wrangler secret putfor production secrets.
- Start Workers locally:
wrangler dev
- Start Angular dev server once scaffolded.
- Build the Dortmund GTFS index with
workers/api/scripts/build_vrr_dortmund_index.py. - Use VRR EFA
XML_DM_REQUESTfor realtime departures.
- Push to main branch.
- Cloudflare Pages builds & deploys the Angular app.
- Workers deploy via
wrangler deployor CI pipeline.