Skip to content

Architecture Overview

AB Test Research Designer is a local-first FastAPI and React application for designing, running, reviewing, and exporting A/B-test plans. The backend owns deterministic calculations and persistence; the frontend owns the wizard, dashboard, and review workflows.

Experiment runner

app/backend/app/routes/analysis.py converts project inputs into calculation payloads, experiment reports, LLM-advice requests, sensitivity tables, SRM checks, and observed-result analyses.

Stats engine

app/backend/app/stats/* contains binary, continuous, Bayesian, sequential, SRM, duration, and Student-t routines used by services and tests.

Slack notifier

app/backend/app/routes/slack.py and app/backend/app/slack/* implement install, OAuth callback, slash command, interactivity, and event endpoints.

Postgres schema

ProjectRepository switches from SQLite to Postgres when AB_DATABASE_URL is set, creating project, audit, API-key, webhook, template, Slack, and analysis-history tables.

Dashboard

app/frontend/src contains the wizard, comparison dashboard, results panels, project store, draft store, API client, and locale bundles.

flowchart TD
A[Wizard input] --> B[POST /api/v1/analyze or /api/v1/design]
B --> C[Normalize ExperimentInput]
C --> D[calculate_experiment_metrics]
D --> E[build_experiment_report]
E --> F{Optional advice?}
F -->|local orchestrator| G[LocalOrchestratorAdapter]
F -->|OpenAI header token| H[OpenAIAdapter]
F -->|Anthropic header token| I[AnthropicAdapter]
G --> J[AnalysisResponse]
H --> J
I --> J
E --> K[ProjectRepository save/history/export]
J --> L[Dashboard results panels]
K --> M[Webhook and Slack status surfaces]
StoreDefaultOptional production pathOwned data
Workspace databaseSQLite at app/backend/data/projects.sqlite3Postgres through AB_DATABASE_URLProjects, analysis runs, exports, audit events, templates, API keys, webhooks, Slack installs
Frontend buildapp/frontend/distDocker image or external static hostVite bundle served by FastAPI when AB_SERVE_FRONTEND_DIST=true
Snapshot datasetDisabledHugging Face Dataset via AB_HF_SNAPSHOT_REPO and AB_HF_TOKENPeriodic SQLite backup restore/push loop
Generated docsdocs-site/src/content/docsGitHub Pages artifactSynced markdown, route catalog, experiment catalog, configuration matrix