# saswatbarai/finboard architecture

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

- Interactive diagram: https://gitdiagram.com/saswatbarai/finboard
- Repository: https://github.com/saswatbarai/finboard

## Overview

Finboard is a demo fintech platform. Users register and verify by OTP, submit identity documents for KYC/OCR review, verify a simulated bank account, then invest and view portfolio activity; administrators review KYC and manage banking. The Next.js feature modules call the API gateway, which routes requests to domain services. Services also use shared contracts and event infrastructure for cross-service work. The README documents these product flows and major domains; some inter-service links below are documented rather than demonstrated in the sampled excerpts.

Main entry points: [`services/api-gateway/src/app.js`](https://github.com/saswatbarai/finboard/blob/main/services/api-gateway/src/app.js) (API gateway), [`apps/customer-web/src/features`](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features) (Web application), [`services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`](https://github.com/saswatbarai/finboard/blob/main/services/kyc-service/src/modules/kyc/controllers/kyc.controller.js) (KYC applications), [`services/investment-service/src/modules/investment/routes/investment.routes.js`](https://github.com/saswatbarai/finboard/blob/main/services/investment-service/src/modules/investment/routes/investment.routes.js) (Investment orders)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Customer web"]
  node_web["Web application"]
  node_authui["Sign-in and signup"]
  node_kycui["KYC submission"]
  node_bankui["Banking workspace"]
  node_investui["Portfolio and stocks"]
  node_adminui["Admin review"]
end

subgraph group_edge["API routing"]
  node_gateway["API gateway<br/>[app.js]"]
end

subgraph group_identity["Identity and KYC"]
  node_auth["Authentication<br/>[auth.controller.js]"]
  node_profile["Investor profile"]
  node_kyc["KYC applications<br/>[kyc.controller.js]"]
  node_ocr["Document OCR<br/>[ocr.service.js]"]
end

subgraph group_finance["Finance services"]
  node_banking["Banking simulation"]
  node_bankservice["Banking operations<br/>[banking.service.js]"]
  node_investment["Investment orders"]
  node_portfolio[("Portfolio holdings")]
end

subgraph group_platform["Shared platform"]
  node_storage["KYC document storage"]
  node_notification["Notifications"]
  node_audit["Audit log<br/>[audit.service.js]"]
  node_kafka["Kafka events<br/>[producer.js]"]
  node_contracts["Service contracts<br/>[auth-client.js]"]
  node_mongo[("MongoDB")]
  node_postgres[("PostgreSQL")]
  node_objectstore[("Object storage")]
end

node_user(("Investor"))

node_user -->|"uses"| node_web
node_web -->|"offers"| node_authui
node_web -->|"offers"| node_kycui
node_web -->|"offers"| node_bankui
node_web -->|"offers"| node_investui
node_web -->|"offers"| node_adminui
node_authui -->|"requests"| node_gateway
node_kycui -->|"requests"| node_gateway
node_bankui -->|"requests"| node_gateway
node_investui -->|"requests"| node_gateway
node_adminui -->|"requests"| node_gateway
node_gateway -->|"proxies"| node_auth
node_gateway -->|"proxies"| node_profile
node_gateway -->|"proxies"| node_kyc
node_gateway -->|"proxies"| node_ocr
node_gateway -->|"proxies"| node_banking
node_gateway -->|"proxies"| node_investment
node_gateway -->|"proxies"| node_notification
node_auth -->|"creates profile"| node_profile
node_kyc -->|"requests extraction"| node_ocr
node_kyc -->|"updates status"| node_profile
node_kyc -->|"persists documents"| node_storage
node_storage -->|"uploads files"| node_objectstore
node_banking -->|"calls"| node_bankservice
node_banking -->|"publishes event"| node_kafka
node_investment -->|"creates holdings"| node_portfolio
node_investment -->|"checks KYC"| node_profile
node_investment -->|"checks linked bank"| node_banking
node_investment -->|"publishes events"| node_kafka
node_kyc -->|"publishes events"| node_kafka
node_kafka -.->|"delivers events"| node_notification
node_kafka -.->|"delivers events"| node_audit
node_auth -.->|"stores users"| node_mongo
node_profile -.->|"stores profiles"| node_mongo
node_kyc -.->|"stores applications"| node_mongo
node_portfolio -.->|"stores holdings"| node_mongo
node_bankservice -.->|"stores accounts"| node_postgres
node_contracts -->|"calls internal API"| node_auth

click node_web "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features"
click node_authui "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/auth/screens"
click node_kycui "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/kyc/screens"
click node_bankui "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/banking/screens"
click node_investui "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/investments/screens"
click node_adminui "https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/admin"
click node_gateway "https://github.com/saswatbarai/finboard/blob/main/services/api-gateway/src/app.js"
click node_auth "https://github.com/saswatbarai/finboard/blob/main/services/auth-service/src/modules/auth/controllers/auth.controller.js"
click node_profile "https://github.com/saswatbarai/finboard/blob/main/services/profile-service/src/modules/profile/controllers/profile.controller.js"
click node_kyc "https://github.com/saswatbarai/finboard/blob/main/services/kyc-service/src/modules/kyc/controllers/kyc.controller.js"
click node_ocr "https://github.com/saswatbarai/finboard/blob/main/services/ocr-service/src/modules/ocr/services/ocr.service.js"
click node_storage "https://github.com/saswatbarai/finboard/blob/main/services/kyc-service/src/modules/kyc/services/document-storage.service.js"
click node_banking "https://github.com/saswatbarai/finboard/blob/main/services/banking-service/src/modules/banking/controllers/banking.controller.js"
click node_bankservice "https://github.com/saswatbarai/finboard/blob/main/services/banking-service/src/modules/banking/services/banking.service.js"
click node_investment "https://github.com/saswatbarai/finboard/blob/main/services/investment-service/src/modules/investment/routes/investment.routes.js"
click node_portfolio "https://github.com/saswatbarai/finboard/blob/main/services/investment-service/src/modules/investment/models/portfolio-holding.model.js"
click node_notification "https://github.com/saswatbarai/finboard/blob/main/services/notification-service/src/modules/notification/routes/notification.routes.js"
click node_audit "https://github.com/saswatbarai/finboard/blob/main/services/audit-service/src/modules/audit/services/audit.service.js"
click node_kafka "https://github.com/saswatbarai/finboard/blob/main/packages/kafka/src/producer.js"
click node_contracts "https://github.com/saswatbarai/finboard/blob/main/packages/contracts/src/clients/auth-client.js"

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_web,node_authui,node_kycui,node_bankui,node_investui,node_adminui toneBlue
class node_gateway toneAmber
class node_auth,node_profile,node_kyc,node_ocr toneMint
class node_banking,node_bankservice,node_investment,node_portfolio toneRose
class node_storage,node_notification,node_audit,node_kafka,node_contracts,node_mongo,node_postgres,node_objectstore,node_user toneIndigo
```

## Components

### Customer web

- [Web application](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features): `apps/customer-web/src/features`
- [Sign-in and signup](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/auth/screens): `apps/customer-web/src/features/auth/screens`
- [KYC submission](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/kyc/screens): `apps/customer-web/src/features/kyc/screens`
- [Banking workspace](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/banking/screens): `apps/customer-web/src/features/banking/screens`
- [Portfolio and stocks](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/investments/screens): `apps/customer-web/src/features/investments/screens`
- [Admin review](https://github.com/saswatbarai/finboard/tree/main/apps/customer-web/src/features/admin): `apps/customer-web/src/features/admin`

### API routing

- [API gateway](https://github.com/saswatbarai/finboard/blob/main/services/api-gateway/src/app.js): `services/api-gateway/src/app.js`

### Identity and KYC

- [Authentication](https://github.com/saswatbarai/finboard/blob/main/services/auth-service/src/modules/auth/controllers/auth.controller.js): `services/auth-service/src/modules/auth/controllers/auth.controller.js`
- [Investor profile](https://github.com/saswatbarai/finboard/blob/main/services/profile-service/src/modules/profile/controllers/profile.controller.js): `services/profile-service/src/modules/profile/controllers/profile.controller.js`
- [KYC applications](https://github.com/saswatbarai/finboard/blob/main/services/kyc-service/src/modules/kyc/controllers/kyc.controller.js): `services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`
- [Document OCR](https://github.com/saswatbarai/finboard/blob/main/services/ocr-service/src/modules/ocr/services/ocr.service.js): `services/ocr-service/src/modules/ocr/services/ocr.service.js`

### Finance services

- [Banking simulation](https://github.com/saswatbarai/finboard/blob/main/services/banking-service/src/modules/banking/controllers/banking.controller.js): `services/banking-service/src/modules/banking/controllers/banking.controller.js`
- [Banking operations](https://github.com/saswatbarai/finboard/blob/main/services/banking-service/src/modules/banking/services/banking.service.js): `services/banking-service/src/modules/banking/services/banking.service.js`
- [Investment orders](https://github.com/saswatbarai/finboard/blob/main/services/investment-service/src/modules/investment/routes/investment.routes.js): `services/investment-service/src/modules/investment/routes/investment.routes.js`
- [Portfolio holdings](https://github.com/saswatbarai/finboard/blob/main/services/investment-service/src/modules/investment/models/portfolio-holding.model.js): `services/investment-service/src/modules/investment/models/portfolio-holding.model.js`

### Shared platform

- [KYC document storage](https://github.com/saswatbarai/finboard/blob/main/services/kyc-service/src/modules/kyc/services/document-storage.service.js): `services/kyc-service/src/modules/kyc/services/document-storage.service.js`
- [Notifications](https://github.com/saswatbarai/finboard/blob/main/services/notification-service/src/modules/notification/routes/notification.routes.js): `services/notification-service/src/modules/notification/routes/notification.routes.js`
- [Audit log](https://github.com/saswatbarai/finboard/blob/main/services/audit-service/src/modules/audit/services/audit.service.js): `services/audit-service/src/modules/audit/services/audit.service.js`
- [Kafka events](https://github.com/saswatbarai/finboard/blob/main/packages/kafka/src/producer.js): `packages/kafka/src/producer.js`
- [Service contracts](https://github.com/saswatbarai/finboard/blob/main/packages/contracts/src/clients/auth-client.js): `packages/contracts/src/clients/auth-client.js`
- **MongoDB**
- **PostgreSQL**
- **Object storage**

### Other components

- **Investor**

## Connections

- Investor → Web application: uses (evidence: `README.md`)
- Web application → Sign-in and signup: offers (evidence: `README.md`)
- Web application → KYC submission: offers (evidence: `README.md`)
- Web application → Banking workspace: offers (evidence: `README.md`)
- Web application → Portfolio and stocks: offers (evidence: `README.md`)
- Web application → Admin review: offers (evidence: `README.md`)
- Sign-in and signup → API gateway: requests (evidence: `README.md`)
- KYC submission → API gateway: requests (evidence: `README.md`)
- Banking workspace → API gateway: requests (evidence: `README.md`)
- Portfolio and stocks → API gateway: requests (evidence: `README.md`)
- Admin review → API gateway: requests (evidence: `README.md`)
- API gateway → Authentication: proxies (evidence: `services/api-gateway/src/app.js`)
- API gateway → Investor profile: proxies (evidence: `services/api-gateway/src/app.js`)
- API gateway → KYC applications: proxies (evidence: `services/api-gateway/src/app.js`)
- API gateway → Document OCR: proxies (evidence: `README.md`)
- API gateway → Banking simulation: proxies (evidence: `README.md`)
- API gateway → Investment orders: proxies (evidence: `README.md`)
- API gateway → Notifications: proxies (evidence: `README.md`)
- Authentication → Investor profile: creates profile (evidence: `services/auth-service/src/modules/auth/controllers/auth.controller.js`)
- KYC applications → Document OCR: requests extraction (evidence: `services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`)
- KYC applications → Investor profile: updates status (evidence: `services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`)
- KYC applications → KYC document storage: persists documents (evidence: `services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`)
- KYC document storage → Object storage: uploads files (evidence: `services/kyc-service/src/modules/kyc/services/document-storage.service.js`)
- Banking simulation → Banking operations: calls (evidence: `services/banking-service/src/modules/banking/controllers/banking.controller.js`)
- Banking simulation → Kafka events: publishes event (evidence: `services/banking-service/src/modules/banking/controllers/banking.controller.js`)
- Investment orders → Portfolio holdings: creates holdings (evidence: `services/investment-service/src/modules/investment/routes/investment.routes.js`)
- Investment orders → Investor profile: checks KYC (evidence: `services/investment-service/src/modules/investment/routes/investment.routes.js`)
- Investment orders → Banking simulation: checks linked bank (evidence: `services/investment-service/src/modules/investment/routes/investment.routes.js`)
- Investment orders → Kafka events: publishes events (evidence: `services/investment-service/src/modules/investment/routes/investment.routes.js`)
- KYC applications → Kafka events: publishes events (evidence: `services/kyc-service/src/modules/kyc/controllers/kyc.controller.js`)
- Kafka events → Notifications: delivers events (evidence: `README.md`)
- Kafka events → Audit log: delivers events (evidence: `README.md`)
- Authentication → MongoDB: stores users (evidence: `README.md`)
- Investor profile → MongoDB: stores profiles (evidence: `README.md`)
- KYC applications → MongoDB: stores applications (evidence: `README.md`)
- Portfolio holdings → MongoDB: stores holdings (evidence: `README.md`)
- Banking operations → PostgreSQL: stores accounts (evidence: `README.md`)
- Service contracts → Authentication: calls internal API (evidence: `packages/contracts/src/clients/auth-client.js`)
