FAIRS is a research web application for roulette training and inference experiments. It combines:
- A FastAPI backend for dataset ingestion, training orchestration, checkpoint management, inference sessions, and persistence.
- A React + Vite frontend for training workflows, checkpoint management, and interactive inference sessions.
The runtime model is dual-mode and configuration-first:
- Local mode is the default path (
FAIRS/start_on_windows.bat), no Docker required. - Cloud mode uses Docker (
docker-compose.yml) for backend + frontend. - Mode switching is done by changing
FAIRS/settings/.envvalues only.
FAIRS uses a Deep Q-Network (DQN) workflow for roulette sequence decision making. Training can use:
- User-provided CSV/XLSX datasets uploaded from the UI.
- Synthetic sequences generated by the app.
Inference sessions consume a trained checkpoint and a selected dataset, then evaluate predictions step by step with tracked capital and reward outcomes.
Run:
FAIRS\start_on_windows.batThe launcher automatically:
- Downloads portable Python,
uv, and Node.js intoFAIRS/resources/runtimes. - Installs backend dependencies from
pyproject.toml/uv.lock. - Installs frontend dependencies (uses
npm ciwhenpackage-lock.jsonis present). - Builds the frontend and launches backend + frontend.
- Switch
.envto cloud values (see section 4). - Build and run:
docker compose --env-file FAIRS/settings/.env build --no-cache
docker compose --env-file FAIRS/settings/.env up -dStop containers:
docker compose --env-file FAIRS/settings/.env downCloud topology:
backend: FastAPI (Uvicorn) on container port8000.frontend: Nginx serving SPA static files.- Nginx proxies
/api/*tohttp://backend:8000/*.
Validate:
- Frontend:
http://<UI_HOST>:<UI_PORT>/ - API docs through proxy:
http://<UI_HOST>:<UI_PORT>/api/docs
Profiles:
- Local reference:
FAIRS/settings/.env.local.example - Cloud reference:
FAIRS/settings/.env.cloud.example - Active runtime file:
FAIRS/settings/.env
Use one of the profiles as active .env:
copy /Y FAIRS\settings\.env.local.example FAIRS\settings\.env
copy /Y FAIRS\settings\.env.cloud.example FAIRS\settings\.envNo application code changes are required to switch modes.
FAIRS/settings/.env defines runtime values for launcher/tests/docker.
FASTAPI_HOSTFASTAPI_PORTUI_HOSTUI_PORTVITE_API_BASE_URLRELOAD
DB_EMBEDDEDDB_ENGINEDB_HOSTDB_PORTDB_NAMEDB_USERDB_PASSWORDDB_SSLDB_SSL_CADB_CONNECT_TIMEOUTDB_INSERT_BATCH_SIZE
OPTIONAL_DEPENDENCIESMPLBACKENDKERAS_BACKEND
Behavior:
FAIRS/settings/configurations.jsonnow contains non-runtime defaults only.DB_EMBEDDEDis read from env first, with JSON fallback only for backward compatibility.- When
DB_EMBEDDED=true, embedded SQLite is used. - When
DB_EMBEDDED=false, external DB fields are read from env first.
Run automated tests:
tests\run_tests.batThe runner now:
- Loads host/port from
FAIRS/settings/.env. - Exports
APP_TEST_FRONTEND_URLandAPP_TEST_BACKEND_URL. - Uses resolved URLs for readiness checks and server startup.
FAIRS/setup_and_maintenance.bat->Remove logs: deletes.logfiles inFAIRS/resources/logs.FAIRS/setup_and_maintenance.bat->Uninstall app: removes local runtime/dependency artifacts (resources/runtimes,.venv, frontend build and node modules, cache files).FAIRS/setup_and_maintenance.bat->Initialize database: runsFAIRS/scripts/initialize_database.py.
- Backend lockfile:
uv.lock. - Backend install path in Docker:
uv sync --frozen. - Frontend lockfile:
FAIRS/client/package-lock.json(committed). - Frontend install path in Docker:
npm ci. - Docker base images are pinned by tag in
docker/backend.Dockerfileanddocker/frontend.Dockerfile.
FAIRS/resources contains local runtime and data assets:
checkpoints: trained model artifacts.database: embedded SQLite and related files.logs: runtime logs.runtimes: portable Python/uv/Node.js downloaded by the Windows launcher.templates: starter files.
docs/PACKAGING_AND_RUNTIME_MODES.md.agent/rules/ARCHITECTURE.md.agent/rules/GUIDELINES_TESTS.md
This project is licensed under the MIT License. See LICENSE for details.

