Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Finance Data Processing & Access Control Backend

πŸ“Œ Overview

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.


πŸš€ Features

πŸ” Authentication & Authorization

  • User registration and login using JWT
  • Password hashing for security
  • Token-based authentication
  • Role-based access control (RBAC)

πŸ‘€ User & Role Management

  • Create, update, delete users (Admin only)
  • Assign roles: Viewer, Analyst, Admin
  • Manage user status (active/inactive)

πŸ’° Financial Records Management

  • Create, read, update, delete transactions
  • Fields: amount, type, category, date, notes
  • Filtering (type, category, date)
  • Search functionality
  • Pagination support
  • Soft delete (logical deletion)

πŸ“Š Dashboard APIs

  • Total income
  • Total expenses
  • Net balance
  • Category-wise totals
  • Recent transactions
  • Monthly trends

βš™οΈ Validation & Error Handling

  • Input validation for users and transactions
  • Standardized error responses
  • Proper HTTP status codes

πŸ“˜ API Documentation

  • Swagger UI available at:

    http://127.0.0.1:5000/apidocs/
    

πŸ›  Tech Stack

  • Backend Framework: Flask
  • Database: SQLite
  • ORM: SQLAlchemy
  • Authentication: JWT (PyJWT)
  • Password Hashing: Werkzeug
  • Environment Variables: python-dotenv
  • API Docs: Flasgger (Swagger UI)

πŸ“ Project Structure

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)

βš™οΈ Setup Instructions

1. Clone the repository

git clone <your-repo-link>
cd finance_backend

2. Install dependencies

pip install -r requirements.txt

3. Create .env file

SECRET_KEY=your_secret_key
DATABASE_URL=sqlite:///finance.db

4. Run the application

python app.py

πŸ” Authentication Usage

Login to get token:

POST /login

Response:

{
  "token": "your_jwt_token"
}

Use token in headers:

Authorization: Bearer <your_token>

πŸ“‘ API Endpoints

πŸ” Auth

  • POST /register
  • POST /login

πŸ‘€ Users (Admin only)

  • GET /users/
  • POST /users/
  • PUT /users/<id>
  • DELETE /users/<id>
  • PATCH /users/<id>/status

πŸ’° Transactions

  • POST /transactions/ (Admin)
  • GET /transactions/ (All)
  • PUT /transactions/<id> (Admin)
  • DELETE /transactions/<id> (Admin)

Filters:

/transactions?type=expense&category=food

Pagination:

/transactions?page=1&limit=10

Search:

/transactions?search=food

πŸ“Š Dashboard

  • GET /dashboard/summary
  • GET /dashboard/category
  • GET /dashboard/recent
  • GET /dashboard/trends

πŸ” Role-Based Access

Role Permissions
Viewer View dashboard & transactions
Analyst View + analytics
Admin Full control (users + transactions)

⚠️ Assumptions

  • 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

✨ Future Improvements

  • Refresh tokens
  • Advanced role permissions
  • Rate limiting
  • Unit & integration testing
  • Deployment (Docker / Cloud)

πŸ“Œ Conclusion

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

alt text

πŸ‘€ Author

Harshikaa lasya

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages