This project is a backend system for a finance dashboard that manages users, financial records, and analytics with role-based access control.
It demonstrates backend development concepts including API design, data modeling, business logic, authentication, and access control.
- User registration and login using JWT
- Password hashing for security
- Token-based authentication
- Role-based access control (RBAC)
- Create, update, delete users (Admin only)
- Assign roles: Viewer, Analyst, Admin
- Manage user status (active/inactive)
- Create, read, update, delete transactions
- Fields: amount, type, category, date, notes
- Filtering (type, category, date)
- Search functionality
- Pagination support
- Soft delete (logical deletion)
- Total income
- Total expenses
- Net balance
- Category-wise totals
- Recent transactions
- Monthly trends
- Input validation for users and transactions
- Standardized error responses
- Proper HTTP status codes
-
Swagger UI available at:
http://127.0.0.1:5000/apidocs/
- Backend Framework: Flask
- Database: SQLite
- ORM: SQLAlchemy
- Authentication: JWT (PyJWT)
- Password Hashing: Werkzeug
- Environment Variables: python-dotenv
- API Docs: Flasgger (Swagger UI)
finance_backend/
β
βββ app.py
βββ config.py
βββ requirements.txt
βββ README.md
β
βββ database/
β βββ db.py
β
βββ models/
β βββ user_model.py
β βββ transaction_model.py
β
βββ routes/
β βββ auth_routes.py
β βββ user_routes.py
β βββ transaction_routes.py
β βββ dashboard_routes.py
β
βββ services/
β βββ user_service.py
β βββ transaction_service.py
β βββ dashboard_service.py
β
βββ utils/
β βββ auth_utils.py
β βββ validators.py
β βββ error_handler.py
β βββ rate_limiter.py (optional)
β
βββ tests/ (optional)
git clone <your-repo-link>
cd finance_backend
pip install -r requirements.txt
SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///finance.db
python app.py
POST /login
Response:
{
"token": "your_jwt_token"
}
Authorization: Bearer <your_token>
POST /registerPOST /login
GET /users/POST /users/PUT /users/<id>DELETE /users/<id>PATCH /users/<id>/status
POST /transactions/(Admin)GET /transactions/(All)PUT /transactions/<id>(Admin)DELETE /transactions/<id>(Admin)
/transactions?type=expense&category=food
/transactions?page=1&limit=10
/transactions?search=food
GET /dashboard/summaryGET /dashboard/categoryGET /dashboard/recentGET /dashboard/trends
| Role | Permissions |
|---|---|
| Viewer | View dashboard & transactions |
| Analyst | View + analytics |
| Admin | Full control (users + transactions) |
- Authentication is implemented using JWT for simplicity
- SQLite is used for ease of setup
- No frontend is included; APIs are tested via Postman/Swagger
- System is designed for demonstration, not production use
- Refresh tokens
- Advanced role permissions
- Rate limiting
- Unit & integration testing
- Deployment (Docker / Cloud)
This project demonstrates a structured backend system with clean architecture, role-based access control, and scalable design.
It focuses on correctness, clarity, and maintainability as required by the assignment.
example snapshots if the render link doesnt work to show swagger api documentation are under /screenshots folder
Harshikaa lasya
