Skip to content

ElSnoMan/ai-receipt-analyzer

Repository files navigation

Receipt Analyzer

AI-powered receipt analysis and expense tracking application built with Next.js and FastAPI.

Features

  • 📷 Receipt image upload and analysis
  • 🤖 AI-powered expense categorization with Azure OpenAI
  • 💬 Interactive chat interface with CopilotKit
  • 📊 Detailed expense breakdowns and insights
  • 🏷️ Smart tagging and business expense detection

Tech Stack

  • Frontend: Next.js 15, React 19, Tailwind CSS, CopilotKit
  • Backend: FastAPI, Python with uv package management
  • AI: Azure OpenAI (GPT-4), LangChain, LangGraph
  • UI: Radix UI components

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Python 3.9+ and uv package manager
  • Azure OpenAI account with API access

Installation

  1. Install dependencies:

    npm install
  2. Configure environment variables:

    # Frontend environment
    cp .env.example .env.local
    
    # Backend environment
    cp agent/.env.example agent/.env
  3. Configure Azure OpenAI in agent/.env:

    AZURE_OPENAI_ENDPOINT=your_endpoint_here
    AZURE_OPENAI_API_KEY=your_api_key_here
    AZURE_OPENAI_API_VERSION=2024-02-01
    AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4

Development

Start both frontend and backend:

npm run dev

This runs:

Individual Services

Frontend only:

npm run dev:ui

Backend only:

npm run dev:agent

Project Structure

├── app/                    # Next.js app directory
├── components/             # React components
├── lib/                    # Utility functions
├── agent/                  # FastAPI backend
│   ├── main.py            # FastAPI application
│   ├── receipt_analyzer_agent.py  # Receipt analysis logic
│   └── azure_openai_client.py     # Azure OpenAI integration
└── scripts/               # Setup scripts

Usage

  1. Open http://localhost:3000
  2. Upload a receipt image using the file picker
  3. Click "Analyze Receipt" to extract information
  4. View detailed analysis including:
    • Merchant details and transaction info
    • Itemized breakdown
    • Expense categorization
    • Business deductibility assessment
  5. Use the chat sidebar for additional insights

API Endpoints

  • GET / - Health check
  • POST /copilotkit - CopilotKit agent integration
  • GET /health - Backend health status

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Test with npm run lint
  5. Submit a pull request

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors