A production-style backend system that simulates how real-world banking applications work — including authentication, account management, transactions, and ledger-based accounting.
This project is designed to help you understand:
- How secure authentication works in banking systems
- How accounts are managed and validated
- How transactions (credit/debit) are processed safely
- How ledger systems ensure consistency and traceability
- How real-world backend architecture is structured
👉 https://advance-backend-ledger.onrender.com
- JWT-based authentication
- Secure login & registration
- Token blacklist system (with TTL index)
- Protected routes using middleware
- Create and manage user accounts
- Account status handling (ACTIVE / INACTIVE / BLOCKED)
- Balance management
-
Transfer money between accounts
-
Idempotency key support (prevents duplicate transactions)
-
Transaction status handling:
- PENDING
- COMPLETED
- FAILED
- REVERSED
-
Every transaction recorded as:
- DEBIT entry (sender)
- CREDIT entry (receiver)
-
Ensures:
- Auditability
- Data consistency
- Financial traceability
- MongoDB Transactions (ACID compliance)
- Atomic balance updates
- Prevention of race conditions
Client → API (Express)
↓
Controllers
↓
Services
↓
Models (Mongoose)
↓
MongoDB
- User sends transaction request
- Validate request (accounts, amount, idempotency key)
- Check for duplicate transaction
- Start database transaction (session)
- Debit sender account
- Credit receiver account
- Create ledger entries
- Mark transaction as COMPLETED
- Commit transaction
- Send notification/email
- JWT verification middleware
- Token blacklist with auto-expiry
- Idempotency protection
- Input validation
- Account status verification
project-root/
│
├── controllers/ # Request handlers
├── models/ # Mongoose schemas
├── routes/ # API routes
├── middlewares/ # Auth & validation
├── services/ # Business logic
├── utils/ # Helper functions
├── config/ # DB & environment config
└── server.js # Entry point
- Node.js
- Express.js
- MongoDB
- Mongoose
- JWT (Authentication)
# Clone the repository
https://github.com/yeasin-riyad/Advance-Backend-Ledger.git
# Install dependencies
npm install
# Run server
npm run devCreate a .env file:
PORT=5000
MONGO_URI=your_mongodb_connection
JWT_SECRET=your_secret_key
POST /api/transactions{
"fromAccount": "accountId1",
"toAccount": "accountId2",
"amount": 1000,
"idempotencyKey": "unique-key-123"
}
- Idempotency in financial systems
- Ledger-based accounting
- ACID transactions in MongoDB
- TTL Index (auto cleanup)
- Secure token handling
- Redis caching & distributed locks
- Message queue (BullMQ / RabbitMQ)
- Microservices architecture
- Fraud detection system
- Rate limiting