Transform your invoice workflow with AI-powered automation
Features β’ Installation β’ Architecture β’ API Docs
- What is Invox?
- Key Features
- Technology Stack
- Architecture
- Local Setup
- Project Structure
- API Documentation
- Features in Detail
- Development
- Contributing
- [π Complete Technical Documentation β](#-complete-technical-documentation)
Invox is a modern, AI-powered invoice management platform that automates the entire invoice processing workflow - from extraction to approval. Built with cutting-edge technologies, Invox leverages Google Gemini AI for intelligent OCR, providing 99% accuracy in invoice data extraction from multiple sources including PDFs, images, emails, and handwritten documents.
- β‘ 10x Faster Processing - Automated invoice extraction vs manual data entry
- π― 99% Accuracy - AI-powered OCR with Google Gemini
- π Bank-Level Security - AES-256 encryption, OAuth 2.0, SOC 2 & GDPR compliant
- π Real-Time Analytics - Monitor invoices and payments instantly
- π Multi-Source Import - Gmail, direct uploads, APIs, scanned documents
- π€ Smart Automation - Auto-categorize, route, and approve invoices
- Google Gemini AI Integration for intelligent data extraction
- Support for PDFs, images (PNG, JPG), and handwritten documents
- Multi-page document processing
- 99% accuracy rate with automatic validation
- Natural Language Queries - Ask questions about your invoices in plain English
- Hybrid Search - Combines SQL analytics with semantic search
- Smart Classification - Automatically routes queries to appropriate system
- Conversational AI - Powered by Google Gemini for natural responses
- Example Queries: "Show all pending invoices", "Find office supply purchases", "What's my total due?"
- Gmail OAuth Integration - Automatic invoice detection from emails
- Background polling system (checks every 60 seconds)
- Processes last 5 emails automatically
- Multi-layer duplicate prevention
- Supports both Gmail OAuth and IMAP protocols
- Live invoice monitoring and payment tracking
- Visual analytics and reporting
- Invoice status tracking (pending, approved, paid)
- Export to JSON and CSV formats
- OAuth 2.0 Authentication with Google
- AES-256 end-to-end encryption
- JWT token-based authorization
- Bank-level data protection
- SOC 2 & GDPR compliant
- Responsive design (mobile, tablet, desktop)
- Beautiful 3D Prism background animations
- Glassmorphism design elements
- Dark mode optimized
- Smooth transitions and interactions
- Auto-categorization of invoices
- Intelligent routing and approval workflows
- Email notification system
- Batch processing capabilities
- API integration ready
- Framework: Next.js 15 (App Router)
- Language: TypeScript 5
- Styling: Tailwind CSS
- UI Components: Radix UI, shadcn/ui
- Authentication: NextAuth.js with Google OAuth
- Animations: GSAP, Framer Motion
- State Management: React Hooks
- HTTP Client: Axios
- Framework: FastAPI 0.115.5
- Language: Python 3.13
- Database: PostgreSQL (Neon)
- ORM: SQLAlchemy
- Migrations: Alembic
- Authentication: JWT Tokens, OAuth 2.0
- AI/ML: Google Gemini AI
- Email: Gmail API, IMAP
- Server: Uvicorn (ASGI)
- Database: PostgreSQL 16
- Cloud Storage: (Optional) AWS S3 / Google Cloud Storage
- Deployment: Vercel (Frontend), Railway/Render (Backend)
- Version Control: Git, GitHub
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CLIENT (Browser) β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β Landing β β Sign In β β Dashboard β β
β β Page β β Page β β Page β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
βββββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββ
β
βββββββββΌββββββββ
β Next.js 15 β
β (Frontend) β
β Port: 3000 β
βββββββββ¬ββββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
βββββββββΌββββββββ ββββββΌβββββ ββββββββΌβββββββ
β NextAuth.js β β Axios β β GSAP β
β (OAuth) β β (API) β β (Animations)β
βββββββββ¬ββββββββ ββββββ¬βββββ βββββββββββββββ
β β
ββββββββ¬ββββββββ
β
βββββββββΌβββββββββ
β FastAPI β
β Backend β
β Port: 8000 β
βββββββββ¬βββββββββ
β
ββββββββββββββΌβββββββββββββ
β β β
βββββββΌββββββ βββββΌβββββ βββββββΌβββββββ
βPostgreSQL β β Gmail β β Gemini β
β Database β β API β β AI β
βββββββββββββ ββββββββββ ββββββββββββββ
- User Authentication: Google OAuth β NextAuth β JWT Token
- Invoice Upload: User uploads β FastAPI β Gemini AI β Extracted Data
- Email Polling: Background Worker β Gmail API/IMAP β Invoice Detection β Processing
- Data Storage: PostgreSQL with SQLAlchemy ORM
- Real-Time Updates: WebSocket/Polling for dashboard updates
Before you begin, ensure you have the following installed:
- Node.js 18+ and npm/pnpm
- Python 3.13+
- PostgreSQL 16+
- Git
git clone https://github.com/ASHWARYGUPTA/Invox.git
cd Invox# Using pnpm (recommended)
pnpm install
# Or using npm
npm installCreate a .env.local file in the root directory:
# NextAuth Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here-min-32-chars
# Google OAuth
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Backend API
NEXT_PUBLIC_API_URL=http://localhost:8000- Go to Google Cloud Console
- Create a new project or select existing
- Enable Google+ API
- Go to Credentials β Create Credentials β OAuth 2.0 Client ID
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/googlehttp://localhost:3000/auth/callback
- Copy Client ID and Client Secret to
.env.local
pnpm dev
# or
npm run devThe frontend will be available at http://localhost:3000
cd backend
python3 -m venv venv
# Activate virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the backend directory:
# Database
DATABASE_URL=postgresql://username:password@localhost:5432/invox_db
# Authentication
NEXTAUTH_SECRET=same-as-frontend-secret
JWT_SECRET_KEY=your-jwt-secret-key-here
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Google OAuth (same as frontend)
GOOGLE_CLIENT_ID=your-google-client-id
GOOGLE_CLIENT_SECRET=your-google-client-secret
# Google Gemini AI
GEMINI_API_KEY=your-gemini-api-key
# Email Configuration (Optional)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USERNAME=your-email@gmail.com
EMAIL_PASSWORD=your-app-password
# CORS
CORS_ORIGINS=http://localhost:3000,http://localhost:3001
# Application
DEBUG=True# Create database
createdb invox_db
# Create user (optional)
createuser invox_user -P
# Enter password when prompted
# Grant privileges
psql invox_db
GRANT ALL PRIVILEGES ON DATABASE invox_db TO invox_user;
\q# Initialize Alembic (if not already done)
alembic upgrade head# Start the FastAPI server
python -m uvicorn app.main:app --reload --port 8000The backend will be available at:
- API: http://localhost:8000
- Swagger Docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
-
Frontend: Open http://localhost:3000
- You should see the landing page with 3D Prism background
- Click "Join with Google" button
-
Backend: Open http://localhost:8000/docs
- You should see the Swagger UI with all API endpoints
- Try the
/healthendpoint
-
Authentication: Sign in with Google
- Should redirect to Google OAuth
- After approval, redirect back to dashboard
-
Database: Check if tables are created
psql invox_db \dt # You should see: users, accounts, sessions, invoices, etc.
Invox/
βββ app/ # Next.js App Router
β βββ api/ # API routes
β β βββ auth/ # NextAuth configuration
β βββ auth/ # Authentication pages
β β βββ signin/ # Sign in page
β βββ dashboard/ # Dashboard pages
β βββ page.tsx # Landing page
βββ components/ # React components
β βββ ui/ # UI components (buttons, cards, etc.)
β βββ NavBarMenu.tsx # Navigation menu
β βββ Prism.tsx # 3D Prism background
β βββ ... # Other components
βββ lib/ # Utility functions
β βββ api/ # API client configuration
βββ backend/ # FastAPI Backend
β βββ app/
β β βββ api/ # API routes
β β β βββ v1/
β β β βββ endpoints/ # API endpoints
β β β β βββ auth.py # Authentication
β β β β βββ invoices.py
β β β β βββ users.py
β β β βββ api.py # API router
β β βββ core/ # Core functionality
β β β βββ config.py # Configuration
β β β βββ security.py # Security utilities
β β βββ crud/ # Database operations
β β βββ db/ # Database configuration
β β βββ models/ # SQLAlchemy models
β β βββ schemas/ # Pydantic schemas
β β βββ services/ # Business logic
β β β βββ auth.py
β β β βββ email_polling.py # Email automation
β β β βββ invoice.py
β β βββ worker/ # Background workers
β β βββ main.py # FastAPI application
β βββ alembic/ # Database migrations
β βββ requirements.txt # Python dependencies
β βββ .env # Environment variables
βββ public/ # Static assets
βββ types/ # TypeScript types
βββ .gitignore # Git ignore rules
βββ next.config.ts # Next.js configuration
βββ package.json # Node.js dependencies
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
Handle OAuth callback from NextAuth
{
"email": "user@example.com",
"name": "John Doe",
"image": "https://..."
}Get current user information (requires authentication)
Upload and process invoice
- Supports: PDF, PNG, JPG, JPEG
- Max size: 10MB
- Returns extracted invoice data
List all invoices for current user
- Pagination supported
- Filter by status, date range
Get specific invoice details
Update invoice information
Delete invoice
Get current user profile
Update user profile
The backend includes an intelligent email polling system that:
- Automatic Detection: Scans inbox every 60 seconds
- Smart Filtering: Only processes last 5 emails
- Duplicate Prevention: Multi-layer checking at email and invoice level
- Gmail OAuth Support: Secure Gmail API integration
- IMAP Fallback: Support for other email providers
- Background Processing: Runs independently without blocking main application
Three-layer duplicate prevention system:
- Email Level: Tracks processed emails in
EmailProcessingLog - Exact Match: Checks invoice_id + vendor + amount + date
- Filename Match: Checks filename + amount
- Partial Match: Handles OCR variations in vendor names
Google Gemini AI integration provides:
- Intelligent field detection (vendor, amount, date, items)
- Multi-language support
- Handwriting recognition
- Confidence scoring
- Automatic validation
# Run development server
pnpm dev
# Build for production
pnpm build
# Start production server
pnpm start
# Run linter
pnpm lint
# Type checking
pnpm type-check# Run development server with auto-reload
python -m uvicorn app.main:app --reload --port 8000
# Create new migration
alembic revision --autogenerate -m "description"
# Apply migrations
alembic upgrade head
# Rollback migration
alembic downgrade -1
# Run tests
pytest
# Format code
black .
# Lint code
flake8 .# Connect to database
psql invox_db
# List tables
\dt
# Describe table
\d table_name
# Backup database
pg_dump invox_db > backup.sql
# Restore database
psql invox_db < backup.sqlFor comprehensive technical documentation including:
- Gmail OAuth Implementation - Complete setup and integration guide
- Duplicate Prevention System - Multi-layer prevention strategy
- Email Polling System - Automated email processing
- Export Features - JSON and CSV export functionality
- Backend Architecture - Detailed system architecture
- Troubleshooting Guide - Solutions to common issues
- Development Guide - Code standards and workflows
- API Reference - Complete endpoint documentation
- What's Next - Future enhancements roadmap
π Read the Complete Documentation β
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Created by the Invox Team:
- Abhinav Mishra - Full Stack Developer
- Ashwary Gupta - Full Stack Developer
- Sujal Ahar - Backend Developer
- Shivang Baranwal - Frontend Developer
- Next.js - React Framework
- FastAPI - Python Web Framework
- Google Gemini AI - AI/ML Platform
- Tailwind CSS - CSS Framework
- shadcn/ui - UI Components
- Vercel - Deployment Platform
Made with β€οΈ by the Invox Team