equinor/template-fastapi-react
Acerca de
A solution template for creating a Single Page App (SPA) with React and FastAPI following the principles of Clean Architecture.
Desarrollo web y de aplicacionesWhat you can do
- Clean architecture
- Screaming architecture
- Auto-generated changelogs
- Auto-generated OpenAPI specification
Crecimiento de estrellas medido
- in 24h
- Recopilando historial
- in 7 days
- Recopilando historial
- in 15 days
- Recopilando historial
- in 1 month
- Recopilando historial
Cambios netos en períodos que se solapan, no totales diarios. Los datos no disponibles se dejan en blanco. Las estrellas indican interés, no calidad.
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.
Explorar proyectos relacionados
Cargando…