Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Finance Management API

Engineered a production-style Finance Management REST API featuring 15+ endpoints for authentication, income, expense, and transaction management. Integrated JWT Authentication, Role-Based Access Control (RBAC), SQLAlchemy ORM, and secure password hashing to build a scalable and secure backend. Designed modular CRUD services, request validation, and protected API routes following RESTful architecture and backend development best practices.


Features

πŸ” Authentication & Security

  • User Registration & Login (JWT authentication)
  • Password hashing using bcrypt
  • Token-based authorization (Bearer token)

πŸ‘₯ Role-Based Access Control

Role Permissions
Admin Full control (users + records)
Analyst Manage & view financial records
Viewer View dashboard only
  • Only one Admin allowed initially
  • Admin can create users
  • Inactive users are restricted from access

πŸ‘€ User Management

  • Create user (Admin only)
  • View all users
  • Activate / Deactivate users
  • Prevent duplicate user registration

πŸ“Š Financial Records (CRUD)

  • βž• Add record (income / expense)
  • πŸ“‹ View records
  • ✏️ Update record
  • ❌ Delete record
  • πŸ” Filter records by:
    • Type (income / expense)
    • Category
    • Date (optional)

πŸ“ˆ Dashboard Analytics

  • Total Income
  • Total Expense
  • Net Balance
  • Category-wise totals
  • Monthly trend analysis

🧠 Advanced Features

  • Enum validation (income / expense only)
  • Input validation (amount > 0, email format)
  • Role-based route protection
  • Clean API documentation using Swagger

πŸ›  Tech Stack

  • Framework: FastAPI
  • Database: SQLite
  • ORM: SQLAlchemy
  • Authentication: JWT (python-jose)
  • Password Hashing: passlib (bcrypt)

πŸ“‚ Project Structure

app/ β”‚ β”œβ”€β”€ api/ # Routes β”‚ β”œβ”€β”€ auth_routes.py β”‚ β”œβ”€β”€ users.py β”‚ β”œβ”€β”€ record_routes.py β”‚ β”œβ”€β”€ models/ # DB Models β”œβ”€β”€ schemas/ # Pydantic Schemas β”œβ”€β”€ services/ # Business Logic β”œβ”€β”€ core/ # Security & Config β”œβ”€β”€ db/ # Database setup


▢️ How to Run

# Install dependencies
pip install -r requirements.txt

# Run server
uvicorn app.main:app --reload

---

## πŸ“Œ API Documentation

After running server:

http://127.0.0.1:8000/docs

Use Swagger UI to:

- Register
- Login
- Authorize (Bearer Token)
- Test APIs

---

## ⚠️ Important Notes

1.Only first registered user becomes Admin
2.All passwords are securely hashed
3.Duplicate users are not allowed


## πŸ”‘Authentication Flow

1.Register user
2.Login β†’ get JWT token
3.Click Authorize in Swagger
4.Paste token
5.Access protected routes


πŸ“ˆ Example Use Case -

Track income and expenses
Analyze spending patterns
Monitor monthly trends
Manage users in organization


 ## Author
 
 Atharv Gupta

About

Fastapi backend for managin income & expenses with JWT auth, role-based access, and dashboard analytics (category,totals).

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages