Skip to content

About

Operations console for demand-responsive transport: live monitoring, trip history, KPIs, fleet, stops, service areas, customer calls, accounts. FastAPI + React/TypeScript, built-in simulator, Docker.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Orrery Console

Operations console for demand-responsive transport (DRT): live monitoring, trip history, KPIs, and management of fleet, drivers, schedules, stops, service areas, rider-app content, customer calls and inquiries, passengers, accounts and scheduled changes.

FastAPI backend, React and TypeScript frontend, and a built-in simulator that stands in for a dispatch system. English and Korean throughout. Packaged with Docker Compose.

Status: version 0.3.0. All 22 pages are built and run on simulated data (Milestones 1 and 2, then a realistic simulation: roads, pooled dispatch, pickup windows and persona-based demand). Milestone 3, integrating a real dispatch system through the provider interface, is not started. See docs/PLAN.md.

Demo data: everything in this repository is synthetic: two fictional demo regions with generated people, vehicles and trips. All names in the demo data are invented.

The console runs on a built-in simulator (the "mock provider"). Two demo regions: Daejeon Demo in Korea and Lumen Valley Demo in California (miles, US dollars, English). In each, seven vehicles of one operator serve the region, riders call, vehicles drive, and 30 days of history are generated on the first start. All 22 pages are built:

Module Pages
Home Live dashboard
Operations Schedule (with schedule upload), Trip history (list and map), Operating rules
Fleet Operators, Vehicles, Drivers
App content Home content (banners, spot bubbles), Popups, Notices, App versions, FAQ
Map Service areas (drawing, GeoJSON import and export), Stops (add, edit, move)
Customer center Calls (register a phone-in call), Inquiries
Accounts Admin accounts (with a permission editor)
Passengers Passengers
Statistics Statistics (KPI cards and charts)
Administration Scheduled changes, Service suspensions

Contents

Run it with Docker

Prerequisite: Docker Desktop (Windows, macOS) or Docker Engine with the Compose plugin (Linux), Compose version 2 or newer (docker compose version). Nothing else is needed: no git, Python or Node. About 2 GB of free disk space; the first start downloads and builds the images (3-6 minutes).

From the release zip

  1. Unpack the zip (for example orrery-console-v0.3.0.zip) into an empty folder.

  2. Open a terminal in the unpacked folder (the one containing docker-compose.yml).

  3. Create the settings file from the example:

    • Windows PowerShell: Copy-Item .env.example .env
    • macOS / Linux: cp .env.example .env
  4. Start everything:

    docker compose up
    
  5. When the log shows orrery: starting the API on port 8000 and the web container has started, open http://localhost:8080 and log in with a demo account.

Stop with Ctrl+C (or docker compose down from another terminal). The data is kept in a Docker volume, so the next docker compose up continues where you left off. To run in the background instead: docker compose up -d, then docker compose logs -f to watch the logs and docker compose down to stop.

A second copy on the same computer (for example a new release next to an old one, or a clone): Compose always names the project orrery-console, so every copy shares the same containers and the same database volume. Unpacking a newer zip and running docker compose up --build therefore upgrades the existing installation and keeps its data. To try a copy with a database of its own, give it another project name, and use the same name to stop and delete it again:

docker compose -p orrery-test up --build
docker compose -p orrery-test down -v

Without -p, docker compose down -v in any copy deletes the shared database.

From a clone of the repository

git clone https://github.com/benTriesCoding/orrery-console.git
cd orrery-console
Copy-Item .env.example .env      # macOS / Linux: cp .env.example .env
docker compose up

docker compose up always rebuilds the images from the current files (quickly, from Docker's cache, when nothing changed), so after git pull the same command runs the new version.

What runs

Container What it does
api The backend (FastAPI) with the simulator. At each start it updates the database (migrations), loads the demo data (only what is missing) and starts the API. Database and uploaded files live in the Docker volume orrery-console_orrery-data.
web nginx with the built web app on http://localhost:8080; it passes /api (including the live WebSocket) and /docs (API documentation) to api. It starts once api reports healthy.

The console is only reachable from the computer it runs on (the demo passwords are public). The API documentation is at http://localhost:8080/docs.

PostgreSQL instead of SQLite

By default the data is in one SQLite file. To use PostgreSQL 16 instead (NFR-PORT-01), add the second Compose file to every command:

docker compose -f docker-compose.yml -f docker-compose.postgres.yml up

This adds a db container (PostgreSQL, its own volume orrery-console_orrery-pgdata, not reachable from outside) and points the API at it. POSTGRES_PASSWORD in .env sets its password (default orrery-demo-db). Stop and reset with the same two -f options.

Demo accounts

One account per role. The passwords are the DEMO_PASSWORD_* values in .env (copied from .env.example).

Username Role Password (default) Sees
demo.admin Administrator demo-admin-2026 Every module and region; edits and exports; may reveal masked phone numbers and e-mails
demo.region Region official demo-region-2026 Every module except Accounts, in its region; views everything, exports Operations, Fleet and Statistics, edits nothing
demo.operator Operator demo-operator-2026 Only its own operator (Hanbit Transit): dashboard, operations, fleet (editable), map, statistics, administration
demo.counselor Counselor demo-counselor-2026 Dashboard, operations, fleet and map (view only), customer center and passengers (editable)

demo.admin can switch between both demo regions in the header; the other three accounts work only in Daejeon Demo. The accounts are created on the first start only. If you change a DEMO_PASSWORD_* value later, reset the database for the new password to apply. New accounts are made on the Accounts page.

Simulated service hours

The demo region's timetable runs 06:00-22:00 Asia/Seoul time (UTC+9). Outside those hours every vehicle is Offline and no new calls arrive, exactly as in a real service. On weekdays six vehicles run (DJ01-DJ06, with staggered lunch and evening breaks); at weekends four. DJ-T is a test vehicle without a schedule and is always Offline. The second demo region, Lumen Valley (choose it in the header's region switcher as demo.admin), runs the same timetable in US Pacific time with LV01-LV06 and the test vehicle LV-T, so one of the two regions is usually in service.

Seoul time UTC Central Europe (CET / CEST) US Pacific (PST / PDT)
06:00-22:00 21:00-13:00 22:00-14:00 / 23:00-15:00 13:00-05:00 / 14:00-06:00

All six vehicles are in service on weekdays from 06:30 to 11:00 and from 14:30 to 17:00 Seoul time.

Demo at any other time: set SIM_ALL_DAY=true in .env and restart (docker compose up -d, or Ctrl+C and docker compose up). Then every scheduled vehicle serves around the clock, every day, without breaks, and calls also arrive at night. The Schedule page still shows the seeded 06:00-22:00 timetable. Set it back to false for the real timetable.

10-minute demo script

Log in as demo.admin. Times and counts vary with the time of day; outside the service hours set SIM_ALL_DAY=true first.

  1. Live dashboard (1:30). Vehicles move along the streets; the legend explains colours and shapes. Untick and tick the layer boxes; with Routes each vehicle's planned route follows the roads to its next stops. Click a moving vehicle: the popover shows its status, driver, riders on board and next stop. In the Real-time panel click Track, then Stop. Click an entry in the Event log to highlight its vehicle and stop.
  2. Language and region (0:40). Switch to 한국어 at the top right: every text changes, dates and numbers too; switch back. In the region switcher choose Lumen Valley Demo: the map moves to California, distances are in miles, times in Pacific time. Switch back to Daejeon Demo.
  3. Register a phone-in call (1:30). Customer center → Calls → Register call. Find a passenger (type DJ0000 and pick one), choose a pickup and a drop-off stop, keep On-demand, click Check wait: it gives the expected wait and the pickup window to offer the rider. Then Register call. The call appears under In progress with its window; on the dashboard its vehicle picks the rider up within it. A reservation at a time without room (for example after 21:00) is refused.
  4. Vehicles and Trip history (1:30). Fleet → Vehicles → Register: a plate such as ABC-123 is refused with the region's format; 00바2001 is accepted. Operations → Trip history: choose DJ01 and 1 week, then Export to Excel. The route icon of a row opens the map replay, which follows the streets the vehicle drove.
  5. Map (1:30). Map → Service areas → Register area: click the map three or more times to draw an outline, give it a name and save. Export GeoJSON downloads the areas. Map → Stops → Add stop: click the map, check the suggested code and save; drag a selected stop to move it.
  6. Suspend a service (1:00). Administration → Service suspensions → Register suspension: Scope Stops, pick two stops, first and last day today, save. On the dashboard those stops turn grey; hovering one names the suspension.
  7. App content (1:00). App content → Notices: open a notice and click Preview to see it as the rider app would. Home content and Popups work the same way and reach the app with Publish.
  8. Statistics (0:30). KPI cards for the last 7 days (hover for the definition) and the charts below them.
  9. Roles (0:50). Log out and log in as demo.operator: fewer sidebar modules, and only Hanbit Transit's data. Log in as demo.region: everything is view only.

Acceptance walk-through

docs/ACCEPTANCE-M2.md walks through every page step by step, with the account to use, what to do and what should happen. It is the Milestone 2 acceptance test.

Settings

All settings are in .env (never committed; .env.example documents each one). After a change, restart with docker compose up -d (or Ctrl+C and docker compose up).

Setting Default Meaning
WEB_PORT 8080 Port of the console on this computer
BRAND_NAME, BRAND_PRIMARY_COLOR, BRAND_LOGO_URL Orrery Console, #0F766E, empty Name, colour and logo in the header, login page and browser tab
DEFAULT_LOCALE en Language before login (en or ko)
MAP_TILE_URL, MAP_ATTRIBUTION OpenStreetMap Map tile source; its host is allowed by the security policy
SIM_ALL_DAY false Vehicles serve around the clock (service hours)
SIM_SPEED 1 Simulated time runs this many times faster (1-60)
SIM_CALLS_PER_DAY 300 Calls riders make on a weekday, the same in every region; Saturdays and Sundays are quieter by each region's seed/<region>/demand.json (at 450 and above waits grow quickly with six vehicles)
SIM_ROADS true Simulate each region on its roads (seed/<region>/roads.json, speeds in road_speeds.json); false keeps straight lines between stops
SIM_BACKFILL_DAYS 30 Days of history generated on the first start
DATABASE_URL SQLite file Database for running without Docker; PostgreSQL works too (postgresql+asyncpg://...)
POSTGRES_PASSWORD orrery-demo-db Only with docker-compose.postgres.yml
DEMO_PASSWORD_* see above Demo account passwords (first start only)
SECRET_KEY demo value Signs sessions; change it (32+ characters) anywhere but your own computer

Reset the database

To start again from fresh demo data (new history, accounts with the current passwords):

docker compose down -v
docker compose up

-v deletes the data volume: every change made in the console and every uploaded file is lost. Without Docker (development), stop the backend and delete the folder backend/data.

Troubleshooting

Symptom Fix
env file ... .env not found Create it: Copy-Item .env.example .env (macOS/Linux cp .env.example .env), in the folder with docker-compose.yml.
Cannot connect to the Docker daemon, error during connect, dockerDesktopLinuxEngine Start Docker Desktop and wait until it says the engine is running.
docker: 'compose' is not a docker command Install Docker Compose v2 (included in Docker Desktop; on Linux the docker-compose-plugin package).
port is already allocated / address already in use Another program uses 8080: set WEB_PORT=8081 in .env and open http://localhost:8081.
The page does not load right after up The first start builds the images and waits until the API is healthy; follow docker compose logs -f. The 30 days of history are generated in the background in about 15-30 seconds.
api is unhealthy or keeps restarting Look at docker compose logs api --tail 50. A settings error names the setting (for example SECRET_KEY shorter than 32 characters).
$'\r': command not found or exec format error in the logs A .sh file was saved with Windows line endings. Restore it from the zip or git checkout -- <file>, or save it with LF endings, then docker compose up.
All vehicles are Offline, no new calls Outside 06:00-22:00 Seoul time: see Simulated service hours (SIM_ALL_DAY=true).
Map without streets (grey background), but vehicles and stops show The map tiles cannot be downloaded (no internet, or a firewall or proxy blocks tile.openstreetmap.org). Everything else works.
"Connection lost" banner on the dashboard The API is restarting or stopped (docker compose ps). The dashboard reconnects by itself within 30 seconds of the API being back.
Login fails with a demo account Use the password from .env. After changing a password there, reset the database. Five wrong passwords lock the account for 15 minutes.
Need the logs for a bug report docker compose logs api --tail 200 > api-log.txt; each error response shows a request ID that also appears in the log.
npm run e2e says Executable doesn't exist Download the test browser once: npx playwright install chromium (from frontend\).
npm run e2e says a port is already used Another run is still going, or something else uses port 8100 or 4174: stop it, or set E2E_API_PORT and E2E_WEB_PORT.

Development

How it was built

Orrery was built in 20 days, from October 8 to October 27, 2026, with Claude Code (LLM-assisted development): 292 commits in 61 pull requests and three tagged milestones (Milestone 1 on October 18, Milestone 2 on October 25, the realistic simulation on October 27).

  • One branch per item, merged into main by pull request once every check below passed.
  • Conventional Commits (feat:, fix:, docs:, test:, chore:).
  • Every choice the requirements left open is a numbered row in docs/DECISIONS.md (197 rows). The plan and its checkpoints are in docs/PLAN.md, and the working agreement for Claude sessions is in CLAUDE.md.
  • Tests: 911 backend test cases (613 test functions in 85 modules, including provider contract tests that any data provider must pass), 414 frontend tests in 88 files (Vitest), and 4 Playwright end-to-end specs. mypy runs in strict mode on the canonical schemas, the providers and the simulator; Ruff, ESLint and Prettier keep the style.
  • Comments and documents cite requirement IDs (FR-..., NFR-...) and section numbers ("requirements 7.1"). They refer to the project's requirements document, which is not part of this repository.

That history is kept in a private repository. This repository starts at version 0.3.0 with a single commit.

Setup

For working on the code (Windows PowerShell; on macOS/Linux use python3.12, source .venv/bin/activate and cp). Requires Python 3.12, Node 24 (or 20.19+/22.13+) and git.

Copy-Item .env.example .env

# Backend (from backend\)
py -3.12 -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt
alembic upgrade head
python -m app.seed
uvicorn app.main:app --reload --port 8000

# Frontend (from frontend\, second terminal)
npm ci
npm run dev                      # http://localhost:5173, proxies /api to port 8000

# Commit hooks (from the repository root, venv active)
pre-commit install

Checks

All must pass before a merge. The first three also run in GitHub Actions on every push and pull request (.github/workflows/ci.yml).

Check Where Command
Lint, format, types backend\ ruff check ., ruff format --check ., mypy --config-file pyproject.toml app simulator
Tests backend\ pytest
Lint, format, types, i18n, tests frontend\ npm run check
End-to-end tests (Playwright) frontend\ npm run e2e (first time: npx playwright install chromium)
Speed, contrast, keyboard, long texts, bundle size frontend\ npm run e2e:checks
List speed with 50,000 rows backend\ python -m app.perf_lists
Stress: 2,000 calls a day, 30 vehicles, live at 60x backend\ python -m app.stress (about 5 minutes)
Every query on PostgreSQL backend\ pytest with TEST_DATABASE_URL set to a PostgreSQL server
All commit hooks, incl. the deny-list root pre-commit run --all-files
Known vulnerabilities backend\ pip-audit -r requirements.txt -r requirements-dev.txt --no-deps --disable-pip
Known vulnerabilities frontend\ npm audit

After a backend schema change: with the backend running, npm run api:generate (from frontend\) regenerates the API types. At each milestone, python -m app.export_openapi (from backend\) writes docs/openapi.json.

Documentation

License

The code is released under the MIT License.

The road networks in seed/*/roads.json are derived from OpenStreetMap data, © OpenStreetMap contributors, and are available under the Open Database License 1.0. See the ROADS-LICENSE.md next to each file.

About

Operations console for demand-responsive transport: live monitoring, trip history, KPIs, fleet, stops, service areas, customer calls, accounts. FastAPI + React/TypeScript, built-in simulator, Docker.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages