# divyam1708/personal_expense_tracker architecture

> Architecture diagram of the GitHub repository divyam1708/personal_expense_tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/divyam1708/personal_expense_tracker
- Repository: https://github.com/divyam1708/personal_expense_tracker

## Overview

#### 1. Purpose and Runtime
This is a Django personal expense tracker with account registration/login and expense browsing/detail views. It runs through Django’s management and deployment entry points: `manage.py`, `personal_expense_tracker/wsgi.py`, and `personal_expense_tracker/asgi.py`.

#### 2. Project Composition and Routing
The project root configures Django and composes application URLs. `personal_expense_tracker/settings.py` defines runtime configuration, while `personal_expense_tracker/urls.py` routes requests into the account and expense domains. The two primary Django apps are `accounts/` and `expenses/`.

#### 3. Account and Authentication Domain
The accounts app owns user-facing identity flows: registration, login, and authenticated-state pages. Request handlers and route definitions reside in `accounts/views.py` and `accounts/urls.py`; account persistence is defined in `accounts/models.py`. HTML rendering is backed by `templates/accounts/Register.html`, `templates/accounts/Login.html`, and `templates/accounts/Logged_in.html`.

#### 4. Expense Domain
The expenses app is the core business domain: it models expense records, accepts/forms expense-related input, and exposes views for home, daily, monthly, and individual-expense detail screens. Its principal boundary is `expenses/models.py`, with request orchestration in `expenses/views.py` and route declarations in `expenses/urls.py`. Main presentation surfaces are `templates/expenses/home.html`, `templates/expenses/DayBasedExpense.html`, `templates/expenses/MonthBasedExpense.html`, and `templates/expenses/ExpenseDetail.html`.

#### 5. Primary Request and Data Flow
Browser requests enter Django through ASGI or WSGI, are matched by `personal_expense_tracker/urls.py`, then dispatched to app views. Views use forms and models to validate input and read/write database-backed entities: `accounts/forms.py` / `accounts/models.py` for identity operations and `expenses/forms.py` / `expenses/models.py` for expense operations. Views render server-side Django templates, with shared layout and error boundaries in `templates/base/Base_1.html` and `templates/base/Error_1.html`.

#### 6. Persistence and Schema Evolution
Django ORM models are the persistence abstraction; the backing database is selected through project settings rather than visible in the tree. Schema history is maintained independently per domain in `accounts/migrations/0001_initial.py` and `expenses/migrations/0001_initial.py`. Django admin integration is present in `accounts/admin.py` and `expenses/admin.py`, providing an operational interface for managed models.

#### 7. Front-End Assets and Deployment Considerations
The UI is server-rendered but augmented with app-specific static JavaScript and CSS. Shared assets live under `static/base/`, while expense screens use `static/expenses/scripts/home_1.js`, `static/expenses/scripts/expense_details_1.js`, and corresponding styles. Deployment can use either synchronous WSGI or asynchronous ASGI interfaces; no separate API service, queue, or external integration is evidenced by the repository tree. `secret_notes/ec2_secrets.txt` suggests EC2-related deployment secrets are stored in-repo and should be treated as a security boundary.

Main entry points: [`personal_expense_tracker/urls.py`](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/urls.py) (Project URL router), [`accounts/views.py`](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/views.py) (Account views), [`expenses/views.py`](https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/views.py) (Expense views), [`personal_expense_tracker/settings.py`](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/settings.py) (Project settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Django Runtime"]
  node_manage{{"Management entry point<br/>Django CLI<br/>[manage.py]"}}
  node_wsgi{{"WSGI entry point<br/>sync deployment<br/>[wsgi.py]"}}
  node_asgi{{"ASGI entry point<br/>async deployment<br/>[asgi.py]"}}
  node_settings["Project settings<br/>runtime config<br/>[settings.py]"]
  node_project_urls["Project URL router<br/>URL composition<br/>[urls.py]"]
end

subgraph group_accounts["Accounts Domain"]
  node_account_urls["Account routes<br/>URL declarations<br/>[urls.py]"]
  node_account_views["Account views<br/>request handlers<br/>[views.py]"]
  node_account_forms["Account forms<br/>input validation<br/>[forms.py]"]
  node_account_models[("Account models<br/>ORM models<br/>[models.py]")]
end

subgraph group_expenses["Expenses Domain"]
  node_expense_urls["Expense routes<br/>URL declarations<br/>[urls.py]"]
  node_expense_views["Expense views<br/>request handlers<br/>[views.py]"]
  node_expense_forms["Expense forms<br/>input validation<br/>[forms.py]"]
  node_expense_models[("Expense models<br/>ORM models<br/>[models.py]")]
end

subgraph group_ui["Server-rendered UI"]
  node_account_templates["Account templates<br/>HTML views<br/>[Register.html]"]
  node_expense_templates["Expense templates<br/>HTML views<br/>[home.html]"]
  node_shared_templates["Shared layout &amp; errors<br/>base templates<br/>[Base_1.html]"]
  node_static_assets["Static assets<br/>CSS and JavaScript"]
end

subgraph group_data["Persistence &amp; Operations"]
  node_database[("Configured database<br/>Django ORM backend")]
  node_migrations["Schema migrations<br/>schema history<br/>[0001_initial.py]"]
  node_admin["Django admin<br/>operations UI<br/>[admin.py]"]
  node_secrets["EC2 secrets file<br/>security boundary<br/>[ec2_secrets.txt]"]
end

node_manage -->|"loads"| node_settings
node_wsgi -->|"boots"| node_settings
node_asgi -->|"boots"| node_settings
node_settings -->|"configures"| node_project_urls
node_wsgi -->|"HTTP requests"| node_project_urls
node_asgi -->|"HTTP requests"| node_project_urls
node_project_urls -->|"includes"| node_account_urls
node_project_urls -->|"includes"| node_expense_urls
node_account_urls -->|"dispatches"| node_account_views
node_expense_urls -->|"dispatches"| node_expense_views
node_account_views -->|"validates input"| node_account_forms
node_account_views -->|"reads and writes"| node_account_models
node_expense_views -->|"validates input"| node_expense_forms
node_expense_views -->|"reads and writes"| node_expense_models
node_account_models -->|"persists via ORM"| node_database
node_expense_models -->|"persists via ORM"| node_database
node_migrations -.->|"defines initial schema"| node_account_models
node_migrations -.->|"defines initial schema"| node_expense_models
node_admin -->|"manages"| node_account_models
node_admin -->|"manages"| node_expense_models
node_account_views -->|"renders"| node_account_templates
node_expense_views -->|"renders"| node_expense_templates
node_account_templates -.->|"uses layout"| node_shared_templates
node_expense_templates -.->|"uses layout"| node_shared_templates
node_expense_templates -.->|"loads assets"| node_static_assets

click node_manage "https://github.com/divyam1708/personal_expense_tracker/blob/main/manage.py"
click node_wsgi "https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/wsgi.py"
click node_asgi "https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/asgi.py"
click node_settings "https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/settings.py"
click node_project_urls "https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/urls.py"
click node_account_urls "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/urls.py"
click node_account_views "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/views.py"
click node_account_forms "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/forms.py"
click node_account_models "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/models.py"
click node_expense_urls "https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/urls.py"
click node_expense_views "https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/views.py"
click node_expense_forms "https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/forms.py"
click node_expense_models "https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/models.py"
click node_account_templates "https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/accounts/Register.html"
click node_expense_templates "https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/expenses/home.html"
click node_shared_templates "https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/base/Base_1.html"
click node_migrations "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/migrations/0001_initial.py"
click node_admin "https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/admin.py"
click node_secrets "https://github.com/divyam1708/personal_expense_tracker/blob/main/secret_notes/ec2_secrets.txt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_manage,node_wsgi,node_asgi,node_settings,node_project_urls toneBlue
class node_account_urls,node_account_views,node_account_forms,node_account_models toneAmber
class node_expense_urls,node_expense_views,node_expense_forms,node_expense_models toneMint
class node_account_templates,node_expense_templates,node_shared_templates,node_static_assets toneRose
class node_database,node_migrations,node_admin,node_secrets toneIndigo
```

## Components

### Django Runtime

- [Management entry point](https://github.com/divyam1708/personal_expense_tracker/blob/main/manage.py): Django CLI · `manage.py`
- [WSGI entry point](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/wsgi.py): sync deployment · `personal_expense_tracker/wsgi.py`
- [ASGI entry point](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/asgi.py): async deployment · `personal_expense_tracker/asgi.py`
- [Project settings](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/settings.py): runtime config · Selects the database and Django configuration. · `personal_expense_tracker/settings.py`
- [Project URL router](https://github.com/divyam1708/personal_expense_tracker/blob/main/personal_expense_tracker/urls.py): URL composition · `personal_expense_tracker/urls.py`

### Accounts Domain

- [Account routes](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/urls.py): URL declarations · `accounts/urls.py`
- [Account views](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/views.py): request handlers · Handles registration, login, and authenticated pages. · `accounts/views.py`
- [Account forms](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/forms.py): input validation · `accounts/forms.py`
- [Account models](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/models.py): ORM models · `accounts/models.py`

### Expenses Domain

- [Expense routes](https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/urls.py): URL declarations · `expenses/urls.py`
- [Expense views](https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/views.py): request handlers · Serves home, daily, monthly, and detail screens. · `expenses/views.py`
- [Expense forms](https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/forms.py): input validation · `expenses/forms.py`
- [Expense models](https://github.com/divyam1708/personal_expense_tracker/blob/main/expenses/models.py): ORM models · `expenses/models.py`

### Server-rendered UI

- [Account templates](https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/accounts/Register.html): HTML views · `templates/accounts/Register.html`
- [Expense templates](https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/expenses/home.html): HTML views · `templates/expenses/home.html`
- [Shared layout & errors](https://github.com/divyam1708/personal_expense_tracker/blob/main/templates/base/Base_1.html): base templates · `templates/base/Base_1.html`
- **Static assets**: CSS and JavaScript · Shared and expense-screen client assets.

### Persistence & Operations

- **Configured database**: Django ORM backend · Database engine is selected in project settings.
- [Schema migrations](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/migrations/0001_initial.py): schema history · Each domain maintains its initial schema migration. · `accounts/migrations/0001_initial.py`
- [Django admin](https://github.com/divyam1708/personal_expense_tracker/blob/main/accounts/admin.py): operations UI · Registers managed account and expense models. · `accounts/admin.py`
- [EC2 secrets file](https://github.com/divyam1708/personal_expense_tracker/blob/main/secret_notes/ec2_secrets.txt): security boundary · In-repository deployment secrets require restricted handling. · `secret_notes/ec2_secrets.txt`

## Connections

- Management entry point → Project settings: loads
- WSGI entry point → Project settings: boots
- ASGI entry point → Project settings: boots
- Project settings → Project URL router: configures
- WSGI entry point → Project URL router: HTTP requests
- ASGI entry point → Project URL router: HTTP requests
- Project URL router → Account routes: includes
- Project URL router → Expense routes: includes
- Account routes → Account views: dispatches
- Expense routes → Expense views: dispatches
- Account views → Account forms: validates input
- Account views → Account models: reads and writes
- Expense views → Expense forms: validates input
- Expense views → Expense models: reads and writes
- Account models → Configured database: persists via ORM
- Expense models → Configured database: persists via ORM
- Schema migrations → Account models: defines initial schema
- Schema migrations → Expense models: defines initial schema
- Django admin → Account models: manages
- Django admin → Expense models: manages
- Account views → Account templates: renders
- Expense views → Expense templates: renders
- Account templates → Shared layout & errors: uses layout
- Expense templates → Shared layout & errors: uses layout
- Expense templates → Static assets: loads assets
