# kaioh17/bill-buddy architecture

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

- Interactive diagram: https://gitdiagram.com/kaioh17/bill-buddy
- Repository: https://github.com/kaioh17/bill-buddy

## Overview

Bill Buddy is a subscription-tracking finance app: users sign up or log in, then reach an authenticated dashboard; the API also supports account and Plaid routes. The frontend sends requests to the FastAPI backend, which uses SQLAlchemy models and a configured database. The tree and README establish the product scope, while sampled routes and module references support only some internal links. Subscription tracking, transaction import, and several Plaid capabilities are represented where the tree or documentation supports them; unsampled service behavior is not assumed.

Main entry points: [`backend/app/main.py`](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/main.py) (FastAPI application), [`frontend/src/App.tsx`](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/App.tsx) (Web routes), [`frontend/src/pages/Login.tsx`](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/pages/Login.tsx) (Login and signup), [`backend/app/routers/auth.py`](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/auth.py) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["Web routes<br/>[App.tsx]"]
  node_dashboard["Finance dashboard<br/>[Dashboard.tsx]"]
  node_authpages["Login and signup<br/>[Login.tsx]"]
  node_layout["Shared layout UI<br/>[SplitLayout.tsx]"]
  node_ui["UI components<br/>[ui.tsx]"]
  node_apiclient["API client<br/>[api.ts]"]
  node_authstate["Auth state<br/>[useAuth.ts]"]
end

subgraph group_api["API surface"]
  node_fastapi["FastAPI application<br/>[main.py]"]
  node_authroutes["Auth routes<br/>[auth.py]"]
  node_bankroutes["Bank and Plaid routes<br/>[plaid.py]"]
  node_accountroutes["Account routes<br/>[accounts.py]"]
  node_healthroutes["Health routes<br/>[health.py]"]
  node_schemas["API schemas<br/>[general.py]"]
  node_errors["Error handling<br/>[exception.py]"]
  node_logging["Request logging<br/>[logging.py]"]
end

subgraph group_identity["Identity and sessions"]
  node_authservice["Signup and login<br/>[auth.py]"]
  node_oauth["Bearer authentication<br/>[oauth2.py]"]
  node_sessions["Session renewal<br/>[session.py]"]
  node_tokens["JWT tokens<br/>[tokens.py]"]
end

subgraph group_finance["Banking and finance"]
  node_plaidclient["Plaid client<br/>[plaid.py]"]
  node_plaidservice["Plaid services<br/>[plaid.py]"]
  node_accountservice["Account services<br/>[accounts.py]"]
  node_importer["Transaction importer<br/>[importer.py]"]
end

subgraph group_storage["Persistence"]
  node_subscriptiondata[("Subscription records<br/>[subscriptions.py]")]
  node_transactiondata[("Transaction records<br/>[transactions.py]")]
  node_linkeddata[("Linked accounts<br/>[linked_accounts.py]")]
  node_userdata[("User records<br/>[users.py]")]
  node_db[("SQL database<br/>[database.py]")]
end

node_user(("User"))
node_plaid(("Plaid"))

node_user -->|"uses"| node_webapp
node_webapp -->|"routes to"| node_dashboard
node_webapp -->|"routes to"| node_authpages
node_webapp -->|"renders"| node_layout
node_authpages -->|"submits requests"| node_apiclient
node_dashboard -->|"fetches data"| node_apiclient
node_authpages -->|"uses"| node_layout
node_dashboard -->|"renders"| node_ui
node_authpages -->|"renders"| node_ui
node_apiclient -->|"publishes session"| node_authstate
node_apiclient -->|"sends HTTP requests"| node_fastapi
node_fastapi -->|"registers"| node_authroutes
node_fastapi -->|"registers"| node_bankroutes
node_fastapi -->|"registers"| node_accountroutes
node_fastapi -->|"registers"| node_healthroutes
node_authroutes -->|"delegates to"| node_authservice
node_authroutes -->|"uses schemas"| node_schemas
node_accountroutes -->|"delegates to"| node_accountservice
node_accountroutes -->|"calls"| node_plaidclient
node_bankroutes -->|"delegates to"| node_plaidservice
node_bankroutes -->|"calls"| node_plaidclient
node_authroutes -->|"protects routes"| node_oauth
node_bankroutes -->|"protects routes"| node_oauth
node_oauth -->|"decodes token"| node_tokens
node_oauth -->|"renews session"| node_sessions
node_authservice -->|"creates token"| node_tokens
node_authservice -->|"reads and writes"| node_userdata
node_fastapi -->|"registers handlers"| node_errors
node_errors -->|"formats errors"| node_schemas
node_fastapi -->|"logs requests"| node_logging
node_plaidclient -->|"calls API"| node_plaid
node_importer -->|"uses"| node_plaidclient
node_importer -->|"reads and writes"| node_linkeddata
node_importer -->|"writes"| node_transactiondata
node_subscriptiondata -->|"uses database base"| node_db
node_transactiondata -->|"uses database base"| node_db
node_linkeddata -->|"uses database base"| node_db

click node_webapp "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/App.tsx"
click node_dashboard "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/pages/Dashboard.tsx"
click node_authpages "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/pages/Login.tsx"
click node_layout "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/components/SplitLayout.tsx"
click node_ui "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/components/ui.tsx"
click node_apiclient "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/lib/api.ts"
click node_authstate "https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/lib/useAuth.ts"
click node_fastapi "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/main.py"
click node_authroutes "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/auth.py"
click node_bankroutes "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/plaid.py"
click node_accountroutes "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/accounts.py"
click node_healthroutes "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/health.py"
click node_authservice "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/auth.py"
click node_oauth "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/oauth2.py"
click node_sessions "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/session.py"
click node_tokens "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/tokens.py"
click node_schemas "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/schema/general.py"
click node_errors "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/exception.py"
click node_logging "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/logging.py"
click node_plaidclient "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/plaid.py"
click node_plaidservice "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/plaid.py"
click node_accountservice "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/accounts.py"
click node_importer "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/importer.py"
click node_subscriptiondata "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/subscriptions.py"
click node_transactiondata "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/transactions.py"
click node_linkeddata "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/linked_accounts.py"
click node_userdata "https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/users.py"
click node_db "https://github.com/kaioh17/bill-buddy/blob/main/backend/db/database.py"

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_webapp,node_dashboard,node_authpages,node_layout,node_ui,node_apiclient,node_authstate,node_user toneBlue
class node_fastapi,node_authroutes,node_bankroutes,node_accountroutes,node_healthroutes,node_schemas,node_errors,node_logging toneAmber
class node_authservice,node_oauth,node_sessions,node_tokens toneMint
class node_plaidclient,node_plaidservice,node_accountservice,node_importer toneRose
class node_subscriptiondata,node_transactiondata,node_linkeddata,node_userdata,node_db,node_plaid toneIndigo
```

## Components

### Web application

- [Web routes](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Finance dashboard](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/pages/Dashboard.tsx): `frontend/src/pages/Dashboard.tsx`
- [Login and signup](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/pages/Login.tsx): `frontend/src/pages/Login.tsx`
- [Shared layout UI](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/components/SplitLayout.tsx): `frontend/src/components/SplitLayout.tsx`
- [UI components](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/components/ui.tsx): `frontend/src/components/ui.tsx`
- [API client](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Auth state](https://github.com/kaioh17/bill-buddy/blob/main/frontend/src/lib/useAuth.ts): `frontend/src/lib/useAuth.ts`

### API surface

- [FastAPI application](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/main.py): `backend/app/main.py`
- [Auth routes](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/auth.py): `backend/app/routers/auth.py`
- [Bank and Plaid routes](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/plaid.py): `backend/app/routers/plaid.py`
- [Account routes](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/accounts.py): `backend/app/routers/accounts.py`
- [Health routes](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/routers/health.py): `backend/app/routers/health.py`
- [API schemas](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/schema/general.py): `backend/app/schema/general.py`
- [Error handling](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/exception.py): `backend/app/core/exception.py`
- [Request logging](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/logging.py): `backend/app/core/logging.py`

### Identity and sessions

- [Signup and login](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/auth.py): `backend/app/services/auth.py`
- [Bearer authentication](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/oauth2.py): `backend/app/auth/oauth2.py`
- [Session renewal](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/session.py): `backend/app/auth/session.py`
- [JWT tokens](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/auth/tokens.py): `backend/app/auth/tokens.py`

### Banking and finance

- [Plaid client](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/core/plaid.py): `backend/app/core/plaid.py`
- [Plaid services](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/plaid.py): `backend/app/services/plaid.py`
- [Account services](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/accounts.py): `backend/app/services/accounts.py`
- [Transaction importer](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/services/importer.py): `backend/app/services/importer.py`

### Persistence

- [Subscription records](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/subscriptions.py): `backend/app/models/subscriptions.py`
- [Transaction records](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/transactions.py): `backend/app/models/transactions.py`
- [Linked accounts](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/linked_accounts.py): `backend/app/models/linked_accounts.py`
- [User records](https://github.com/kaioh17/bill-buddy/blob/main/backend/app/models/users.py): `backend/app/models/users.py`
- [SQL database](https://github.com/kaioh17/bill-buddy/blob/main/backend/db/database.py): `backend/db/database.py`

### Other components

- **User**
- **Plaid**

## Connections

- User → Web routes: uses (evidence: `frontend/src/App.tsx`)
- Web routes → Finance dashboard: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Login and signup: routes to (evidence: `frontend/src/App.tsx`)
- Web routes → Shared layout UI: renders (evidence: `frontend/src/App.tsx`)
- Login and signup → API client: submits requests (evidence: `frontend/src/pages/Login.tsx`)
- Finance dashboard → API client: fetches data (evidence: `frontend/src/pages/Dashboard.tsx`)
- Login and signup → Shared layout UI: uses (evidence: `frontend/src/pages/Login.tsx`)
- Finance dashboard → UI components: renders (evidence: `frontend/src/pages/Dashboard.tsx`)
- Login and signup → UI components: renders (evidence: `frontend/src/pages/Login.tsx`)
- API client → Auth state: publishes session (evidence: `frontend/src/lib/useAuth.ts`)
- API client → FastAPI application: sends HTTP requests (evidence: `frontend/src/lib/api.ts`)
- FastAPI application → Auth routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Bank and Plaid routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Account routes: registers (evidence: `backend/app/main.py`)
- FastAPI application → Health routes: registers (evidence: `backend/app/main.py`)
- Auth routes → Signup and login: delegates to (evidence: `backend/app/routers/auth.py`)
- Auth routes → API schemas: uses schemas (evidence: `backend/app/routers/auth.py`)
- Account routes → Account services: delegates to (evidence: `backend/app/routers/accounts.py`)
- Account routes → Plaid client: calls (evidence: `backend/app/routers/accounts.py`)
- Bank and Plaid routes → Plaid services: delegates to (evidence: `backend/app/routers/plaid.py`)
- Bank and Plaid routes → Plaid client: calls (evidence: `backend/app/routers/plaid.py`)
- Auth routes → Bearer authentication: protects routes
- Bank and Plaid routes → Bearer authentication: protects routes (evidence: `backend/app/routers/plaid.py`)
- Bearer authentication → JWT tokens: decodes token (evidence: `backend/app/auth/oauth2.py`)
- Bearer authentication → Session renewal: renews session (evidence: `backend/app/auth/oauth2.py`)
- Signup and login → JWT tokens: creates token (evidence: `backend/app/services/auth.py`)
- Signup and login → User records: reads and writes (evidence: `backend/app/services/auth.py`)
- FastAPI application → Error handling: registers handlers (evidence: `backend/app/main.py`)
- Error handling → API schemas: formats errors (evidence: `backend/app/core/exception.py`)
- FastAPI application → Request logging: logs requests (evidence: `backend/app/main.py`)
- Plaid client → Plaid: calls API (evidence: `backend/app/core/plaid.py`)
- Transaction importer → Plaid client: uses (evidence: `backend/app/services/importer.py`)
- Transaction importer → Linked accounts: reads and writes (evidence: `backend/app/services/importer.py`)
- Transaction importer → Transaction records: writes (evidence: `backend/app/services/importer.py`)
- Subscription records → SQL database: uses database base (evidence: `backend/app/models/subscriptions.py`)
- Transaction records → SQL database: uses database base (evidence: `backend/app/models/transactions.py`)
- Linked accounts → SQL database: uses database base (evidence: `backend/app/models/linked_accounts.py`)
