# mohammadwaseem6/creditwise architecture

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

- Interactive diagram: https://gitdiagram.com/mohammadwaseem6/creditwise
- Repository: https://github.com/mohammadwaseem6/creditwise

## Overview

CreditWise is a credit-card and debt-management application: users register or sign in, manage card records, and view debt, credit, payoff, payment, and rewards information. The React frontend calls a FastAPI backend, which exposes authentication, card, payment, and dashboard routes and uses PostgreSQL-backed models. Sampled code confirms the authentication and dashboard request flows and card-list/create requests; route implementations for cards, payments, and dashboard were not sampled, so their internal calls are not inferred.

Main entry points: [`BACKEND/main.py`](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/main.py) (FastAPI application), [`FRONTEND/src/App.tsx`](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/App.tsx) (App and routes), [`BACKEND/app/routes/auth.py`](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/auth.py) (Authentication routes), [`FRONTEND/src/utils/api.ts`](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/utils/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["App and routes<br/>[App.tsx]"]
  node_auth_ui["Auth state<br/>[AuthContext.tsx]"]
  node_login["Login and register<br/>[Login.tsx]"]
  node_cards_ui["Card management<br/>[Cards.tsx]"]
  node_dashboard_ui["Dashboard view<br/>[Dashboard.tsx]"]
  node_card_visual["Card visualization"]
  node_api_client["API client<br/>[api.ts]"]
end

subgraph group_backend["API services"]
  node_api["FastAPI application<br/>[main.py]"]
  node_card_routes["Card routes<br/>[cards.py]"]
  node_payment_routes["Payment routes<br/>[payments.py]"]
  node_dashboard_routes["Dashboard routes<br/>[dashboard.py]"]
  node_schemas["Request and response schemas<br/>[schemas.py]"]
end

subgraph group_identity["Identity"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_auth_logic["Password and tokens<br/>[auth.py]"]
end

subgraph group_data["Persistence"]
  node_models["User and credit models<br/>[models.py]"]
  node_db_session["Database sessions<br/>[database.py]"]
end

node_person(("CreditWise user"))
node_postgres[("PostgreSQL")]

node_person -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_ui
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_cards_ui
node_app -->|"routes to"| node_dashboard_ui
node_cards_ui -->|"renders cards"| node_card_visual
node_login -->|"authenticates"| node_auth_ui
node_auth_ui -->|"sends auth requests"| node_api_client
node_cards_ui -->|"requests card data"| node_api_client
node_dashboard_ui -->|"requests dashboard"| node_api_client
node_api_client -->|"HTTP requests"| node_api
node_api -->|"dispatches auth"| node_auth_routes
node_api -->|"dispatches cards"| node_card_routes
node_api -->|"dispatches payments"| node_payment_routes
node_api -->|"dispatches dashboard"| node_dashboard_routes
node_auth_routes -->|"hashes and issues tokens"| node_auth_logic
node_auth_logic -->|"queries users"| node_models
node_auth_routes -->|"creates and reads users"| node_models
node_auth_routes -->|"validates and formats"| node_schemas
node_db_session -->|"opens sessions"| node_postgres
node_api -->|"creates tables"| node_db_session

click node_app "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/App.tsx"
click node_auth_ui "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/context/AuthContext.tsx"
click node_login "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Login.tsx"
click node_cards_ui "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Cards.tsx"
click node_dashboard_ui "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Dashboard.tsx"
click node_card_visual "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/components/CreditCardVisual.tsx"
click node_api_client "https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/utils/api.ts"
click node_api "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/main.py"
click node_auth_routes "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/auth.py"
click node_card_routes "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/cards.py"
click node_payment_routes "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/payments.py"
click node_dashboard_routes "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/dashboard.py"
click node_auth_logic "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/auth.py"
click node_schemas "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/schemas.py"
click node_models "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/models.py"
click node_db_session "https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/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_app,node_auth_ui,node_login,node_cards_ui,node_dashboard_ui,node_card_visual,node_api_client,node_person toneBlue
class node_api,node_card_routes,node_payment_routes,node_dashboard_routes,node_schemas,node_postgres toneAmber
class node_auth_routes,node_auth_logic toneMint
class node_models,node_db_session toneRose
```

## Components

### Web application

- [App and routes](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/App.tsx): `FRONTEND/src/App.tsx`
- [Auth state](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/context/AuthContext.tsx): `FRONTEND/src/context/AuthContext.tsx`
- [Login and register](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Login.tsx): `FRONTEND/src/pages/Login.tsx`
- [Card management](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Cards.tsx): `FRONTEND/src/pages/Cards.tsx`
- [Dashboard view](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/pages/Dashboard.tsx): `FRONTEND/src/pages/Dashboard.tsx`
- [Card visualization](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/components/CreditCardVisual.tsx): `FRONTEND/src/components/CreditCardVisual.tsx`
- [API client](https://github.com/mohammadwaseem6/creditwise/blob/main/FRONTEND/src/utils/api.ts): `FRONTEND/src/utils/api.ts`

### API services

- [FastAPI application](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/main.py): `BACKEND/main.py`
- [Card routes](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/cards.py): `BACKEND/app/routes/cards.py`
- [Payment routes](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/payments.py): `BACKEND/app/routes/payments.py`
- [Dashboard routes](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/dashboard.py): `BACKEND/app/routes/dashboard.py`
- [Request and response schemas](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/schemas.py): `BACKEND/app/schemas.py`

### Identity

- [Authentication routes](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/routes/auth.py): `BACKEND/app/routes/auth.py`
- [Password and tokens](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/auth.py): `BACKEND/app/auth.py`

### Persistence

- [User and credit models](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/models.py): `BACKEND/app/models.py`
- [Database sessions](https://github.com/mohammadwaseem6/creditwise/blob/main/BACKEND/app/database.py): `BACKEND/app/database.py`

### Other components

- **CreditWise user**
- **PostgreSQL**

## Connections

- CreditWise user → App and routes: uses
- App and routes → Auth state: provides auth
- App and routes → Login and register: routes to
- App and routes → Card management: routes to
- App and routes → Dashboard view: routes to
- Card management → Card visualization: renders cards
- Login and register → Auth state: authenticates
- Auth state → API client: sends auth requests
- Card management → API client: requests card data
- Dashboard view → API client: requests dashboard
- API client → FastAPI application: HTTP requests
- FastAPI application → Authentication routes: dispatches auth
- FastAPI application → Card routes: dispatches cards
- FastAPI application → Payment routes: dispatches payments
- FastAPI application → Dashboard routes: dispatches dashboard
- Authentication routes → Password and tokens: hashes and issues tokens
- Password and tokens → User and credit models: queries users
- Authentication routes → User and credit models: creates and reads users
- Authentication routes → Request and response schemas: validates and formats
- Database sessions → PostgreSQL: opens sessions
- FastAPI application → Database sessions: creates tables
