# 7immin/finmate architecture

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

- Interactive diagram: https://gitdiagram.com/7immin/finmate
- Repository: https://github.com/7immin/finmate

## Overview

FinMate is a financial app for international students in Korea. Users sign up, complete onboarding, then submit documents or complete purpose-based payment flows to raise transfer limits and build a shareable financial passport. The graph also preserves the documented AI, fraud-screening, university-notice, and bank-report capabilities. Several page and API implementations were not sampled; those nodes reflect README-described capabilities, and their links are cited to that documentation rather than inferred from filenames.

Main entry points: [`lib/server/passport.ts`](https://github.com/7immin/finmate/blob/main/lib/server/passport.ts) (Passport Rules), [`app/verify/[code]/page.tsx`](https://github.com/7immin/finmate/blob/main/app/verify/%5Bcode%5D/page.tsx) (Public Bank Report), [`app/api/passport/verify/route.ts`](https://github.com/7immin/finmate/blob/main/app/api/passport/verify/route.ts) (Document Verification), [`app/signup/page.tsx`](https://github.com/7immin/finmate/blob/main/app/signup/page.tsx) (Sign Up / Login)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access and State"]
  node_auth["Sign Up / Login<br/>[page.tsx]"]
  node_onboarding["Profile Onboarding<br/>[OnboardingForm.tsx]"]
  node_appstate["App State"]
  node_state_loader["Initial State<br/>[state.ts]"]
  node_supabase[("Supabase")]
  node_home["Home Dashboard<br/>[page.tsx]"]
end

subgraph group_finance["Financial Passport"]
  node_passport["Financial Passport<br/>[page.tsx]"]
  node_passport_rules["Passport Rules<br/>[passport.ts]"]
  node_document_verify["Document Verification<br/>[route.ts]"]
  node_ocr["Document OCR<br/>[ocr.ts]"]
end

subgraph group_payments["Purpose Flows"]
  node_tuition["Tuition Payment<br/>[page.tsx]"]
  node_remittance["International Remittance<br/>[page.tsx]"]
  node_account["Bank Account Setup<br/>[page.tsx]"]
  node_deposit["Rental Deposit<br/>[page.tsx]"]
end

subgraph group_assistance["Guidance and Safety"]
  node_ai_chat["FinMate AI<br/>[route.ts]"]
  node_shield["Fraud Screening<br/>[route.ts]"]
  node_notice["University Notices<br/>[page.tsx]"]
  node_notice_service["Notice Retrieval<br/>[route.ts]"]
end

subgraph group_reporting["Bank Reporting"]
  node_bank_report["Public Bank Report<br/>[page.tsx]"]
  node_report_view["Report View<br/>[ReportView.tsx]"]
end

node_student(("Student"))
node_gemini{{"Google Gemini"}}

node_student -->|"signs up"| node_auth
node_auth -->|"continues to"| node_onboarding
node_onboarding -->|"creates profile"| node_supabase
node_student -->|"uses app"| node_home
node_state_loader -->|"loads state"| node_supabase
node_home -.->|"reads state"| node_appstate
node_appstate -->|"syncs user data"| node_supabase
node_student -->|"submits tuition proof"| node_tuition
node_student -->|"requests transfer"| node_remittance
node_student -->|"prepares account"| node_account
node_student -->|"checks rental"| node_deposit
node_tuition -.->|"raises limit"| node_passport_rules
node_remittance -.->|"checks limit"| node_passport_rules
node_account -.->|"builds readiness"| node_passport
node_deposit -.->|"submits evidence"| node_passport_rules
node_student -->|"reviews progress"| node_passport
node_document_verify -->|"extracts document data"| node_ocr
node_document_verify -->|"completes checklist"| node_passport_rules
node_passport_rules -->|"reads and updates"| node_supabase
node_student -->|"asks questions"| node_ai_chat
node_ai_chat -->|"generates response"| node_gemini
node_student -->|"checks suspicious message"| node_shield
node_student -->|"views schedules"| node_notice
node_notice -.->|"fetches notices"| node_notice_service
node_student -->|"shares verification code"| node_bank_report
node_bank_report -->|"loads report data"| node_supabase
node_bank_report -->|"renders report"| node_report_view

click node_auth "https://github.com/7immin/finmate/blob/main/app/signup/page.tsx"
click node_onboarding "https://github.com/7immin/finmate/blob/main/components/flows/onboarding/OnboardingForm.tsx"
click node_appstate "https://github.com/7immin/finmate/blob/main/lib/state/AppStateContext.tsx"
click node_state_loader "https://github.com/7immin/finmate/blob/main/lib/server/state.ts"
click node_home "https://github.com/7immin/finmate/blob/main/app/(app)/home/page.tsx"
click node_passport "https://github.com/7immin/finmate/blob/main/app/(app)/passport/page.tsx"
click node_passport_rules "https://github.com/7immin/finmate/blob/main/lib/server/passport.ts"
click node_document_verify "https://github.com/7immin/finmate/blob/main/app/api/passport/verify/route.ts"
click node_ocr "https://github.com/7immin/finmate/blob/main/lib/ai/ocr.ts"
click node_tuition "https://github.com/7immin/finmate/blob/main/app/(app)/tuition/page.tsx"
click node_remittance "https://github.com/7immin/finmate/blob/main/app/(app)/remittance/page.tsx"
click node_account "https://github.com/7immin/finmate/blob/main/app/(app)/account/page.tsx"
click node_deposit "https://github.com/7immin/finmate/blob/main/app/(app)/deposit/page.tsx"
click node_ai_chat "https://github.com/7immin/finmate/blob/main/app/api/ai/chat/route.ts"
click node_shield "https://github.com/7immin/finmate/blob/main/app/api/shield/route.ts"
click node_notice "https://github.com/7immin/finmate/blob/main/app/(app)/notice/page.tsx"
click node_notice_service "https://github.com/7immin/finmate/blob/main/app/api/notice/route.ts"
click node_bank_report "https://github.com/7immin/finmate/blob/main/app/verify/%5Bcode%5D/page.tsx"
click node_report_view "https://github.com/7immin/finmate/blob/main/components/flows/passport/ReportView.tsx"

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_auth,node_onboarding,node_appstate,node_state_loader,node_supabase,node_home toneBlue
class node_passport,node_passport_rules,node_document_verify,node_ocr toneAmber
class node_tuition,node_remittance,node_account,node_deposit toneMint
class node_ai_chat,node_shield,node_notice,node_notice_service toneRose
class node_bank_report,node_report_view,node_student,node_gemini toneIndigo
```

## Components

### Access and State

- [Sign Up / Login](https://github.com/7immin/finmate/blob/main/app/signup/page.tsx): `app/signup/page.tsx`
- [Profile Onboarding](https://github.com/7immin/finmate/blob/main/components/flows/onboarding/OnboardingForm.tsx): `components/flows/onboarding/OnboardingForm.tsx`
- [App State](https://github.com/7immin/finmate/blob/main/lib/state/AppStateContext.tsx): `lib/state/AppStateContext.tsx`
- [Initial State](https://github.com/7immin/finmate/blob/main/lib/server/state.ts): `lib/server/state.ts`
- **Supabase**
- [Home Dashboard](https://github.com/7immin/finmate/blob/main/app/(app)/home/page.tsx): `app/(app)/home/page.tsx`

### Financial Passport

- [Financial Passport](https://github.com/7immin/finmate/blob/main/app/(app)/passport/page.tsx): `app/(app)/passport/page.tsx`
- [Passport Rules](https://github.com/7immin/finmate/blob/main/lib/server/passport.ts): `lib/server/passport.ts`
- [Document Verification](https://github.com/7immin/finmate/blob/main/app/api/passport/verify/route.ts): `app/api/passport/verify/route.ts`
- [Document OCR](https://github.com/7immin/finmate/blob/main/lib/ai/ocr.ts): `lib/ai/ocr.ts`

### Purpose Flows

- [Tuition Payment](https://github.com/7immin/finmate/blob/main/app/(app)/tuition/page.tsx): `app/(app)/tuition/page.tsx`
- [International Remittance](https://github.com/7immin/finmate/blob/main/app/(app)/remittance/page.tsx): `app/(app)/remittance/page.tsx`
- [Bank Account Setup](https://github.com/7immin/finmate/blob/main/app/(app)/account/page.tsx): `app/(app)/account/page.tsx`
- [Rental Deposit](https://github.com/7immin/finmate/blob/main/app/(app)/deposit/page.tsx): `app/(app)/deposit/page.tsx`

### Guidance and Safety

- [FinMate AI](https://github.com/7immin/finmate/blob/main/app/api/ai/chat/route.ts): `app/api/ai/chat/route.ts`
- [Fraud Screening](https://github.com/7immin/finmate/blob/main/app/api/shield/route.ts): `app/api/shield/route.ts`
- [University Notices](https://github.com/7immin/finmate/blob/main/app/(app)/notice/page.tsx): `app/(app)/notice/page.tsx`
- [Notice Retrieval](https://github.com/7immin/finmate/blob/main/app/api/notice/route.ts): `app/api/notice/route.ts`

### Bank Reporting

- [Public Bank Report](https://github.com/7immin/finmate/blob/main/app/verify/%5Bcode%5D/page.tsx): `app/verify/[code]/page.tsx`
- [Report View](https://github.com/7immin/finmate/blob/main/components/flows/passport/ReportView.tsx): `components/flows/passport/ReportView.tsx`

### Other components

- **Student**
- **Google Gemini**

## Connections

- Student → Sign Up / Login: signs up (evidence: `README.md`)
- Sign Up / Login → Profile Onboarding: continues to (evidence: `README.md`)
- Profile Onboarding → Supabase: creates profile (evidence: `README.md`)
- Student → Home Dashboard: uses app (evidence: `README.md`)
- Initial State → Supabase: loads state (evidence: `lib/server/state.ts`)
- Home Dashboard → App State: reads state
- App State → Supabase: syncs user data (evidence: `lib/state/AppStateContext.tsx`)
- Student → Tuition Payment: submits tuition proof (evidence: `README.md`)
- Student → International Remittance: requests transfer (evidence: `README.md`)
- Student → Bank Account Setup: prepares account (evidence: `README.md`)
- Student → Rental Deposit: checks rental (evidence: `README.md`)
- Tuition Payment → Passport Rules: raises limit (evidence: `README.md`)
- International Remittance → Passport Rules: checks limit (evidence: `README.md`)
- Bank Account Setup → Financial Passport: builds readiness (evidence: `README.md`)
- Rental Deposit → Passport Rules: submits evidence (evidence: `README.md`)
- Student → Financial Passport: reviews progress (evidence: `README.md`)
- Document Verification → Document OCR: extracts document data (evidence: `app/api/passport/verify/route.ts`)
- Document Verification → Passport Rules: completes checklist (evidence: `app/api/passport/verify/route.ts`)
- Passport Rules → Supabase: reads and updates (evidence: `lib/server/passport.ts`)
- Student → FinMate AI: asks questions (evidence: `README.md`)
- FinMate AI → Google Gemini: generates response (evidence: `README.md`)
- Student → Fraud Screening: checks suspicious message (evidence: `README.md`)
- Student → University Notices: views schedules (evidence: `README.md`)
- University Notices → Notice Retrieval: fetches notices
- Student → Public Bank Report: shares verification code (evidence: `README.md`)
- Public Bank Report → Supabase: loads report data (evidence: `README.md`)
- Public Bank Report → Report View: renders report (evidence: `app/verify/[code]/page.tsx`)
