An intelligent invoice processing system that automatically extracts structured information from PDF/image invoices and validates the extracted data before storing it in the database.
The system is designed to reduce manual invoice processing, identify calculation and data-entry errors, and provide a reliable workflow for invoice review and approval.
- ๐ Upload PDF and image invoices
- ๐ค Automatic invoice data extraction using OCR / Google Document AI
- ๐ข Extract vendor information
- ๐ข Extract invoice number and purchase order number
- ๐ Extract invoice date
- ๐ฆ Extract item details
- ๐ข Extract quantity and unit price
- ๐ฐ Extract subtotal, tax/GST and grand total
- โ Automatic invoice validation
- ๐งฎ Line-item calculation validation
- ๐งพ Subtotal and grand-total verification
- ๐งฎ GST/tax validation
- ๐ Duplicate invoice detection
- ๐ Invoice date validation
โ ๏ธ Missing-field detection- ๐ซ Invalid/non-invoice document detection
- ๐ Dashboard for invoice monitoring
- ๐ Invoice search and filtering
- ๐ Invoice refresh functionality
- ๐๏ธ MySQL database storage
- ๐ค Human review for invalid or low-confidence invoices
- ๐ Invoice report generation
- ๐ Environment variables for sensitive configuration
Invoice Upload
โ
โผ
PDF / Image File
โ
โผ
OCR / Document AI
โ
โผ
Data Extraction
โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโ
โ โ
โผ โผ
Invoice Fields Line Items
โ โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโ
โผ
Data Validation
โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ โ โ
โผ โผ โผ
Required Calculation Duplicate
Fields Check Check
โ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โผ
Validation Result
/ \
/ \
โผ โผ
Valid Invalid
โ โ
โผ โผ
Database Human Review
โ
โผ
Dashboard / Report
The system performs multiple validation checks after extracting invoice information.
Checks whether important invoice fields are available:
- Vendor Name
- Invoice Number
- Invoice Date
- Invoice Items
- Quantity
- Unit Price
- Tax/GST
- Total Amount
The system verifies:
Quantity ร Unit Price = Line Item Amount
Then:
Sum of Line Items = Subtotal
And finally:
Subtotal + Tax/GST = Grand Total
If the calculated amount differs from the invoice amount, the invoice is marked as invalid and sent for review.
The system checks whether the same invoice has already been uploaded or stored.
Documents that do not contain recognizable invoice information are rejected instead of generating random invoice calculations.
- React.js
- Vite
- JavaScript
- Lucide React
- Recharts
- HTML5
- CSS3
- Node.js
- Express.js
- REST API
- Multer
- CORS
- UUID
- dotenv
- Google Cloud Document AI
- Invoice Parser
- OCR-based document processing
- MySQL
- Git
- GitHub
- Visual Studio Code
- PowerShell
- Postman / cURL
invoice-data-extraction-validation/
โ
โโโ backend/
โ โโโ src/
โ โ โโโ routes/
โ โ โโโ services/
โ โ โโโ controllers/
โ โ โโโ middleware/
โ โ โโโ server.js
โ โ
โ โโโ uploads/
โ โโโ credentials/
โ โโโ package.json
โ โโโ .env
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ components/
โ โ โโโ App.jsx
โ โ โโโ InvoiceDashboard.jsx
โ โ
โ โโโ package.json
โ โโโ vite.config.js
โ
โโโ .gitignore
โโโ README.md
Note:
.env, service-account credentials, and other sensitive files should never be committed to GitHub.
git clone https://github.com/Aditya1710S/invoice-data-extraction-validation.gitcd invoice-data-extraction-validationGo to the backend folder:
cd backendInstall dependencies:
npm installCreate a .env file:
PORT=4000
NODE_ENV=development
CORS_ORIGIN=http://localhost:5173
DB_NAME=invoiceflow
DB_USER=invoiceflow_app
DB_PASSWORD=YOUR_DATABASE_PASSWORD
DB_HOST=localhost
GOOGLE_CLOUD_PROJECT_ID=YOUR_PROJECT_ID
DOCUMENT_AI_PROCESSOR_ID=YOUR_PROCESSOR_ID
DOCUMENT_AI_LOCATION=us
GOOGLE_APPLICATION_CREDENTIALS=./credentials/invoiceflow-service-account.jsonStart the backend:
npm run devBackend API:
http://localhost:4000
Health check:
http://localhost:4000/api/health
Open another terminal and go to the frontend folder:
cd frontendInstall dependencies:
npm installStart the development server:
npm run devThe frontend will normally run at:
http://localhost:5173
The project uses MySQL for storing invoice information.
Create the database:
CREATE DATABASE invoiceflow;The backend initializes the required tables when configured correctly.
Make sure MySQL is running before starting the backend.
The project uses Google Cloud Document AI for invoice processing.
Required configuration:
Google Cloud Project
โ
โผ
Document AI API
โ
โผ
Invoice Parser
โ
โผ
Processor ID
โ
โผ
Backend
โ
โผ
Invoice Extraction
The Google Cloud service-account JSON file should be stored locally and must not be uploaded to GitHub.
Sensitive configuration is intentionally excluded from the repository.
The following should not be committed:
.env
credentials/
service-account JSON files
node_modules/
uploads/
Use .env.example to document required environment variables without exposing passwords or credentials.
Quantity: 10
Unit Price: โน100
Subtotal: โน1000
GST: โน180
Grand Total: โน1180
The calculation is consistent, so the invoice can proceed to the next stage.
Quantity: 10
Unit Price: โน100
Expected: โน1000
Invoice Amount: โน1100
The system detects the discrepancy and marks the invoice for validation/review.
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/health |
Check backend status |
| POST | /api/invoices/upload |
Upload and process invoice |
| GET | /api/invoices |
Get invoices |
| GET | /api/invoices/:id |
Get invoice details |
| PUT | /api/invoices/:id |
Update invoice |
| DELETE | /api/invoices/:id |
Delete invoice |
| GET | /api/invoices/:id/file |
Access invoice file |
- Automate invoice data extraction.
- Reduce manual data entry.
- Validate invoice calculations automatically.
- Detect duplicate invoices.
- Identify missing or invalid invoice information.
- Store structured invoice data in a database.
- Provide a dashboard for invoice monitoring.
- Reduce the need for manual invoice verification.
- Route exceptions to human review.
The system can be used for:
- Accounts Payable departments
- Small and medium businesses
- Enterprise invoice processing
- Vendor invoice management
- Financial document processing
- Automated accounting workflows
Future versions can be extended with:
- Advanced fraud detection
- Vendor-specific validation rules
- Email invoice ingestion
- Cloud deployment
- ERP integration
- Multi-language invoice processing
- Machine-learning based anomaly detection
- Automated approval workflows
- Faster invoice processing
- Reduced manual effort
- Improved data accuracy
- Automatic calculation verification
- Duplicate invoice detection
- Centralized invoice records
- Better visibility through dashboard
- Human review only for exceptions
Project Title: Invoice Data Extraction and Validation Pipeline
Domain: Artificial Intelligence | Data Extraction | Document Processing | Full Stack Development
Technologies: React.js | Node.js | Express.js | Google Cloud Document AI | MySQL
Repository: https://github.com/Aditya1710S/invoice-data-extraction-validation