Banking MongoDB (Mongoose) Schema
A detailed look at the MongoDB schema for a modern banking application.
Installation Guide
To add these schemas to your project, run:
npx servercn-cli@latest add schema banking-app 1. User Schema
The User schema stores essential information about the customer. This includes personal details and security credentials.
MVC Path: src/models/user.model.ts
Feature Path: src/modules/auth/user.model.ts
Installation
npx servercn-cli@latest add schema banking-app/user 2. Account Schema
The Account schema stores user bank accounts (e.g., savings, current). A user can own multiple accounts with different types, currencies, and statuses.
MVC Path: src/models/account.model.ts
Feature Path: src/modules/account/account.model.ts
Installation
npx servercn-cli@latest add schema banking-app/account 3. Transaction Schema
The Transaction schema records money movements between accounts, including transfers, deposits, and withdrawals.
MVC Path: src/models/transaction.model.ts
Feature Path: src/modules/transaction/transaction.model.ts
Installation
npx servercn-cli@latest add schema banking-app/transaction 5. Ledger Schema
The Ledger schema records all financial movements such as deposits, withdrawals, and transfers. Each entry represents a finalized financial event.
Ledger entries are immutable. All update and delete operations are blocked to preserve audit integrity.
Path
- MVC:
src/models/ledger.model.ts - Feature:
src/modules/ledger/ledger.model.ts
Installation
npx servercn-cli@latest add schema banking-app/ledger Notes:
- Ledger entries are immutable
- All update and delete operations are blocked to preserve audit integrity