A Role-Based Access Control (RBAC) Banking System built using Flask. This project demonstrates secure authentication, authorization, and controlled resource access inside a banking-style application.
It includes:
- JWT authentication
- Role-based permissions
- Account management
- Transaction handling
- Admin controls
- Audit logging
- Modern dashboard UI
This project is ideal for learning access control systems, backend security, and full-stack Flask applications.
- JWT-based authentication
- Password hashing using bcrypt
- Session expiration
- Protected API routes
- Account freeze protection
The system supports multiple roles with different permissions:
| Role | Description |
|---|---|
| Super Admin | Full system control |
| Bank Manager | User & branch management |
| Teller | Process transactions |
| Auditor | Read-only audit access |
| Customer | Personal account access |
Permissions include:
- View accounts
- Manage users
- Process transactions
- Freeze accounts
- Approve loans
- View reports
- Access audit logs
- User registration & login
- Account balance tracking
- Money transfer between accounts
- Transaction history
- Loan approval simulation
- Account freezing/unfreezing
- Add users
- Delete users
- Change roles
- Freeze accounts
- View all accounts
- View audit logs
- Real-time stats
- Transaction records
- Role-based UI views
- Activity logs
- Account overview
project/
│
├── app.py # Main Flask application
└── README.md # Project documentation
Everything (backend + frontend UI) runs from a single file.
git clone <your-repo-url>
cd <repo-name>pip install flask flask-cors bcrypt pyjwtpython app.pyServer runs on:
http://localhost:5000
The system comes with seeded users:
| Username | Password | Role |
|---|---|---|
| superadmin | super123 | Super Admin |
| manager1 | mgr123 | Bank Manager |
| teller1 | teller123 | Teller |
| auditor1 | audit123 | Auditor |
| alice | alice123 | Customer |
| bob | bob123 | Customer |
| carol | carol123 | Customer |
Use these for testing.
POST /api/login→ LoginPOST /api/register→ Register new user
GET /api/me→ User profileGET /api/my-account→ Account detailsGET /api/stats→ Dashboard stats
POST /api/transfer→ Transfer moneyGET /api/transactions→ All transactions
POST /api/admin/add-userPOST /api/admin/delete-userPOST /api/admin/change-rolePOST /api/freeze-account
GET /api/audit-logsGET /api/loan-applicationsPOST /api/approve-loan
- User logs in → receives JWT token
- Token is sent in request header:
Authorization: Bearer <token>
-
Server verifies:
- Token validity
- User role
- Required permissions
-
Access granted or denied accordingly.
This project demonstrates:
- Role-Based Access Control (RBAC)
- Secure authentication with JWT
- Password hashing
- API authorization middleware
- Backend security patterns
- Flask full-stack architecture
- Uses in-memory storage (data resets when server restarts)
- Designed for learning/demo purposes
- Not production-ready
- Database integration (PostgreSQL / MongoDB)
- Persistent audit logs
- Email verification
- Rate limiting
- Multi-factor authentication
- Production deployment setup