How wongywrongy/shuttleworks works
Purpose and deployable entry points
ShuttleWorks manages inter-school meets and bracket tournaments: configuration and entries, CP-SAT scheduling, live match operations, and public displays. Deployable applications are:
• FastAPI backend: apps/api/src/core/main.py
• Operator React SPA: apps/console/src/main.tsx, apps/console/src/app/App.tsx
• Public entrant SSR application under /e/: apps/entrant/app/entry.server.tsx, apps/entrant/app/routes.ts
• Worker/process entry points: apps/api/src/worker.py, apps/api/src/shuttleworks/worker/main.py
Local deployment uses Docker Compose with SQLite; cloud mode uses Postgres and standalone workers. Compose variants live in infra/compose/docker-compose.yml and infra/compose/docker-compose.cloud.yml.
Workspace control plane and UI products
A workspace is the tenancy and event-control boundary. It enables Meet, Bracket, Display, and Entries; Operations is always present. The console shell routes users into module surfaces and guards access:
• Shell/navigation: apps/console/src/app/AppShell.tsx, apps/console/src/platform/product-shell/WorkspaceShell.tsx
• Module dispatch: apps/console/src/app/workspace/ModuleOutlet.tsx
• Workspace/module backend services: apps/api/src/workspaces/setup.py, apps/api/src/workspaces/workspace_modules.py, apps/api/src/workspaces/tournaments.py
The console’s API clients, hooks, and Zustand stores mediate backend state, polling, optimistic UI, and client command queues: apps/console/src/api/client.ts, apps/console/src/store/tournamentStore.ts, apps/console/src/hooks/useCommandQueue.ts.
Scheduling engine and solve rail
scheduler-core is a pure-Python scheduling boundary: domain dataclasses and CP-SAT construction contain no HTTP or persistence concerns. It models court capacity, availability, rest, locks, freeze horizons, and optimization objectives:
• Engine boundary: packages/scheduler-core/scheduler_core/engine/bridge.py, packages/scheduler-core/scheduler_core/engine/cpsat_backend.py
• Constraints: packages/scheduler-core/scheduler_core/engine/constraints/
• Repair/live scheduling: packages/scheduler-core/scheduler_core/engine/repair.py, packages/scheduler-core/scheduler_core/engine/live_ops.py
The API adapts persisted tournament state to the engine, puts work on a DB-backed solve-job rail, and exposes proposals/suggestions and solver progress. Workers isolate solve execution from request handling: apps/api/src/solve_rail/solve_jobs.py, apps/api/src/solve_rail/solve_worker.py, apps/api/src/meet/schedule_proposals.py.
Meet, bracket, and operations flow
Meet produces schedules from rosters, venue configuration, constraints, and repair actions. Bracket produces draws/matches, advances results, and can schedule rounds through the same solver:
• Meet application/schedule layer: apps/api/src/meet/schedule_application.py, apps/api/src/meet/schedule_director.py
• Bracket domain and formats: apps/api/src/bracket/application.py, apps/api/src/bracket/formats/, apps/api/src/bracket/advancement.py
• Unified day-of operations: apps/api/src/operations/commands.py, apps/api/src/operations/match_state_application.py
Operations is the mutation boundary: browser actions become idempotent commands, update the match-state machine and authoritative persistence, then polling clients refresh projections. Bracket results use a parallel command route. Console surfaces are apps/console/src/modules/operations/OperationsProduct.tsx, apps/console/src/modules/meet/MeetProduct.tsx, and apps/console/src/modules/bracket/BracketProduct.tsx.
Persistence, authority, and synchronization
SQLAlchemy models and Alembic migrations support SQLite locally and Postgres in cloud mode:
• Persistence: apps/api/src/db/models.py, apps/api/src/db/session.py
• Schema evolution: apps/api/src/alembic/versions/
• Repository abstraction: apps/api/src/repositories/base.py, apps/api/src/repositories/local.py
Local event-node mode keeps SQLite as authoritative and avoids network writes. Cloud/event-node composition and sync are explicit boundaries, with compatibility and quarantine handling: apps/api/src/core/composition/cloud.py, apps/api/src/core/composition/event_node.py, apps/api/src/sync/service.py.
Public, identity, and operational boundaries
The entrant frontend is independently SSR-rendered and communicates same-origin with backend entry, account, and submission APIs; it shares only the design system with the console:
• Entrant routes: apps/entrant/app/routes/enter.tsx, apps/entrant/app/routes/tournament.tsx
• Entry lifecycle: apps/api/src/entries/lifecycle.py, apps/api/src/entries/submissions.py
• Identity/session/invites: apps/api/src/identity/auth.py, apps/api/src/identity/invites.py
Public displays are read-only capability-token projections, separate from authenticated operator access: apps/api/src/display/display.py, apps/console/src/modules/display/DisplayProduct.tsx. Security controls include cookie sessions, CSRF, throttling, Turnstile integration, and telemetry: apps/api/src/core/form_csrf.py, apps/api/src/core/throttle.py, apps/api/src/core/telemetry/bootstrap.py.
Main entry points: main.py FastAPI Backend · commands.py Match Operations · application.py Bracket Domain · solve_jobs.py Solve Job Rail
Components 18
Client products
- Operator Console · Authenticated workspace control and live operations UI.
apps/console/src/main.tsx - Workspace Shell · Guards access and dispatches enabled workspace modules.
apps/console/src/app/AppShell.tsx - Entrant App · Public entrant account, entry, and submission experience.
apps/entrant/app/entry.server.tsx - Public Displays · Capability-token display views separate from operator access.
apps/console/src/modules/display/DisplayProduct.tsx
Backend control plane
- FastAPI Backend · Primary request boundary for workspace, public, and operational APIs.
apps/api/src/core/main.py - Workspace Control · Tenancy boundary that enables Meet, Bracket, Entries, and Display modules.
apps/api/src/workspaces/workspace_modules.py - Identity & Invites · Cookie sessions, authentication, and invitations.
apps/api/src/identity/auth.py - Entry Lifecycle · Manages entrant submissions and entry state.
apps/api/src/entries/lifecycle.py - Meet Scheduling · Builds schedule requests and manages proposals.
apps/api/src/meet/schedule_application.py - Bracket Domain · Creates draws, advances results, and schedules rounds.
apps/api/src/bracket/application.py - Match Operations · Idempotent live commands drive the authoritative match-state machine.
apps/api/src/operations/commands.py
Scheduling rail
- Solve Job Rail · Queues solve work and exposes solver progress.
apps/api/src/solve_rail/solve_jobs.py - Solve Worker · Isolates scheduling execution from HTTP handling.
apps/api/src/solve_rail/solve_worker.py - Scheduler Core · Models capacities, availability, rest, locks, freeze horizons, and objectives.
packages/scheduler-core/scheduler_core/engine/cpsat_backend.py
Data and deployment
- Authoritative Store · SQLite locally and Postgres in cloud mode.
apps/api/src/db/models.py - Repository Abstraction · Decouples application services from local persistence implementation.
apps/api/src/repositories/base.py - Cloud/Event-node Sync · Handles cloud composition, compatibility, and quarantine.
apps/api/src/sync/service.py - Deployment Modes · Local SQLite composition and cloud Postgres plus standalone workers.
infra/compose/docker-compose.yml
Connections 21
- Operator Console → Workspace Shell: renders
- Workspace Shell → Workspace Control: workspace modules
- Operator Console → FastAPI Backend: commands, polling
- Entrant App → FastAPI Backend: same-origin APIs
- Public Displays → FastAPI Backend: read-only projections
- FastAPI Backend → Identity & Invites: authenticates
- FastAPI Backend → Entry Lifecycle: entry APIs
- FastAPI Backend → Meet Scheduling: meet APIs
- FastAPI Backend → Bracket Domain: bracket APIs
- FastAPI Backend → Match Operations: live command APIs
- Entry Lifecycle → Repository Abstraction: persists
- Meet Scheduling → Solve Job Rail: submits solves
- Bracket Domain → Solve Job Rail: schedules rounds
- Solve Job Rail → Solve Worker: claims jobs
- Solve Worker → Scheduler Core: executes
- Match Operations → Bracket Domain: advances results
- Match Operations → Repository Abstraction: updates match state
- Repository Abstraction → Authoritative Store: reads and writes
- Cloud/Event-node Sync → Authoritative Store: synchronizes authority
- Deployment Modes → FastAPI Backend: runs API
- Deployment Modes → Solve Worker: runs standalone workers