2
stars
23
commits
JavaScript
primary language
Aug 11, 2026
updated
InvoiceAI is an enterprise-grade AI-powered invoice processing platform that automates invoice extraction, validation, analytics, reporting, and business intelligence using OCR, LLMs, and secure role-based access controls.
| Domain | Implemented Features |
|---|---|
| Authentication & Security |
|
| OCR & Invoice Processing |
|
| Analytics & BI Dashboard |
|
| AI Assistant (NiBo) |
|
| Administration |
|
graph TD
User([User Client]) <-->|React Frontend| FE[Vite / React App]
FE <-->|Axios HTTPS| BE[Flask REST API]
BE <-->|PyMongo| DB[(MongoDB Atlas)]
flowchart LR
Img[Invoice Image] --> OCR[PaddleOCR-VL]
OCR --> LLaMA[LLaMA3 Model]
LLaMA --> JSON[Structured Invoice JSON]
JSON --> Review[User Review & Edit]
Review --> Save[(Save to MongoDB)]
flowchart TD
Q[User Query] --> Router[Intent Router]
Router --> Engine[Analytics Engine]
Engine --> Query[(MongoDB Aggregation)]
Query --> Summary[Ollama LLaMA3 Summary]
Summary --> PDF[PDF Report Generator]
PDF --> Export([User Download])
paddleocrVL-1.6/
│
├── backend_app.py # Main Flask REST API & Routes
├── ocr_engine.py # PaddleOCR-VL & LLM Extraction pipeline
├── chatbot_service.py # NiBo AI Assistant orchestrator & cache
├── intent_router.py # Chatbot Query Intent Classifier
├── analytics_queries.py # MongoDB aggregation pipeline builders
├── report_generator.py # AI text summary generation
├── pdf_generator.py # ReportLab PDF compilation service
├── promote_admin.py # Script to elevate user role to Admin
├── requirements.txt # Python backend package requirements
│
├── uploads/ # Directory storing uploaded invoice images
├── reports/ # Directory storing generated PDF reports
│
└── frontend/ # React Vite Frontend Application
├── package.json # Frontend dependencies & npm scripts
├── vite.config.js # Vite configuration file
├── tailwind.config.js # Tailwind CSS custom themes & layout
├── index.html # Main HTML5 entrypoint
└── src/
├── main.jsx # App entry point
├── App.jsx # App router & layouts
├── index.css # Global styles & design system
├── components/ # Reusable widgets (Layout, ChatAssistant, ProtectedRoute)
├── pages/ # Full page views (Dashboard, Analytics, AdminDashboard, etc.)
├── services/ # Frontend api service module (api.js)
└── utils/ # Utility scripts (csvExport.js)
usersTracks registered users, permissions, and session timestamps.
_id: ObjectId (Primary Key)email: String (Unique)name: Stringrole: String ("user" | "admin")is_active: Booleancreated_at: Datelast_login: DateinvoicesStores metadata, OCR parsed values, human-edited entries, and correction logs.
_id: ObjectId (Primary Key)user_id: ObjectId (Uploader identity)file_path: Stringextracted_data: Object (Raw OCR output)invoice_data: Object (Active/edited structure)
invoice_number: Stringinvoice_date: Datevendor_name: Stringbuyer_name: Stringitems: Array of Objects (description, quantity, rate, cgst_amount, sgst_amount, igst_amount, amount)total_tax: Doubletotal_revenue: Doublereview_status: String ("Pending Review" | "Reviewed" | "Corrected")change_history: Array of Objects (timestamp, edited_by, diff)created_at: Dateactivity_logsAn immutable log auditing user actions and security events.
_id: ObjectId (Primary Key)user_id: ObjectIduser_email: Stringaction: String (e.g., "ocr_upload", "invoice_edit", "login", "chatbot_query")metadata: Object (Specific contextual variables)timestamp: DatereportsMetadata catalog for exported PDF reporting operations.
_id: ObjectId (Primary Key)user_id: ObjectIdreport_type: String (e.g., "monthly_report", "quarterly_report", "yearly_report")generated_at: Datepdf_filename: Stringsummary: String (LLM generated report overview)llama3 model pulled)Clone the repository, initialize the virtual environment, and install package dependencies:
# Clone the repository
git clone <repo-url>
cd paddleocrVL-1.6
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install requirements
pip install -r requirements.txt
Create a .env file in the root directory:
MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/
DB_NAME=invoice_db
COLLECTION_NAME=invoices
GOOGLE_CLIENT_ID=your-google-oauth-client-id
JWT_SECRET_KEY=your-secure-jwt-secret-key
# Chatbot & Report Settings
CHAT_CACHE_TTL_MINUTES=5
CHAT_MAX_HISTORY=50
REPORTS_DIRECTORY=reports
MAX_REPORT_RECORDS=100
OLLAMA_MODEL=llama3
REPORT_RETENTION_DAYS=30
Create a .env file in the frontend directory:
VITE_API_URL=http://localhost:5000
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
Navigate into the frontend folder, install package dependencies, and start the development server:
cd frontend
npm install
npm run dev
Ensure your virtual environment is active, then run:
python backend_app.py
Ensure Ollama is running and has the llama3 model loaded:
# Start Ollama service
ollama serve
# Confirm LLaMA3 model is pulled
ollama pull llama3
ollama list
InvoiceAI can be completely containerized and run locally using Docker and Docker Compose. This simplifies environment setup by bundling the React Frontend, Flask Backend, MongoDB database, and Ollama service together.
The docker-compose.yml configures the following containers:
frontend (Node 20): Dev server hosting the React client app, exposed at http://localhost:5173.backend (Python 3.10-slim): Flask REST API backend, exposed at http://localhost:5000. Runs CPU-based or GPU-accelerated OCR model processing.mongodb (Mongo Latest): Database engine, exposed at http://localhost:27017 with persistent volumes.ollama (Ollama Latest): Running the local LLaMA3 LLM for post-processing and text summarization, exposed at http://localhost:11434.libgomp1) without code changes.To avoid re-downloading large AI models on container restarts, persistent named Docker volumes are configured:
hf_cache: Caches the PaddlePaddle/PaddleOCR-VL-1.6 Hugging Face model parameters.ollama_data: Caches downloaded Ollama models (e.g. llama3).mongo_data: Stores MongoDB data collections.uploads_data, reports_data, invoice_slices_data: Stores user-uploaded media files and reports.Ensure you have created a .env file in the project root containing your API configurations (e.g., GOOGLE_CLIENT_ID, JWT_SECRET_KEY).
docker compose build
docker compose up -d
docker compose up --build
docker compose down
The containers use automated health checks. You can check the health status by running:
docker compose ps
Once all services show (healthy), you can access the frontend in your browser at http://localhost:5173.
| Action / Permission | Standard User (role = "user") | Administrator (role = "admin") |
|---|---|---|
| Upload Invoice Image | ✓ | ✓ |
| Edit / Review Extracted Invoice | ✓ (Own only) | ✓ (All) |
| View Analytics Dashboard | ✓ (Own calculations) | ✓ (All) |
| Ask NiBo Chatbot Queries | ✓ (Own data context) | ✓ (All systems) |
| Generate & Export PDF Reports | ✓ | ✓ |
| Access Admin Dashboard & Logs | ✗ | ✓ |
| Manage Users (Block / Activate) | ✗ | ✓ |
| Global System-Wide Visibility | ✗ | ✓ |
POST /api/auth/google - Exchanges Google OAuth credential token for JWT.GET /api/invoices - Retrieve invoice history (scoped or global depending on user role).POST /api/invoices - Upload a new invoice image and run the PaddleOCR extraction pipeline.GET /api/invoices/<id> - Fetch details of a single invoice.PUT /api/invoices/<id> - Submit updates / correction inputs for an invoice.DELETE /api/invoices/<id> - Delete an invoice.GET /api/analytics - Retrieve user-scoped business analytics metrics.GET /api/admin/analytics - Retrieve global, system-wide KPIs.POST /api/chat/report - Trigger on-the-fly PDF generation based on chatbot analytics context.GET /api/reports - Fetch list of previously generated reports.GET /api/reports/download/<filename> - Download a generated PDF report file.DELETE /api/reports/<id> - Permanently delete a report record.POST /api/chat/query - Send query strings to NiBo chatbot for analysis, NLP summaries, and prompt execution.GET /api/admin/users - Fetch all system user accounts.PUT /api/admin/users/<id>/status - Activate or block a user account.GET /api/admin/activity - Fetch system audit activity logs.[Screenshot Placeholder: Secure Google OAuth and email-based login screen with high-contrast emerald colors]
[Screenshot Placeholder: User dashboard highlighting statistics widgets, recent uploads list, and quick navigation headers]
[Screenshot Placeholder: Image-to-text extraction screen showing the original image alongside an editable, side-by-side data review panel]
[Screenshot Placeholder: Interactive chart views showcasing Monthly volume, Billing revenue, Pie Chart GST spreads, and the Buyer Revenue Contribution Stacked Bar]
[Screenshot Placeholder: Admin dashboard providing access to user management list, active session metrics, and live audit logging feeds]
[Screenshot Placeholder: Floating chatbot assistant window with quick query buttons, chat bubbles, and formatted business reports]
[Screenshot Placeholder: Historical view of generated reports ready for local PDF download or server deletion]
activity_logs.id_token verification endpoint.15 commits
8 commits
JavaScript
49.6%
Python
49.3%
2
stars
23
commits
JavaScript
primary language
Aug 11, 2026
updated
InvoiceAI is an enterprise-grade AI-powered invoice processing platform that automates invoice extraction, validation, analytics, reporting, and business intelligence using OCR, LLMs, and secure role-based access controls.
| Domain | Implemented Features |
|---|---|
| Authentication & Security |
|
| OCR & Invoice Processing |
|
| Analytics & BI Dashboard |
|
| AI Assistant (NiBo) |
|
| Administration |
|
graph TD
User([User Client]) <-->|React Frontend| FE[Vite / React App]
FE <-->|Axios HTTPS| BE[Flask REST API]
BE <-->|PyMongo| DB[(MongoDB Atlas)]
flowchart LR
Img[Invoice Image] --> OCR[PaddleOCR-VL]
OCR --> LLaMA[LLaMA3 Model]
LLaMA --> JSON[Structured Invoice JSON]
JSON --> Review[User Review & Edit]
Review --> Save[(Save to MongoDB)]
flowchart TD
Q[User Query] --> Router[Intent Router]
Router --> Engine[Analytics Engine]
Engine --> Query[(MongoDB Aggregation)]
Query --> Summary[Ollama LLaMA3 Summary]
Summary --> PDF[PDF Report Generator]
PDF --> Export([User Download])
paddleocrVL-1.6/
│
├── backend_app.py # Main Flask REST API & Routes
├── ocr_engine.py # PaddleOCR-VL & LLM Extraction pipeline
├── chatbot_service.py # NiBo AI Assistant orchestrator & cache
├── intent_router.py # Chatbot Query Intent Classifier
├── analytics_queries.py # MongoDB aggregation pipeline builders
├── report_generator.py # AI text summary generation
├── pdf_generator.py # ReportLab PDF compilation service
├── promote_admin.py # Script to elevate user role to Admin
├── requirements.txt # Python backend package requirements
│
├── uploads/ # Directory storing uploaded invoice images
├── reports/ # Directory storing generated PDF reports
│
└── frontend/ # React Vite Frontend Application
├── package.json # Frontend dependencies & npm scripts
├── vite.config.js # Vite configuration file
├── tailwind.config.js # Tailwind CSS custom themes & layout
├── index.html # Main HTML5 entrypoint
└── src/
├── main.jsx # App entry point
├── App.jsx # App router & layouts
├── index.css # Global styles & design system
├── components/ # Reusable widgets (Layout, ChatAssistant, ProtectedRoute)
├── pages/ # Full page views (Dashboard, Analytics, AdminDashboard, etc.)
├── services/ # Frontend api service module (api.js)
└── utils/ # Utility scripts (csvExport.js)
usersTracks registered users, permissions, and session timestamps.
_id: ObjectId (Primary Key)email: String (Unique)name: Stringrole: String ("user" | "admin")is_active: Booleancreated_at: Datelast_login: DateinvoicesStores metadata, OCR parsed values, human-edited entries, and correction logs.
_id: ObjectId (Primary Key)user_id: ObjectId (Uploader identity)file_path: Stringextracted_data: Object (Raw OCR output)invoice_data: Object (Active/edited structure)
invoice_number: Stringinvoice_date: Datevendor_name: Stringbuyer_name: Stringitems: Array of Objects (description, quantity, rate, cgst_amount, sgst_amount, igst_amount, amount)total_tax: Doubletotal_revenue: Doublereview_status: String ("Pending Review" | "Reviewed" | "Corrected")change_history: Array of Objects (timestamp, edited_by, diff)created_at: Dateactivity_logsAn immutable log auditing user actions and security events.
_id: ObjectId (Primary Key)user_id: ObjectIduser_email: Stringaction: String (e.g., "ocr_upload", "invoice_edit", "login", "chatbot_query")metadata: Object (Specific contextual variables)timestamp: DatereportsMetadata catalog for exported PDF reporting operations.
_id: ObjectId (Primary Key)user_id: ObjectIdreport_type: String (e.g., "monthly_report", "quarterly_report", "yearly_report")generated_at: Datepdf_filename: Stringsummary: String (LLM generated report overview)llama3 model pulled)Clone the repository, initialize the virtual environment, and install package dependencies:
# Clone the repository
git clone <repo-url>
cd paddleocrVL-1.6
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install requirements
pip install -r requirements.txt
Create a .env file in the root directory:
MONGODB_URI=mongodb+srv://<username>:<password>@cluster0.mongodb.net/
DB_NAME=invoice_db
COLLECTION_NAME=invoices
GOOGLE_CLIENT_ID=your-google-oauth-client-id
JWT_SECRET_KEY=your-secure-jwt-secret-key
# Chatbot & Report Settings
CHAT_CACHE_TTL_MINUTES=5
CHAT_MAX_HISTORY=50
REPORTS_DIRECTORY=reports
MAX_REPORT_RECORDS=100
OLLAMA_MODEL=llama3
REPORT_RETENTION_DAYS=30
Create a .env file in the frontend directory:
VITE_API_URL=http://localhost:5000
VITE_GOOGLE_CLIENT_ID=your-google-client-id.apps.googleusercontent.com
Navigate into the frontend folder, install package dependencies, and start the development server:
cd frontend
npm install
npm run dev
Ensure your virtual environment is active, then run:
python backend_app.py
Ensure Ollama is running and has the llama3 model loaded:
# Start Ollama service
ollama serve
# Confirm LLaMA3 model is pulled
ollama pull llama3
ollama list
InvoiceAI can be completely containerized and run locally using Docker and Docker Compose. This simplifies environment setup by bundling the React Frontend, Flask Backend, MongoDB database, and Ollama service together.
The docker-compose.yml configures the following containers:
frontend (Node 20): Dev server hosting the React client app, exposed at http://localhost:5173.backend (Python 3.10-slim): Flask REST API backend, exposed at http://localhost:5000. Runs CPU-based or GPU-accelerated OCR model processing.mongodb (Mongo Latest): Database engine, exposed at http://localhost:27017 with persistent volumes.ollama (Ollama Latest): Running the local LLaMA3 LLM for post-processing and text summarization, exposed at http://localhost:11434.libgomp1) without code changes.To avoid re-downloading large AI models on container restarts, persistent named Docker volumes are configured:
hf_cache: Caches the PaddlePaddle/PaddleOCR-VL-1.6 Hugging Face model parameters.ollama_data: Caches downloaded Ollama models (e.g. llama3).mongo_data: Stores MongoDB data collections.uploads_data, reports_data, invoice_slices_data: Stores user-uploaded media files and reports.Ensure you have created a .env file in the project root containing your API configurations (e.g., GOOGLE_CLIENT_ID, JWT_SECRET_KEY).
docker compose build
docker compose up -d
docker compose up --build
docker compose down
The containers use automated health checks. You can check the health status by running:
docker compose ps
Once all services show (healthy), you can access the frontend in your browser at http://localhost:5173.
| Action / Permission | Standard User (role = "user") | Administrator (role = "admin") |
|---|---|---|
| Upload Invoice Image | ✓ | ✓ |
| Edit / Review Extracted Invoice | ✓ (Own only) | ✓ (All) |
| View Analytics Dashboard | ✓ (Own calculations) | ✓ (All) |
| Ask NiBo Chatbot Queries | ✓ (Own data context) | ✓ (All systems) |
| Generate & Export PDF Reports | ✓ | ✓ |
| Access Admin Dashboard & Logs | ✗ | ✓ |
| Manage Users (Block / Activate) | ✗ | ✓ |
| Global System-Wide Visibility | ✗ | ✓ |
POST /api/auth/google - Exchanges Google OAuth credential token for JWT.GET /api/invoices - Retrieve invoice history (scoped or global depending on user role).POST /api/invoices - Upload a new invoice image and run the PaddleOCR extraction pipeline.GET /api/invoices/<id> - Fetch details of a single invoice.PUT /api/invoices/<id> - Submit updates / correction inputs for an invoice.DELETE /api/invoices/<id> - Delete an invoice.GET /api/analytics - Retrieve user-scoped business analytics metrics.GET /api/admin/analytics - Retrieve global, system-wide KPIs.POST /api/chat/report - Trigger on-the-fly PDF generation based on chatbot analytics context.GET /api/reports - Fetch list of previously generated reports.GET /api/reports/download/<filename> - Download a generated PDF report file.DELETE /api/reports/<id> - Permanently delete a report record.POST /api/chat/query - Send query strings to NiBo chatbot for analysis, NLP summaries, and prompt execution.GET /api/admin/users - Fetch all system user accounts.PUT /api/admin/users/<id>/status - Activate or block a user account.GET /api/admin/activity - Fetch system audit activity logs.[Screenshot Placeholder: Secure Google OAuth and email-based login screen with high-contrast emerald colors]
[Screenshot Placeholder: User dashboard highlighting statistics widgets, recent uploads list, and quick navigation headers]
[Screenshot Placeholder: Image-to-text extraction screen showing the original image alongside an editable, side-by-side data review panel]
[Screenshot Placeholder: Interactive chart views showcasing Monthly volume, Billing revenue, Pie Chart GST spreads, and the Buyer Revenue Contribution Stacked Bar]
[Screenshot Placeholder: Admin dashboard providing access to user management list, active session metrics, and live audit logging feeds]
[Screenshot Placeholder: Floating chatbot assistant window with quick query buttons, chat bubbles, and formatted business reports]
[Screenshot Placeholder: Historical view of generated reports ready for local PDF download or server deletion]
activity_logs.id_token verification endpoint.15 commits
8 commits
JavaScript
49.6%
Python
49.3%