Skip to content
프로젝트

equinor/template-fastapi-react

GitHub에서 보기

소개

A solution template for creating a Single Page App (SPA) with React and FastAPI following the principles of Clean Architecture.

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

  • Clean architecture
  • Screaming architecture
  • Auto-generated changelogs
  • Auto-generated OpenAPI specification

측정된 스타 증가

in 24h
기록 수집 중
in 7 days
기록 수집 중
in 15 days
기록 수집 중
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Template Fastapi React

License On push main branch

This is a solution template for creating a Single Page App (SPA) with React and FastAPI following the principles of Clean Architecture.

Key Features • Quickstart • Development • Contributing

: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

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_NAME
  • APP_OWNERS_GROUP
  • SERVICE_MANAGEMENT_REFERENCE
  • AZURE_SUBSCRIPTION
  • ALERT_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.

관련 프로젝트 살펴보기

불러오는 중…