How aalluinmar/expense-tracker-api works
Expense Tracker API is a FastAPI service for registering users, issuing JWT bearer tokens, and managing expenses. A client reaches the mounted auth and expense routers; request handlers validate payloads, apply authentication where required, and use SQLAlchemy sessions to read or change PostgreSQL data. Authentication and expense handling are distinct domain stages, supported by shared security, schemas, models, and database configuration. The README describes the overall router-to-view-to-database architecture; source excerpts show the concrete calls and imports. Unsampled configuration and runtime details are not expanded.
Main entry points: database.py Database sessions · auth.py Auth handlers · security.py Authentication security · main.py FastAPI application
Components 12
API routing
- FastAPI application
app/main.py - Auth router
app/routers/auth.py - Expense router
app/routers/expenses.py
Request handling
- Auth handlers
app/views/auth.py - Expense handlers
app/views/expenses.py
Shared services
- Request schemas
app/schemas.py - Authentication security
app/security.py - Environment settings
app/config.py
Persistence
- Database sessions
app/database.py - User and expense models
app/models.py
Other components
- API client
- PostgreSQL
Connections 20
- API client → FastAPI application: sends requests
README.md - FastAPI application → Auth router: mounts routes
app/main.py - FastAPI application → Expense router: mounts routes
app/main.py - FastAPI application → Database sessions: creates tables
app/main.py - Auth router → Auth handlers: registers handlers
app/routers/auth.py - Expense router → Expense handlers: registers handlers
app/routers/expenses.py - Expense router → Authentication security: requires user
app/routers/expenses.py - Auth handlers → Database sessions: gets session
app/views/auth.py - Auth handlers → User and expense models: queries users
app/views/auth.py - Auth handlers → Request schemas: validates payloads
app/views/auth.py - Auth handlers → Authentication security: hashes and issues tokens
app/views/auth.py - Expense handlers → Database sessions: gets session
app/views/expenses.py - Expense handlers → User and expense models: reads and changes
app/views/expenses.py - Expense handlers → Request schemas: validates payloads
app/views/expenses.py - Authentication security → Database sessions: gets session
app/security.py - Authentication security → User and expense models: looks up user
app/security.py - Authentication security → Environment settings: uses token settings
app/security.py - Database sessions → Environment settings: loads connection settings
app/database.py - User and expense models → Database sessions: uses declarative base
app/models.py - Database sessions → PostgreSQL: connects to
README.md