How sakincse21/digital-banking-system works
Project type and purpose
• This is a backend-only, full-stack API for a digital wallet/banking system built with Node.js, Express.js, TypeScript, and MongoDB (Mongoose).
• It exposes role-based REST endpoints for users, agents, and admins to register, authenticate, manage wallets, and process transactions atomically.
File structure
• Top-level:
• src/app: contains all application layers (config, errorHelpers, interface, middlewares, modules, routes, utils)
• src/app/modules: feature folders (auth, user, wallet, transaction) each with route, controller, service, model, validation, constants
• src/server.ts & src/app.ts: entry points—setup Express app, middleware, error handling, route mounting
• dist/: compiled output mirroring src structure
• Config files: .env.example, tsconfig.json, vercel.json, postman-config.json
• Patterns:
• Layered (Router → Controller → Service → Model), error-handling middleware, validation, JWT-based auth, Mongoose sessions for atomic transactions
README for additional insights
• Features: JWT auth, bcrypt password hashing, role checks, transaction statuses, atomic operations
• ERD: shows relationships between User, Wallet, Transaction
• Modules and endpoints mapping
Elements
• Clear labels:
• “Client” (Web/Mobile)
• “Express App” with sub-blocks: Config, Middlewares, Routes, Controllers, Services, Models
• “JWT & bcrypt” as external utility services
• Data flow from Client → Express → MongoDB → Express → Client
• Rectangles for layers (blue for Routes, green for Services, orange for Models)
Detail
• Feature module (Auth, User, Wallet, Transaction) as its own sub-component in the Services layer
• Error-handling chain: catchAsync → globalErrorHandler
• Validation layer invoking Zod or Joi validators
• Mongoose session transactions in the Transaction service