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.
- An optional Tauri desktop shell for packaged Windows distribution.
The runtime model is local-only and configuration-first:
- Local webapp mode is the default path (
FAIRS/start_on_windows.bat). - Desktop mode uses Tauri, starts a local packaged backend, and serves the SPA through FastAPI.
- Mode switching is done by changing
FAIRS/settings/.envvalues.
Work in Progress: This project is still under active development. It will be updated regularly, but you may encounter bugs, issues, or incomplete features.
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 intoruntimes. - Uses
runtimes/uv.lockas the runtime lock source, syncing through workspaceuv.lockforuv sync. - Installs frontend dependencies (uses
npm ciwhenpackage-lock.jsonis present). - Builds the frontend and launches backend + frontend.
- Activate desktop profile:
copy /Y FAIRS\settings\.env.local.tauri.example FAIRS\settings\.env-
Ensure Rust is installed and a default toolchain is configured (
rustup default stable). -
Ensure portable runtimes exist:
FAIRS\start_on_windows.bat- Regenerate desktop icon assets from the shared web favicon when needed:
cd FAIRS\client
npm run tauri:icon- Build desktop artifacts through the repo packaging entrypoint:
release\tauri\build_with_tauri.batThe helper fails fast if required root runtime files are missing (runtimes/python/python.exe, runtimes/uv/uv.exe, runtimes/nodejs/node.exe, runtimes/nodejs/npm.cmd, runtimes/uv.lock) and prints rustup remediation when Cargo exists without a default toolchain.
Build output:
release/windows/installersrelease/windows/portable
Runtime behavior:
- Tauri starts with
about:blankand shows a startup screen immediately. - Rust resolves the packaged workspace, reuses an existing
runtimes/.venvwhen available, otherwise runsuv sync --frozeninto a controlled runtime root. - Runtime state is kept under
runtimes/.venvandruntimes/.uv-cache. - When desktop
.envis missing/incomplete, packaged backend startup applies safe defaults forDB_EMBEDDED=true,MPLBACKEND=Agg, andKERAS_BACKEND=torch. - The backend is started from the resolved
runtimes/.venv, then the window redirects tohttp://127.0.0.1:<FASTAPI_PORT>/. - FastAPI serves the packaged SPA and exposes API routes under
/api.
Profiles:
- Local reference:
FAIRS/settings/.env.local.example - Desktop reference:
FAIRS/settings/.env.local.tauri.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.local.tauri.example FAIRS\settings\.envNo application code changes are required to switch modes.
FAIRS/settings/.env defines runtime values for launcher/tests/desktop.
FASTAPI_HOSTFASTAPI_PORTUI_HOSTUI_PORTVITE_API_BASE_URLENABLE_API_DOCSRELOAD
DB_EMBEDDEDDB_ENGINEDB_HOSTDB_PORTDB_NAMEDB_USERDB_PASSWORDDB_SSLDB_SSL_CADB_CONNECT_TIMEOUTDB_INSERT_BATCH_SIZE
OPTIONAL_DEPENDENCIESMPLBACKENDKERAS_BACKEND
Behavior:
FAIRS/settings/configurations.jsoncontains non-runtime defaults only.DB_EMBEDDEDis read from env first, with JSON fallback 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:
- 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 options:
- Remove logs.
- Uninstall app (local runtime/dependency artifacts).
- Clean desktop build artifacts (
client/src-tauri/target/releaseandrelease/windows). - Initialize database (
FAIRS/scripts/initialize_database.py).
- Backend runtime lockfile:
runtimes/uv.lock(staged into packageduv.lockduring build). - Backend virtual environment path:
runtimes/.venv. - Backend install path in local and packaged desktop runtime setup:
uv sync --frozen. - Frontend lockfile:
FAIRS/client/package-lock.json. - Frontend install path in local launcher and desktop packaging:
npm ci.
FAIRS/resources contains local data assets:
checkpoints: trained model artifacts.database: embedded SQLite and related files.logs: runtime logs.
runtimes (repo root) contains portable Python/uv/Node.js downloaded by the Windows launcher.
Documentation captures were regenerated from a local backend (http://127.0.0.1:5003) and frontend (http://127.0.0.1:8003) run with adaptive Playwright viewports.
Capture metadata (route, output files, viewport, notes) is available in assets/figures/manifest.json.
This project is licensed under the MIT License. See LICENSE for details.


