How dtc245200007/expense-management-lite-final works
Sổ Chi Tiêu Lite is a personal-expense web app: users register or sign in, manage income/expense categories and transactions, then view a dashboard and monthly reports. React routes requests through its API client to FastAPI; authenticated handlers use the current account and PostgreSQL-backed data. The README also describes deployment and monitoring services, but their implementation files are not in the supplied tree, so they are not mapped here. Backend connections beyond the shown excerpts follow the router registration and source-index references; frontend-to-API links are documented only at a high level.
Main entry points: database.py Database session · main.py FastAPI app · auth.py Authentication · categories.py Category management
Components 16
Web interface
- React app
frontend/src/App.tsx - Session state
frontend/src/auth/AuthContext.tsx - API client
frontend/src/lib/api.ts
API services
- FastAPI app
app/main.py - Authentication
app/routers/auth.py - Current account
app/core/deps.py - Category management
app/routers/categories.py - Transactions
app/routers/transactions.py - Dashboard
app/routers/dashboard.py - Monthly reports
app/routers/reports.py
Expense domain
- User records
app/models/user.py - Category records
app/models/category.py - Transaction records
app/models/transaction.py
Persistence
- Database session
app/database.py - PostgreSQL
Other components
- Account holder
Connections 26
- Account holder → React app: uses
frontend/src/App.tsx - React app → Session state: provides session
frontend/src/App.tsx - Session state → API client: requests identity
frontend/src/auth/AuthContext.tsx - React app → API client: routes requests
- API client → FastAPI app: calls API
- FastAPI app → Authentication: registers routes
app/main.py - FastAPI app → Category management: registers routes
app/main.py - FastAPI app → Transactions: registers routes
app/main.py - FastAPI app → Dashboard: registers routes
app/main.py - FastAPI app → Monthly reports: registers routes
app/main.py - Authentication → Database session: opens session
app/routers/auth.py - Authentication → User records: queries and updates
app/routers/auth.py - Authentication → Current account: checks session
app/routers/auth.py - Current account → Database session: opens session
app/core/deps.py - Current account → User records: loads account
app/core/deps.py - Category management → Category records: reads and writes
app/routers/categories.py - Category management → Transaction records: checks usage
app/routers/categories.py - Category management → Database session: opens session
app/routers/categories.py - Transactions → Transaction records: reads and writes
app/routers/transactions.py - Transactions → Category records: checks category
app/routers/transactions.py - Transactions → Database session: opens session
app/routers/transactions.py - Dashboard → Database session: queries data
app/routers/dashboard.py - Monthly reports → Database session: queries data
app/routers/reports.py - Monthly reports → Category records: aggregates categories
app/routers/reports.py - Monthly reports → Transaction records: aggregates transactions
app/routers/reports.py - Database session → PostgreSQL: connects