How thinakaranmanokaran/bank_management works
Project Type & Purpose
This is a full-stack banking management web application with three user roles (public, user, employee, admin) and face-authentication.
– Frontend: React SPA built with Vite, loads face-API models in the browser for client-side authentication.
– Backend: Node.js/Express REST API with MVC organization (routes → controllers → models), uses JWT and face recognition middleware, persists data via a database.
File Structure
– client/: React code (src/, public/models)
• src/pages/*.jsx – UI pages per role
• src/components/ – reusable components (global, user, employee, admin)
• src/contexts/ – React Contexts for state (AccountContext, BalanceContext, etc.)
• public/models/ – TensorFlow.js/face-api.js model shards & manifests
– server/: Express app
• routes/ (adminRoutes.js, userRoutes.js)
• controllers/ (one folder per role & global)
• models/ (database schemas, face model files)
• middlewares/ (authentication, faceAuth, role-based)
• config/ (db.js, dotenv)
• utils/ (JWT helper, password hashes, accountNo generator)
• server.js – application entry point
Key README Insight
Minimal README (“# Bank_Management”), so rely on file names and folder structure to infer features:
• FaceAuthentication in public pages & controllers
• Role-based dashboards and actions (deposit, loan, transactions)
Main Components
A. Frontend (Browser)
• React SPA (Vite dev/build)
• Loads face-API models from public/models for client-side faceAuth
• Components & Context API manage UI, state, routing
B. Backend (API Server)
• Express.js with route modules for public, user, employee, admin
• Controllers implement business logic (Authentication, FaceAuth, Account, Deposit, Loan, etc.)
• Middlewares enforce JWT auth and face-based checks
C. Database
• Persistent store (e.g., MongoDB or SQL) defined in server/models & accessed via config/db.js
• Collections/tables: Users, Employees, Admin, Accounts, Transactions, Loans, Notifications
D. External/Internal Services
• face-api.js models (client & server) for face detection/recognition
• JWT service for token issuance/validation
Component Interactions
1) User ↔ Browser: UI interactions (login, register, face scan)
2) Browser ↔ Backend: REST calls (HTTP/HTTPS) to /api/public, /api/user, /api/employee, /api/admin
• Tokens in Authorization header
• face-auth endpoint for image/frame payload
3) Backend ↔ DB: CRUD operations for accounts, transactions, profiles, loans
4) Backend ↔ face-API models: load models (server/models/global/facemodels) for server-side checks if any
Architectural Patterns & Design Principles
– MVC on the server (routes → controllers → models)
– Layered architecture (presentation, application, domain, persistence)
– Context/state management on frontend (React Context)
– Separation of concerns (faceAuth handled via dedicated middleware & controllers)
– RESTful API design with JWT security
Frontend: React, Vite, React Router, Context API, face-api.js, TensorFlow.js
Backend: Node.js, Express.js, dotenv, JWT, bcrypt (passwordHelper), custom utils
DB: MongoDB or relational (via server/config/db.js)
Models: face-api model shards & manifests