How petkov93/finance-tracker works
1. Overall shape
- This is a single Django monolith with one main app, financetracker, plus the project config package config.
- The app is server-rendered: Django views return HTML templates, and static CSS is served through WhiteNoise.
2. Request entry points
- config/urls.py routes the site-level paths into the financetracker app and likely exposes a lightweight /health/ endpoint for deployment checks.
- financetracker/urls.py is the app boundary for the user-facing features: dashboard, transactions, statistics, investments, auth pages, and CRUD actions.
3. Domain model layer
- models.py defines the core persistence objects:
- Category for income/expense grouping
- Transaction for income and expense entries
- InvestmentEntry for invested/profit tracking
- Migrations show these are the primary business entities and that the schema evolved to support category typing and investments.
4. Data ownership boundary
- All financial records are scoped per authenticated Django user; the app is explicitly multi-user, but each user only sees their own data.
- Django’s built-in user model handles registration, login, logout, and session state; there is no separate auth service.
5. Feature subsystems in the app
- Dashboard aggregates balance, income, expense totals, and recent transactions.
- Transactions handles add/edit/delete flows for income and expense entries.
- Statistics computes summary metrics and chart-ready datasets over a configurable date range.
- Investments provides a separate list/edit/delete flow for invested vs profit amounts and portfolio value.
- These are separate UI surfaces, but they all read from the same underlying user-owned financial records.
6. Form and validation layer
- forms.py is the interaction boundary for user input.
- It likely enforces category filtering by transaction type and validates amounts/descriptions before hitting the model layer.
- This keeps business rules out of the templates and limits what data can reach persistence.
7. Presentation layer
- Templates live under financetracker/templates/financetracker/ and are organized by page: base layout, dashboard, transactions, statistics, investments, login, register.
- base.html is the shared shell for the dark UI, while page templates render the computed data from views.
- style.css is the only app-specific static asset shown, so the frontend is lightweight and server-driven rather than SPA-based.
8. Business logic / view layer
- views.py is the main orchestration layer: it queries models, applies per-user filtering, prepares summaries/charts, and handles form submissions.
- The views are the place where calculations such as totals, monthly summaries, and category breakdowns are assembled for the templates.
9. Administration and bootstrap
- admin.py exposes models in Django admin at /admin/ for direct management of categories, transactions, and investment entries.
- management/commands/seed_categories.py is a bootstrap command that populates default income/expense categories only when the category table is empty, so startup does not overwrite existing admin data.
10. Runtime and deployment boundary
- settings.py, wsgi.py, and manage.py are standard Django runtime entry points.
- Production is configured for Gunicorn plus WhiteNoise, with PostgreSQL via a SUPABASE_URL environment variable; local development can fall back to SQLite when that variable is absent.
- Render deployment is implied by the README and the app is designed to run migrations, optionally seed data, collect static files, and then serve the site.
11. What an architecture diagram should emphasize
- A browser talks to Django views.
- Views use forms and models.
- Models persist to PostgreSQL/SQLite.
- Templates render the HTML responses.
- Static assets are served separately via WhiteNoise.
- Django auth/session state gates access so each user’s financial data stays isolated.
Main entry points: views.py Views · models.py Models · urls.py Site URLs · settings.py Settings
Components 19
Runtime
Django project bootstrap and deployment entry points
App Core
Domain, forms, views, admin, and background commands
- Views · Request handling, per-user filtering, summaries, and form submission
financetracker/views.py - App URLs · Feature routes for dashboard, transactions, statistics, and investments
financetracker/urls.py - Forms · User input validation and category filtering
financetracker/forms.py - Models · Category, Transaction, and InvestmentEntry persistence models
financetracker/models.py - Migrations · Database schema evolution for categories and investments
financetracker/migrations/0001_initial.py - Admin · Django admin registrations for direct data management
financetracker/admin.py - Seed Cmd · Populates default categories when none exist
financetracker/management/commands/seed_categories.py
UI
Templates and static assets for server-rendered pages
- Dashboard UI · Dashboard page and shared shell
financetracker/templates/financetracker/dashboard.html - Transaction UI · Transaction create/edit/delete pages
financetracker/templates/financetracker/add_transaction.html - Statistics UI · Summary and chart pages
financetracker/templates/financetracker/statistics.html - Investments UI · Investment list and edit pages
financetracker/templates/financetracker/investments.html - Base Layout · Shared HTML layout for the app
financetracker/templates/financetracker/base.html - Styles · App-specific server-served styling
financetracker/static/financetracker/css/style.css
Other components
- Browser · User requests and form submissions
- Auth · Django users, login, logout, and session state
Connections 24
- Browser → Site URLs: HTTP · Browser requests enter the project router
- Site URLs → App URLs: route · Site paths are delegated to the app router
- Site URLs → Auth: auth paths · Login and logout rely on Django auth/session state
- Site URLs → Views: health/site · Project routes reach view handlers
- App URLs → Views: dispatch · Feature routes map to view functions
- Views → Forms: validate · Views bind and validate user submissions
- Forms → Models: clean data · Validated inputs are shaped for persistence
- Views → Models: query/write · Views read and write user-owned financial records
- Models → Migrations: evolve schema · Migrations define the database structure
- Views → Dashboard UI: render · Dashboard data is rendered into HTML
- Views → Transaction UI: render · Transaction flows render page templates
- Views → Statistics UI: render · Statistics summaries render page templates
- Views → Investments UI: render · Investment flows render page templates
- Dashboard UI → Base Layout: extend · Page templates share the base layout
- Transaction UI → Base Layout: extend · Page templates share the base layout
- Statistics UI → Base Layout: extend · Page templates share the base layout
- Investments UI → Base Layout: extend · Page templates share the base layout
- Settings → Models: DB config · Settings choose SQLite or PostgreSQL-backed persistence
- Settings → Styles: static files · WhiteNoise serves static assets
- Manage → Settings: boot · CLI startup loads project settings
- WSGI → Settings: serve · Production server boots through WSGI config
- Admin → Models: manage · Admin exposes core domain objects
- Seed Cmd → Models: seed · Bootstrap command creates default categories
- Auth → Views: gate access · Authenticated users are required for personal data access