How ivan-borovets/fastapi-clean-example works
This is a FastAPI user and account management service with role-based administration and cookie-backed authentication. The principal flow enters through HTTP account or user routes, delegates into authentication handlers or core user operations, and uses outbound adapters for sessions and persistence. The graph preserves distinct account, user-command/query, authorization, and session stages. The README is currently sparse, so some feature coverage comes from the source tree and SOURCE INDEX; unsampled implementation links are omitted where caller evidence is unavailable.
Main entry points: handlers Sign-up and session handlers · outbound.py Application wiring · root_router.py Root router · api_v1_router.py API v1 router
Components 20
HTTP interface
- Root router
src/app/inbound/http/root_router.py - API v1 router
src/app/inbound/http/api_v1_router.py - Account routes
src/app/inbound/http/account/router.py - User routes
src/app/inbound/http/users/router.py - Health routes
src/app/inbound/http/health/router.py - User endpoints
src/app/inbound/http/users
Core user domain
- User commands
src/app/core/commands - User listing query
src/app/core/queries/list_users.py - User domain services
src/app/core/common/services/user.py - User entity and types
src/app/core/common/entities/user.py - Current-user authorization
src/app/core/common/authorization/current_user_service.py
Authentication
- Sign-up and session handlers
src/app/outbound/auth_ctx/handlers - Session service
src/app/outbound/auth_ctx/service.py - JWT processing
src/app/outbound/auth_ctx/jwt_processor.py
Persistence and adapters
- SQLAlchemy adapters
src/app/outbound/adapters - Session persistence
src/app/outbound/auth_ctx/sqla_tx_storage.py - Authentication user storage
src/app/outbound/auth_ctx/sqla_user_tx_storage.py - Application wiring
src/app/main/ioc/outbound.py
Other components
- API client
- SQL database
Connections 21
- API client → Root router: sends requests
- Root router → API v1 router: mounts
src/app/inbound/http/root_router.py - Root router → Health routes: mounts
src/app/inbound/http/root_router.py - API v1 router → Account routes: mounts
src/app/inbound/http/api_v1_router.py - API v1 router → User routes: mounts
src/app/inbound/http/api_v1_router.py - Account routes → Sign-up and session handlers: routes account actions
src/app/inbound/http/account/router.py - User routes → User endpoints: mounts endpoints
src/app/inbound/http/users/router.py - Sign-up and session handlers → User domain services: uses user services
src/app/outbound/auth_ctx/handlers/sign_up.py - Sign-up and session handlers → Current-user authorization: checks current user
src/app/outbound/auth_ctx/handlers/sign_up.py - Sign-up and session handlers → Authentication user storage: uses user storage
src/app/outbound/auth_ctx/handlers/sign_up.py - User domain services → User entity and types: builds users
src/app/core/common/services/user.py - Current-user authorization → User entity and types: returns user
src/app/core/common/authorization/current_user_service.py - Current-user authorization → SQLAlchemy adapters: revokes access
- Session service → JWT processing: processes tokens
src/app/outbound/auth_ctx/service.py - Session service → Session persistence: uses session storage
src/app/outbound/auth_ctx/service.py - Session persistence → SQL database: reads and writes
src/app/outbound/auth_ctx/sqla_tx_storage.py - Authentication user storage → SQL database: reads and writes
src/app/outbound/auth_ctx/sqla_user_tx_storage.py - SQLAlchemy adapters → SQL database: persists domain data
- Application wiring → Session service: configures
src/app/main/ioc/outbound.py - Application wiring → Session persistence: configures
src/app/main/ioc/outbound.py - Application wiring → Authentication user storage: configures
src/app/main/ioc/outbound.py