3.9 KiB
3.9 KiB
WalkUp
WalkUp is a collaborative baseball walk-up song app built as a React PWA with a FastAPI backend. The browser integrates with TeamSnap through the official JavaScript SDK, while the backend keeps TeamSnap secrets and only stores app-owned media and game state.
Stack
- Frontend: React, TypeScript, Vite, React Router, TanStack Query,
teamsnap.js,vite-plugin-pwa - Backend: FastAPI, SQLAlchemy, Pydantic Settings, HTTPX
- Infra: Docker Compose, Postgres, named Docker volume for backend media
Repository Layout
frontend/: React PWAbackend/: FastAPI API and storage logicPLAN.md: current implementation scope snapshot
Local Development
- Copy
.env.exampleto.env. - Create and activate the host virtualenv if needed:
python3 -m venv .venv && source .venv/bin/activate - Install backend dependencies:
pip install -r requirements.txt - Create
secrets/teamsnap_client_id.txtandsecrets/teamsnap_client_secret.txt. - Put the raw TeamSnap client ID and client secret values into those files.
- Generate the local TLS certificate and key:
./scripts/create-dev-certs.sh - Start the stack and capture logs:
./scripts/dev-up.sh - Open
https://kif.local.ascorrea.com.
Dev Logs
./scripts/dev-up.shstarts the stack with thedevprofile and appends compose output tologs/docker-compose.log../scripts/dev-logs.shcaptures current service logs tologs/docker-services.log.- Use those files when you want me to inspect startup failures or runtime errors from the Docker stack.
Production
- Copy
compose.traefik.yml.sampletocompose.traefik.ymland adjust it for your deployment. - The sample routes
backendandfrontendthrough Traefik, builds the frontend as a static Nginx image, and keeps the published ports off the host. ./scripts/prod-up.shstartsdb,backend, andfrontendin detached mode with that Traefik override.- Use
docker compose logs db backend frontendwhen you need live service output from that detached stack.
TeamSnap Secrets
- TeamSnap credentials are expected through Docker secrets, not plain environment variables.
- The backend reads
/run/secrets/teamsnap_client_idand/run/secrets/teamsnap_client_secretby default. .envkeeps only the secret file paths, not the credential values.- Direct env var fallback still exists in code for non-Docker debugging, but the intended runtime path is Docker secrets.
Local HTTPS Proxy
- Local development uses a Caddy reverse proxy at
https://kif.local.ascorrea.com. - TeamSnap callback should be registered as
https://kif.local.ascorrea.com/api/auth/teamsnap/callback. - The proxy forwards
/api/*to FastAPI and all other routes to the Vite frontend. - The proxy binds host ports
80and443by default. - If those ports are already in use, set
PROXY_HTTP_PORTandPROXY_HTTPS_PORTin.env. - The backend session cookie is secure-capable so the local flow matches production proxy behavior.
- The hostname is configurable through
APP_HOST, but the default iskif.local.ascorrea.com. - Generate the local cert/key with
./scripts/create-dev-certs.sh, which usesmkcertand the currentAPP_HOST, or create them manually and place the outputs in:secrets/dev-proxy-cert.pemsecrets/dev-proxy-key.pem
- Make sure
kif.local.ascorrea.comresolves to your Docker host on your LAN before testing from other devices.
Backend Responsibilities
- TeamSnap OAuth start/callback/refresh
- Session cookie management
- Media upload and normalized clip registration
- Game assignments and gameday APIs
Frontend Responsibilities
- TeamSnap SDK bootstrap with server-issued access tokens
- Team/game browsing from TeamSnap with cached-first revalidation
- Song upload and clip creation
- Game assignments and gameday console
- PWA install/offline shell
- Read-only offline clip cache with HTTP revalidation and cached normalized playback media