How emilianox-creator/fastapi-project works
P3 is a FastAPI REST API for account registration and login, authenticated personal todo management, profile updates, and admin-wide todo operations. The main workflow is a client request routed by the application to an API handler; protected handlers validate the JWT and use a database session to read or change the caller’s data. Registration and login are separate identity stages, while todo, profile, and admin operations are distinct domain branches. The README documents PostgreSQL persistence, Alembic migrations, and automatic API docs; migration and docs wiring is not shown in sampled runtime source.
Main entry points: main.py FastAPI app · db.py SQLAlchemy sessions · todos.py User and todo models · auth.py JWT validation
Components 14
API entry
- FastAPI app
src/p3/main.py - OpenAPI docs
src/p3/main.py
Identity and access
- User registration
src/p3/routers/auth.py - Token login
src/p3/routers/auth.py - JWT validation
src/p3/routers/auth.py
Todo and account operations
- Personal todo CRUD
src/p3/routers/todos.py - Profile updates
src/p3/routers/users.py - Admin todo controls
src/p3/routers/admin.py
Persistence
- Environment config
src/p3/config.py - User and todo models
src/p3/models/todos.py - SQLAlchemy sessions
src/p3/database/db.py - PostgreSQL
- Schema migrations
alembic
Other components
- API client
Connections 28
- API client → FastAPI app: sends request
README.md - FastAPI app → User registration: routes requests
src/p3/main.py - FastAPI app → Token login: routes requests
src/p3/main.py - FastAPI app → Personal todo CRUD: routes requests
src/p3/main.py - FastAPI app → Profile updates: routes requests
src/p3/main.py - FastAPI app → Admin todo controls: routes requests
src/p3/main.py - FastAPI app → OpenAPI docs: serves docs
README.md - User registration → SQLAlchemy sessions: uses session
src/p3/routers/auth.py - User registration → User and todo models: creates user
src/p3/routers/auth.py - Token login → SQLAlchemy sessions: checks credentials
src/p3/routers/auth.py - Token login → User and todo models: queries user
src/p3/routers/auth.py - Token login → Environment config: loads signing key
src/p3/routers/auth.py - Personal todo CRUD → JWT validation: validates caller
src/p3/routers/todos.py - Personal todo CRUD → SQLAlchemy sessions: reads and writes
src/p3/routers/todos.py - Personal todo CRUD → User and todo models: queries todos
src/p3/routers/todos.py - Profile updates → JWT validation: validates caller
src/p3/routers/users.py - Profile updates → SQLAlchemy sessions: reads and updates
src/p3/routers/users.py - Profile updates → User and todo models: queries users
src/p3/routers/users.py - Admin todo controls → JWT validation: validates caller
src/p3/routers/admin.py - Admin todo controls → SQLAlchemy sessions: reads and deletes
src/p3/routers/admin.py - Admin todo controls → User and todo models: queries todos
src/p3/routers/admin.py - JWT validation → Environment config: loads signing key
src/p3/routers/auth.py - JWT validation → API client: accepts bearer token
README.md - FastAPI app → SQLAlchemy sessions: creates schema
src/p3/main.py - FastAPI app → User and todo models: loads metadata
src/p3/main.py - SQLAlchemy sessions → Environment config: reads database URL
src/p3/database/db.py - SQLAlchemy sessions → PostgreSQL: persists records
README.md - Schema migrations → PostgreSQL: updates schema
README.md