How osod-b/iam-rest-fastapi works
This is a FastAPI backend for self-managed authentication, client-record CRUD, and manager-only file import/export. The main workflow is an HTTP request entering the app, passing middleware, reaching a controller and service, and then using repositories or Redis as needed; responses return through the controller. Authentication includes registration and email activation, login activation, password recovery, and token refresh. The README also lists view/admin services, but their wiring and behavior are not shown in the sampled source, so those branches are represented cautiously. Repository internals and file-service implementation were not sampled.
Main entry points: main.py FastAPI app · authService.py Auth workflows · logInController.py Auth routes · signUpController.py Registration routes
Components 24
API runtime
- FastAPI app
src/app/main.py - Middleware setup
src/app/middle.py
Authentication
- Auth routes
src/controllers/logInController.py - Registration routes
src/controllers/signUpController.py - Auth workflows
src/services/authService.py - JWT handling
src/services/jwtService.py - Auth helpers
src/utils/authHelpers.py - User schemas
src/schemas/user.py - User validation
src/validators/users.py
Client records
- Client routes
src/controllers/crudController.py - Client workflows
src/services/crudService.py - Client schemas
src/schemas/client.py - Client validation
src/validators/clients.py - View and admin
src/services/viewService.py
File exchange
- File routes
src/controllers/filesController.py - File workflows
src/services/filesService.py - File storage
storage
State and persistence
- User repository
src/utils/repositories.py - User model
src/models/user.py - Client repository
src/utils/repositories.py - Client model
src/models/client.py - Redis sessions
src/app/redis.py - SQL database
src/db/schema.py
Other components
- API caller
Connections 33
- API caller → FastAPI app: sends requests
- FastAPI app → Middleware setup: configures
- FastAPI app → Auth routes: dispatches
- FastAPI app → Registration routes: dispatches
- FastAPI app → Client routes: dispatches
- FastAPI app → File routes: dispatches
- FastAPI app → SQL database: initializes
- Auth routes → Auth workflows: calls
- Registration routes → Auth workflows: calls
- Auth routes → User repository: provides
- Registration routes → User repository: provides
- Auth workflows → User repository: queries and updates
- Auth workflows → Redis sessions: stores session data
- Auth workflows → JWT handling: creates and refreshes tokens
- Auth workflows → Auth helpers: uses
- Auth routes → JWT handling: checks token presence
- Registration routes → JWT handling: checks token presence
- User repository → User model: builds records
- Auth routes → User schemas: accepts login input
- Registration routes → User schemas: accepts registration input
- Auth workflows → User validation: uses validators
- Client routes → Client workflows: calls
- Client routes → Client repository: provides
- Client workflows → Client repository: reads and writes
- Client repository → Client model: builds records
- Client routes → JWT handling: checks tokens
- Client routes → Client schemas: accepts client input
- Client workflows → Client validation: uses UUID validator
- File routes → File workflows: calls
- File routes → Client repository: provides export repository
- File routes → JWT handling: checks tokens
- File workflows → File storage: imports and exports
- FastAPI app → View and admin: available service