equinor/template-fastapi-react
À propos
A solution template for creating a Single Page App (SPA) with React and FastAPI following the principles of Clean Architecture.
Développement web et applicatifWhat you can do
- Clean architecture
- Screaming architecture
- Auto-generated changelogs
- Auto-generated OpenAPI specification
Progression mesurée des étoiles
- in 24h
- Historique en cours
- in 7 days
- Historique en cours
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
OriginalTemplate Fastapi React
This is a solution template for creating a Single Page App (SPA) with React and FastAPI following the principles of Clean Architecture.
:dart: Key features
- Clean architecture
- Screaming architecture
- Auto-generated changelogs
- Auto-generated OpenAPI specification
- Automatic documentation of REST API
- Auto-generated REST API clients
- Pre-commit hooks
- Pydantic data validation
:zap: Quickstart
Prerequisites: Docker and Docker Compose.
The service images build FROM dhi.io/... (Docker Hardened Images). These images are free but the dhi.io registry requires authentication, so a one-time docker login is needed before the first build (otherwise the build fails with an opaque unauthorized error):
docker login dhi.io # one-time; free Docker Hub account works
docker compose -f docker-compose.yml -f docker-compose.no-auth.yml up --build
- App: http://localhost
- API docs: http://localhost:5000/docs
This brings up the stack without Entra ID / oauth2-proxy: the SPA loads,
calls the API directly, and sees the built-in nologin user. Useful for
bare-fork local development — no app registrations, no secrets/*.txt, no
.env required.
To run with authentication enabled (the production-equivalent flow), see
Authentication & Azure setup — fill in
.env from .env-template, populate secrets/, then:
cp .env-template .env
docker compose up --build
:lock: Authentication & Azure setup
oauth2-proxy sits in front of the API and forwards a bearer token to FastAPI for JWT validation. Flow: browser → nginx :80 → oauth2-proxy → nginx → api.
Each environment needs two Entra ID app registrations (API + oauth2-proxy), provisioned by IaC/app-registration.bicep. Requires the Application Developer directory role (activate via PIM):
mise run iac:appreg <env> # dev | test | prod
mise run iac:appreg <env> --dry-run # what-if only
mise run iac:appreg <env> --rotate # redeploy + new BFF client secret
Rotate only the oauth2-proxy client secret (needs app-owner only, not Application Developer):
mise run iac:rotate-secret <env>
Azure resources (Postgres, Key Vault, App Insights, alerts) deploy separately:
mise run iac:infra <env>
Before deploying, edit the [env] section in .mise/config.toml and replace every <REPLACE_ME> placeholder:
APPLICATION_NAMEAPP_OWNERS_GROUPSERVICE_MANAGEMENT_REFERENCEAZURE_SUBSCRIPTIONALERT_EMAIL_RECIPIENTS
After deployment, copy the Bicep outputs into your .env:
.env var |
Bicep output |
|---|---|
OAUTH_CLIENT_ID |
oauth2ApplicationId |
OAUTH_AUDIENCE |
apiApplicationId |
OAUTH_AUTH_SCOPE |
apiScope |
Additional secrets are documented in secrets/README.md.
:dizzy: Development
Web development uses Vite+ and pnpm with Node 24.22.2:
mise install
mise run lint:web
mise run test:web
mise run build:web
See web/README.md for dev server, formatting and API generation commands.
See the docs or run locally:
mise run docs:serve
:+1: Contributing
See CONTRIBUTING.md.
Explorer des projets similaires
Chargement…