Skip to content

An AI-powered expense management system with receipt OCR, smart categorization, and spend analytics, built using FastAPI, MongoDB, JWT authentication, and Docker for scalable deployment

Notifications You must be signed in to change notification settings

Sanjeev-Kumar78/Expense_Manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’° Expense Manager

A comprehensive expense tracking and management system with AI-powered features for smarter financial management.

🌟 Features

  • πŸ“± Frontend

    • Modern, responsive React application with TypeScript
    • Beautiful green/black themed UI using shadcn/ui components
    • Interactive dashboard with charts and analytics
    • Mobile-friendly design with collapsible sidebar
    • Protected routes with JWT authentication
    • Real-time expense tracking and visualization
  • πŸ”§ Backend

    • RESTful API built with FastAPI
    • JWT-based authentication
    • AI-powered receipt processing
    • Intelligent expense categorization
    • Financial insights and analytics
    • AI chat assistant for financial advice

πŸ—οΈ Architecture

Architecture diagram

πŸš€ Quick Start

Prerequisites

  • Python 3.12+
  • MongoDB (local or MongoDB Atlas)
  • Google AI API key
  • Node.js 20+ (for frontend, when available)

Backend Setup

  1. Clone the repository

    git clone https://github.com/Sanjeev-Kumar78/Expense_Manager.git
    cd Expense_Manager/backend
  2. Set up Python environment

    # Create virtual environment
    python -m venv .venv
    
    # Activate virtual environment
    # Windows
    .venv\Scripts\activate
    # macOS/Linux
    source .venv/bin/activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Configure environment

    # Copy environment template
    cp .env.example .env
    
    # Edit .env with your configuration
    # - MongoDB connection string
    # - Google AI API key
    # - JWT secret key
  5. Run the server

    uvicorn main:app --reload

The API will be available at http://localhost:8000

Frontend Setup

  1. Navigate to frontend directory

    cd frontend
  2. Install dependencies

    npm install
  3. Set up environment variables

    echo "REACT_APP_API_URL=http://localhost:8000" > .env
  4. Start the development server

    npm start

The frontend will be available at http://localhost:3000

πŸ“ Project Structure

Expense_Manager/
β”œβ”€β”€ README.md                 # This file
β”œβ”€β”€ backend/                  # Backend API
β”‚   β”œβ”€β”€ main.py              # FastAPI application entry point
β”‚   β”œβ”€β”€ requirements.txt     # Python dependencies
β”‚   β”œβ”€β”€ pyproject.toml       # Project configuration
β”‚   β”œβ”€β”€ Dockerfile           # Docker configuration
β”‚   β”œβ”€β”€ routes/              # API endpoints
β”‚   β”‚   β”œβ”€β”€ users.py         # User authentication & management
β”‚   β”‚   β”œβ”€β”€ expense_transactions.py # Expense & transaction management
β”‚   β”‚   └── summary.py       # Analytics & AI chat endpoints
β”‚   β”œβ”€β”€ services/            # Business logic
β”‚   β”‚   β”œβ”€β”€ chat_agent.py    # AI financial assistant
β”‚   β”‚   └── preprocessor.py  # Receipt processing with AI
β”‚   └── utils/               # Utilities
β”‚       └── db.py            # Database operations
└── frontend/                # Frontend application
    β”œβ”€β”€ src/                 # Source code
    β”‚   β”œβ”€β”€ components/      # Reusable UI components
    β”‚   β”œβ”€β”€ pages/          # Page components
    β”‚   β”œβ”€β”€ contexts/       # React contexts
    β”‚   β”œβ”€β”€ utils/          # Utility functions
    β”‚   └── types/          # TypeScript types
    β”œβ”€β”€ public/              # Static assets
    └── package.json         # Node.js dependencies

πŸ”§ Backend API Overview

The backend provides a comprehensive RESTful API with the following main endpoints:

πŸ” Authentication

  • POST /auth/register - User registration
  • POST /auth/login - User login
  • GET /auth/profile - Get user profile
  • PUT /auth/profile - Update user profile

πŸ’° Expense Management

  • GET /expenses - List user expenses
  • POST /expenses - Create new expense
  • PUT /expenses/{id} - Update expense
  • DELETE /expenses/{id} - Delete expense
  • POST /expenses/receipt - Process receipt with AI

πŸ“Š Analytics & Insights

  • GET /summary/spending - Get spending summary
  • GET /summary/categories - Category-wise breakdown
  • GET /summary/trends - Spending trends
  • POST /summary/chat - Chat with AI assistant

πŸ€– AI Features

Receipt Processing

  • Upload receipts as images (PNG, JPG) or PDFs
  • Automatic text extraction using Google AI
  • Smart categorization of expenses
  • Amount and merchant detection

Financial Assistant

  • Natural language queries about your expenses
  • Personalized insights based on spending patterns
  • Budget recommendations and financial advice
  • Spending trend analysis

πŸ› οΈ Technology Stack

Backend

  • FastAPI - Modern, fast web framework
  • MongoDB - NoSQL database for flexible data storage
  • Google AI - Advanced text processing and analysis
  • JWT - Secure authentication
  • bcrypt - Password hashing
  • Motor - Async MongoDB driver

Frontend (Completed βœ…)

  • React/TypeScript - Modern frontend framework with type safety
  • shadcn/ui - High-quality, accessible component library
  • Tailwind CSS - Utility-first CSS framework
  • Recharts - Beautiful, responsive data visualization
  • React Router - Client-side routing with protection
  • Axios - HTTP client for API communication

🐳 Docker Support

The backend includes Docker support for easy deployment:

# Build the Docker image
docker build -t expense-manager-backend ./backend

# Run the container
docker run -p 8000:8000 expense-manager-backend

πŸ“ API Documentation

Once the backend server is running, you can access:

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🚧 Roadmap

Phase 1: Backend (Current)

  • βœ… Core API endpoints
  • βœ… User authentication
  • βœ… Expense management
  • βœ… AI receipt processing
  • βœ… Financial analytics
  • βœ… AI chat assistant

Phase 2: Frontend (Completed βœ…)

  • βœ… Responsive web interface with green/black theme
  • βœ… Interactive dashboards with charts and analytics
  • βœ… Real-time expense visualization
  • βœ… Protected routes with JWT authentication
  • βœ… Mobile-responsive design
  • βœ… Modern React with TypeScript

Phase 3: Advanced Features (Planned)

  • πŸ”” Smart notifications and alerts
  • πŸ“± Mobile app (React Native)
  • 🏦 Bank account integration
  • πŸ“Š Advanced reporting and exports
  • πŸ‘₯ Multi-user support for families
  • 🎯 Goal setting and tracking

πŸ“ž Support

If you have any questions or need help, please:

  1. Check the documentation
  2. Search existing issues
  3. Open a new issue

⭐ Star this repository if you find it helpful!

About

An AI-powered expense management system with receipt OCR, smart categorization, and spend analytics, built using FastAPI, MongoDB, JWT authentication, and Docker for scalable deployment

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •