How himanshubhamaniya/expense-tracker-api works
This is a FastAPI expense-tracking API. Clients register or log in to receive a JWT, then use bearer-authenticated endpoints to create, list/filter, retrieve, update, and delete expenses scoped to their account. Requests pass through the v1 router to endpoint handlers, which use shared database and authentication dependencies. The README documents these capabilities; the sampled source does not include the individual-expense GET handler, so that documented operation is not wired below.
Main entry points: auth.py Authentication · database.py DB engine · expenses.py Expense operations · deps.py Request dependencies
Components 15
API entry
- FastAPI app
app/main.py - V1 router
app/api/v1/router.py
Request workflows
- Authentication
app/api/v1/endpoints/auth.py - Expense operations
app/api/v1/endpoints/expenses.py
Shared foundation
- Request dependencies
app/api/deps.py - JWT and passwords
app/core/security.py - Settings
app/core/config.py - DB engine
app/core/database.py - User model
app/models/user.py - Expense model
app/models/expense.py - Auth schemas
app/schemas/user.py - Token schema
app/schemas/token.py - Expense schemas
app/schemas/expense.py
Other components
- API client
- SQL database
Connections 22
- API client → FastAPI app: sends requests
- FastAPI app → V1 router: mounts routes
- FastAPI app → DB engine: creates tables
- V1 router → Authentication: dispatches auth
- V1 router → Expense operations: dispatches expenses
- Authentication → Request dependencies: uses session
- Expense operations → Request dependencies: uses session and user
- Authentication → JWT and passwords: hashes and signs
- Request dependencies → JWT and passwords: verifies JWT
- Request dependencies → DB engine: opens session
- DB engine → Settings: reads URL
- DB engine → SQL database: connects
- Authentication → User model: queries and writes
- Request dependencies → User model: loads user
- Expense operations → User model: uses owner
- Expense operations → Expense model: queries and mutates
- User model → DB engine: uses ORM base
- Expense model → DB engine: uses ORM base
- Authentication → Auth schemas: validates and responds
- Authentication → Token schema: returns token
- Expense operations → Expense schemas: validates and responds
- Expense schemas → Expense model: uses category enum