# mcaivano26/cs450-expense-tracker architecture

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

- Interactive diagram: https://gitdiagram.com/mcaivano26/cs450-expense-tracker
- Repository: https://github.com/mcaivano26/cs450-expense-tracker

## Overview

Expense Tracker is a personal-finance dashboard whose current workflow is to enter income or expense transactions, validate and persist them, then reload transaction history and income/expense/net totals in the browser. The README also describes monthly/category review, filtering, budget health, and seeded sample data; several of these are product goals rather than demonstrated runtime features in the sampled source. The diagram focuses on implemented paths and documented capabilities, and avoids asserting unsampled route or storage details.

Main entry points: [`frontend/src/App.tsx`](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/App.tsx) (Dashboard and totals), [`backend/src/app.ts`](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/app.ts) (Express routes), [`frontend/src/api/client.ts`](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/api/client.ts) (API client), [`backend/prisma/seed.ts`](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/prisma/seed.ts) (Sample data seeding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Dashboard UI"]
  node_dashboard["Dashboard and totals<br/>[App.tsx]"]
  node_add_form["Add transaction form"]
  node_api_client["API client<br/>[client.ts]"]
  node_api_types["API data types<br/>[api.ts]"]
  node_monthly_category_review["Monthly and category review"]
  node_transaction_filtering["Date and type filtering"]
  node_budget_health["Budget overview"]
end

subgraph group_api["Transaction API"]
  node_express_api["Express routes<br/>[app.ts]"]
end

subgraph group_domain["Transaction Logic"]
  node_body_validation["Body validation<br/>[validateBody.ts]"]
  node_transaction_rules["Transaction schemas<br/>[transaction.ts]"]
  node_demo_identity["Demo user identity<br/>[demoUser.ts]"]
  node_health_response["Health response<br/>[health.ts]"]
  node_transaction_generator["Transaction generator"]
end

subgraph group_persistence["Persistence"]
  node_prisma["Prisma data access<br/>[app.ts]"]
  node_postgres[("PostgreSQL database<br/>[schema.prisma]")]
  node_sample_seed["Sample data seeding<br/>[seed.ts]"]
end

node_user(("Finance user"))

node_user -->|"views"| node_dashboard
node_dashboard -->|"renders"| node_add_form
node_dashboard -->|"fetches data"| node_api_client
node_add_form -->|"submits transaction"| node_api_client
node_dashboard -->|"uses types"| node_api_types
node_api_client -->|"uses types"| node_api_types
node_api_client -->|"requests JSON"| node_express_api
node_express_api -->|"validates writes"| node_body_validation
node_express_api -->|"uses schemas"| node_transaction_rules
node_express_api -->|"resolves user"| node_demo_identity
node_express_api -->|"builds health"| node_health_response
node_express_api -->|"queries and writes"| node_prisma
node_prisma -->|"persists records"| node_postgres
node_sample_seed -->|"generates rows"| node_transaction_generator
node_sample_seed -->|"resolves user"| node_demo_identity
node_sample_seed -->|"seeds records"| node_postgres
node_dashboard -.->|"capability described"| node_monthly_category_review
node_dashboard -.->|"capability described"| node_transaction_filtering
node_dashboard -.->|"capability described"| node_budget_health

click node_dashboard "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/App.tsx"
click node_add_form "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/components/AddTransactionForm.tsx"
click node_api_client "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/api/client.ts"
click node_api_types "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/types/api.ts"
click node_express_api "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/app.ts"
click node_body_validation "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/middleware/validateBody.ts"
click node_transaction_rules "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/schemas/transaction.ts"
click node_demo_identity "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/demoUser.ts"
click node_health_response "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/types/health.ts"
click node_prisma "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/app.ts"
click node_postgres "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/prisma/schema.prisma"
click node_sample_seed "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/prisma/seed.ts"
click node_transaction_generator "https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/data/generateTransactions.ts"

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_dashboard,node_add_form,node_api_client,node_api_types,node_monthly_category_review,node_transaction_filtering,node_budget_health,node_user toneBlue
class node_express_api toneAmber
class node_body_validation,node_transaction_rules,node_demo_identity,node_health_response,node_transaction_generator toneMint
class node_prisma,node_postgres,node_sample_seed toneRose
```

## Components

### Dashboard UI

- [Dashboard and totals](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Add transaction form](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/components/AddTransactionForm.tsx): `frontend/src/components/AddTransactionForm.tsx`
- [API client](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/api/client.ts): `frontend/src/api/client.ts`
- [API data types](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/frontend/src/types/api.ts): `frontend/src/types/api.ts`
- **Monthly and category review**
- **Date and type filtering**
- **Budget overview**

### Transaction API

- [Express routes](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/app.ts): `backend/src/app.ts`

### Transaction Logic

- [Body validation](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/middleware/validateBody.ts): `backend/src/middleware/validateBody.ts`
- [Transaction schemas](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/schemas/transaction.ts): `backend/src/schemas/transaction.ts`
- [Demo user identity](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/demoUser.ts): `backend/src/demoUser.ts`
- [Health response](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/types/health.ts): `backend/src/types/health.ts`
- [Transaction generator](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/data/generateTransactions.ts): `backend/src/data/generateTransactions.ts`

### Persistence

- [Prisma data access](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [PostgreSQL database](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`
- [Sample data seeding](https://github.com/mcaivano26/cs450-expense-tracker/blob/main/backend/prisma/seed.ts): `backend/prisma/seed.ts`

### Other components

- **Finance user**

## Connections

- Finance user → Dashboard and totals: views (evidence: `README.md`)
- Dashboard and totals → Add transaction form: renders (evidence: `frontend/src/App.tsx`)
- Dashboard and totals → API client: fetches data (evidence: `frontend/src/App.tsx`)
- Add transaction form → API client: submits transaction (evidence: `frontend/src/components/AddTransactionForm.tsx`)
- Dashboard and totals → API data types: uses types (evidence: `frontend/src/App.tsx`)
- API client → API data types: uses types (evidence: `frontend/src/api/client.ts`)
- API client → Express routes: requests JSON (evidence: `README.md`)
- Express routes → Body validation: validates writes (evidence: `backend/src/app.ts`)
- Express routes → Transaction schemas: uses schemas (evidence: `backend/src/app.ts`)
- Express routes → Demo user identity: resolves user (evidence: `backend/src/app.ts`)
- Express routes → Health response: builds health (evidence: `backend/src/app.ts`)
- Express routes → Prisma data access: queries and writes (evidence: `backend/src/app.ts`)
- Prisma data access → PostgreSQL database: persists records (evidence: `README.md`)
- Sample data seeding → Transaction generator: generates rows (evidence: `backend/prisma/seed.ts`)
- Sample data seeding → Demo user identity: resolves user (evidence: `backend/prisma/seed.ts`)
- Sample data seeding → PostgreSQL database: seeds records (evidence: `backend/prisma/seed.ts`)
- Dashboard and totals → Monthly and category review: capability described (evidence: `README.md`)
- Dashboard and totals → Date and type filtering: capability described (evidence: `README.md`)
- Dashboard and totals → Budget overview: capability described (evidence: `README.md`)
