# mazt08/maze_bank architecture

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

- Interactive diagram: https://gitdiagram.com/mazt08/maze_bank
- Repository: https://github.com/mazt08/maze_bank

## Overview

Maze Bank is a Next.js banking demo centered on account registration/login, authenticated balance and transaction views, and atomic transfers. The graph follows the documented server-only Firestore boundary and includes analytics, profile, admin, notifications, and chatbot capabilities. Some branches are documented by the README or source index but their implementation details were not excerpted; those relationships are omitted where callers are not evidenced.

Main entry points: [`actions/auth.ts`](https://github.com/mazt08/maze_bank/blob/main/actions/auth.ts) (Auth and sessions), [`lib/firestore.ts`](https://github.com/mazt08/maze_bank/blob/main/lib/firestore.ts) (Banking data helpers), [`components/AuthForm.tsx`](https://github.com/mazt08/maze_bank/blob/main/components/AuthForm.tsx) (Login and registration), [`app/dashboard/page.tsx`](https://github.com/mazt08/maze_bank/blob/main/app/dashboard/page.tsx) (Account dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and sessions"]
  node_authui["Login and registration<br/>[AuthForm.tsx]"]
  node_authactions["Auth and sessions<br/>[auth.ts]"]
  node_middleware["Route protection<br/>[middleware.ts]"]
  node_profile["Profile management<br/>[ProfileClient.tsx]"]
end

subgraph group_banking["Accounts and transfers"]
  node_dashboard["Account dashboard<br/>[page.tsx]"]
  node_transferui["Transfer form<br/>[TransferForm.tsx]"]
  node_transferaction["Transfer processing<br/>[transfer.ts]"]
  node_transactions["Transaction history<br/>[page.tsx]"]
  node_analytics["Spending analytics<br/>[page.tsx]"]
  node_analyticsview["Analytics charts<br/>[Analytics.tsx]"]
end

subgraph group_experience["Banking experience"]
  node_layout["Authenticated shell<br/>[Layout.tsx]"]
end

subgraph group_operations["Administration and engagement"]
  node_adminpage["Admin console<br/>[page.tsx]"]
  node_adminui["User management"]
  node_adminactions["Admin actions<br/>[admin.ts]"]
  node_notifications["Notification actions<br/>[notifications.ts]"]
  node_notificationui["Notification bell"]
  node_chat["Chatbot actions<br/>[chat.ts]"]
  node_chatui["MazeBot widget<br/>[MazeBot.tsx]"]
end

subgraph group_platform["Firebase services"]
  node_firestore["Banking data helpers<br/>[firestore.ts]"]
  node_adminsdk["Firebase Admin SDK<br/>[firebase-admin.ts]"]
  node_clientauth["Firebase client auth<br/>[firebase-client.ts]"]
  node_firestoredb[("Firestore")]
  node_firebaseauth["Firebase Authentication"]
end

node_customer(("Bank customer"))
node_admin(("Bank administrator"))

node_customer -->|"signs in"| node_authui
node_authui -->|"authenticates with"| node_clientauth
node_authui -->|"sets session"| node_authactions
node_authui -->|"registers account"| node_authactions
node_authactions -->|"verifies token"| node_adminsdk
node_authactions -->|"creates user"| node_firestore
node_clientauth -->|"authenticates"| node_firebaseauth
node_middleware -.->|"checks session"| node_customer
node_customer -->|"views account"| node_dashboard
node_dashboard -->|"reads session"| node_authactions
node_dashboard -->|"loads account and activity"| node_firestore
node_dashboard -->|"renders within"| node_layout
node_customer -->|"initiates transfer"| node_transferui
node_transferui -->|"submits transfer"| node_transferaction
node_transferaction -->|"moves funds atomically"| node_firestore
node_transferaction -->|"triggers notice"| node_notifications
node_customer -->|"reviews activity"| node_transactions
node_transactions -->|"reads session"| node_authactions
node_transactions -->|"loads transactions"| node_firestore
node_customer -->|"views insights"| node_analytics
node_analytics -->|"passes analytics data"| node_analyticsview
node_analytics -->|"queries transaction data"| node_firestoredb
node_customer -->|"manages profile"| node_profile
node_profile -->|"updates display name"| node_authactions
node_admin -->|"manages accounts"| node_adminpage
node_adminpage -->|"renders admin tools"| node_adminui
node_adminui -->|"requests user operations"| node_adminactions
node_adminactions -->|"reads and updates users"| node_firestore
node_layout -->|"signs out"| node_authactions
node_layout -->|"renders bell"| node_notificationui
node_layout -->|"renders chatbot"| node_chatui
node_notificationui -->|"loads notifications"| node_notifications
node_chatui -->|"sends chat requests"| node_chat
node_firestore -->|"uses"| node_adminsdk
node_adminsdk -->|"reads and writes"| node_firestoredb
node_adminsdk -->|"verifies sessions"| node_firebaseauth

click node_authui "https://github.com/mazt08/maze_bank/blob/main/components/AuthForm.tsx"
click node_authactions "https://github.com/mazt08/maze_bank/blob/main/actions/auth.ts"
click node_middleware "https://github.com/mazt08/maze_bank/blob/main/middleware.ts"
click node_profile "https://github.com/mazt08/maze_bank/blob/main/components/ProfileClient.tsx"
click node_dashboard "https://github.com/mazt08/maze_bank/blob/main/app/dashboard/page.tsx"
click node_transferui "https://github.com/mazt08/maze_bank/blob/main/components/TransferForm.tsx"
click node_transferaction "https://github.com/mazt08/maze_bank/blob/main/actions/transfer.ts"
click node_transactions "https://github.com/mazt08/maze_bank/blob/main/app/transactions/page.tsx"
click node_analytics "https://github.com/mazt08/maze_bank/blob/main/app/analytics/page.tsx"
click node_analyticsview "https://github.com/mazt08/maze_bank/blob/main/components/Analytics.tsx"
click node_layout "https://github.com/mazt08/maze_bank/blob/main/components/Layout.tsx"
click node_adminpage "https://github.com/mazt08/maze_bank/blob/main/app/admin/page.tsx"
click node_adminui "https://github.com/mazt08/maze_bank/blob/main/components/AdminDashboardClient.tsx"
click node_adminactions "https://github.com/mazt08/maze_bank/blob/main/actions/admin.ts"
click node_notifications "https://github.com/mazt08/maze_bank/blob/main/actions/notifications.ts"
click node_notificationui "https://github.com/mazt08/maze_bank/blob/main/components/NotificationBell.tsx"
click node_chat "https://github.com/mazt08/maze_bank/blob/main/actions/chat.ts"
click node_chatui "https://github.com/mazt08/maze_bank/blob/main/components/MazeBot.tsx"
click node_firestore "https://github.com/mazt08/maze_bank/blob/main/lib/firestore.ts"
click node_adminsdk "https://github.com/mazt08/maze_bank/blob/main/lib/firebase-admin.ts"
click node_clientauth "https://github.com/mazt08/maze_bank/blob/main/lib/firebase-client.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_authui,node_authactions,node_middleware,node_profile toneBlue
class node_dashboard,node_transferui,node_transferaction,node_transactions,node_analytics,node_analyticsview toneAmber
class node_layout toneMint
class node_adminpage,node_adminui,node_adminactions,node_notifications,node_notificationui,node_chat,node_chatui toneRose
class node_firestore,node_adminsdk,node_clientauth,node_firestoredb,node_firebaseauth,node_customer,node_admin toneIndigo
```

## Components

### Identity and sessions

- [Login and registration](https://github.com/mazt08/maze_bank/blob/main/components/AuthForm.tsx): `components/AuthForm.tsx`
- [Auth and sessions](https://github.com/mazt08/maze_bank/blob/main/actions/auth.ts): `actions/auth.ts`
- [Route protection](https://github.com/mazt08/maze_bank/blob/main/middleware.ts): `middleware.ts`
- [Profile management](https://github.com/mazt08/maze_bank/blob/main/components/ProfileClient.tsx): `components/ProfileClient.tsx`

### Accounts and transfers

- [Account dashboard](https://github.com/mazt08/maze_bank/blob/main/app/dashboard/page.tsx): `app/dashboard/page.tsx`
- [Transfer form](https://github.com/mazt08/maze_bank/blob/main/components/TransferForm.tsx): `components/TransferForm.tsx`
- [Transfer processing](https://github.com/mazt08/maze_bank/blob/main/actions/transfer.ts): `actions/transfer.ts`
- [Transaction history](https://github.com/mazt08/maze_bank/blob/main/app/transactions/page.tsx): `app/transactions/page.tsx`
- [Spending analytics](https://github.com/mazt08/maze_bank/blob/main/app/analytics/page.tsx): `app/analytics/page.tsx`
- [Analytics charts](https://github.com/mazt08/maze_bank/blob/main/components/Analytics.tsx): `components/Analytics.tsx`

### Banking experience

- [Authenticated shell](https://github.com/mazt08/maze_bank/blob/main/components/Layout.tsx): `components/Layout.tsx`

### Administration and engagement

- [Admin console](https://github.com/mazt08/maze_bank/blob/main/app/admin/page.tsx): `app/admin/page.tsx`
- [User management](https://github.com/mazt08/maze_bank/blob/main/components/AdminDashboardClient.tsx): `components/AdminDashboardClient.tsx`
- [Admin actions](https://github.com/mazt08/maze_bank/blob/main/actions/admin.ts): `actions/admin.ts`
- [Notification actions](https://github.com/mazt08/maze_bank/blob/main/actions/notifications.ts): `actions/notifications.ts`
- [Notification bell](https://github.com/mazt08/maze_bank/blob/main/components/NotificationBell.tsx): `components/NotificationBell.tsx`
- [Chatbot actions](https://github.com/mazt08/maze_bank/blob/main/actions/chat.ts): `actions/chat.ts`
- [MazeBot widget](https://github.com/mazt08/maze_bank/blob/main/components/MazeBot.tsx): `components/MazeBot.tsx`

### Firebase services

- [Banking data helpers](https://github.com/mazt08/maze_bank/blob/main/lib/firestore.ts): `lib/firestore.ts`
- [Firebase Admin SDK](https://github.com/mazt08/maze_bank/blob/main/lib/firebase-admin.ts): `lib/firebase-admin.ts`
- [Firebase client auth](https://github.com/mazt08/maze_bank/blob/main/lib/firebase-client.ts): `lib/firebase-client.ts`
- **Firestore**
- **Firebase Authentication**

### Other components

- **Bank customer**
- **Bank administrator**

## Connections

- Bank customer → Login and registration: signs in (evidence: `components/AuthForm.tsx`)
- Login and registration → Firebase client auth: authenticates with (evidence: `components/AuthForm.tsx`)
- Login and registration → Auth and sessions: sets session (evidence: `components/AuthForm.tsx`)
- Login and registration → Auth and sessions: registers account (evidence: `components/AuthForm.tsx`)
- Auth and sessions → Firebase Admin SDK: verifies token (evidence: `actions/auth.ts`)
- Auth and sessions → Banking data helpers: creates user (evidence: `actions/auth.ts`)
- Firebase client auth → Firebase Authentication: authenticates (evidence: `lib/firebase-client.ts`)
- Route protection → Bank customer: checks session
- Bank customer → Account dashboard: views account (evidence: `README.md`)
- Account dashboard → Auth and sessions: reads session (evidence: `app/dashboard/page.tsx`)
- Account dashboard → Banking data helpers: loads account and activity (evidence: `app/dashboard/page.tsx`)
- Account dashboard → Authenticated shell: renders within (evidence: `app/dashboard/page.tsx`)
- Bank customer → Transfer form: initiates transfer (evidence: `README.md`)
- Transfer form → Transfer processing: submits transfer (evidence: `components/TransferForm.tsx`)
- Transfer processing → Banking data helpers: moves funds atomically (evidence: `README.md`)
- Transfer processing → Notification actions: triggers notice (evidence: `actions/transfer.ts`)
- Bank customer → Transaction history: reviews activity (evidence: `README.md`)
- Transaction history → Auth and sessions: reads session (evidence: `app/transactions/page.tsx`)
- Transaction history → Banking data helpers: loads transactions (evidence: `app/transactions/page.tsx`)
- Bank customer → Spending analytics: views insights (evidence: `README.md`)
- Spending analytics → Analytics charts: passes analytics data (evidence: `app/analytics/page.tsx`)
- Spending analytics → Firestore: queries transaction data (evidence: `app/analytics/page.tsx`)
- Bank customer → Profile management: manages profile (evidence: `README.md`)
- Profile management → Auth and sessions: updates display name (evidence: `components/ProfileClient.tsx`)
- Bank administrator → Admin console: manages accounts (evidence: `README.md`)
- Admin console → User management: renders admin tools (evidence: `app/admin/page.tsx`)
- User management → Admin actions: requests user operations (evidence: `components/AdminDashboardClient.tsx`)
- Admin actions → Banking data helpers: reads and updates users (evidence: `actions/admin.ts`)
- Authenticated shell → Auth and sessions: signs out (evidence: `components/Layout.tsx`)
- Authenticated shell → Notification bell: renders bell (evidence: `components/Layout.tsx`)
- Authenticated shell → MazeBot widget: renders chatbot (evidence: `components/Layout.tsx`)
- Notification bell → Notification actions: loads notifications (evidence: `components/NotificationBell.tsx`)
- MazeBot widget → Chatbot actions: sends chat requests (evidence: `components/MazeBot.tsx`)
- Banking data helpers → Firebase Admin SDK: uses (evidence: `lib/firestore.ts`)
- Firebase Admin SDK → Firestore: reads and writes (evidence: `lib/firebase-admin.ts`)
- Firebase Admin SDK → Firebase Authentication: verifies sessions (evidence: `lib/firebase-admin.ts`)
