A full-stack invoice processing and tracking application powered by Mistral AI with automated VAT reliability checking for Czech businesses. Version 1.2.0 is pure Node.js fully separated Frontend/Backend application.
- Mistral AI Integration: Uses
mistral-small-latestmodel via Mistral API - Integrated Backend: Single server combines backend API + Mistral proxy (port 3002)
- Separate Database: Uses
mistral_invoices.db(SQLite database) - Extraction of financial data: Intensively tested System prompt guarantees to get the best from Mistral Small 3.2
- ISDOC import: You can import ISDOC e-invoices
- VAT payer reliability check: Native Node.js SOAP client for direct check with MF database of unreliable VAT payers
- Financial Analytic: Analytics of VAT for VAT return statements on quarterly basis (could be easily modified for monthly period), supplier analysis by date range
- Files:
mistral_server.js,mistral_database.js,index.html,package.json - Database:
mistral_invoices.db - API: Mistral with mistral-small-latest model (the newest version of Mistral Small 3.2 )
- Tabs: Invoice Extractor, Expense Tracker, Suppliers
Web based application (index.html file in Public directory) runs on localhost port 3002
http://localhost:3002Before installation, ensure you have:
- Node.js (version 14 or higher) - Download here
- npm (comes with Node.js)
- Mistral API Key - Get one here
# Check Node.js version
node --version
# Check npm version
npm --versionNote for v1.0.0 users: Python and
vat_checker.pyare no longer required. VAT checking is now natively integrated into Node.js. Simply runnpm installto get the newfast-xml-parserdependency.
Copy all necessary files and Public folder to chosen directory (mistral_server.js, mistral_database.js, package.json) or simply
git clone https://github.com/PetrAPConsulting/Invoice-processor.git
cd invoice-processornpm installThis will install all required Node.js packages including:
express- Web server frameworksqlite3- Database driverfast-xml-parser- XML parsing for VAT SOAP APInode-fetch- HTTP client- Other dependencies (cors, helmet, body-parser)
From the project directory:
npm startYou should see output like:
π Mistral Invoice Manager Server starting...
Connected to Mistral SQLite database: mistral_invoices.db
Mistral database tables initialized successfully
β
Mistral Invoice Manager Server running on port 3002
API available at: http://localhost:3002/api
Mistral Proxy available at: http://localhost:3002/api/mistral/chat
π Model: mistral-small-latest with T=0.1, top_p=0.95
πΎ Database: mistral_invoices.db
Open browser and insert:
http://localhost:3002When you first open app on
http://localhost:3002- Navigate to the "Invoice Extractor" tab
- Enter your Mistral API key in the API Configuration section
- Optionally enable password protection for the key
- Click "Save API Key"
The API key is stored encrypted in your browser's localStorage and is never sent anywhere except to Mistral API via the integrated proxy.
- Upload an invoice (PDF, PNG, JPG, JPEG, GIF, WEBP)
- Upload an ISDOC file (ISDOC XML format)
- Review extracted data - Mistral AI automatically extracts invoice fields
- VAT reliability check - System automatically checks VAT status
- Edit as needed - All fields are editable
- Download JSON or Add to Tracker
- View statistics by quarter and year
- Upload existing JSON files for bulk import
- Filter by quarter to see period-specific data
- Export data as CSV for reporting
- View supplier breakdown with pie chart and table
- Select date range - Choose start and end dates
- Click Load Data - Fetches invoices from database
- View statistics:
- Total Expenditures (including VAT)
- Total Suppliers
- Total Invoices
- Analyze suppliers:
- Pie chart (suppliers with β₯2% of total)
- All Suppliers table with share on you wallet (%) and number of invoices
The SQLite database file is created automatically at same directory.
You can directly edit the database using:
- DB Browser for SQLite - Download here
- DBeaver - Download here
- Any SQLite client
Simply open the mistral_invoices.db file to view and edit records.
To backup your data:
cp mistral_invoices.db mistral_invoices_backup_$(date +%Y%m%d).dbor export data directly from database
Issue: Port 3002 is already in use
Solution: :
- Change the port in
mistral_server.js:const PORT = 3000-5000; - And update
index.html:const API_BASE_URL = 'http://localhost:300x/api';
Issue: API errors or authentication failures
Solution:
- Verify Mistral API key is correct
- Check you have credits in your Mistral account
- Check browser console (F12) for specific error messages
- Ensure the server is running on same port as frontend html application
Possible causes:
- Incorrect VAT number format (system automatically strips non-digits)
- MF CR (Financial Directorate) API service is temporarily down
- Network connectivity issues
- SOAP service timeout (30 seconds)
Solutions:
- Verify the VAT number is correct
- Check server logs for detailed error messages
- Manually set the VAT reliability status if automatic check fails
- Wait a few minutes and try again if service is temporarily unavailable
The Mistral backend provides these REST API endpoints:
POST /api/mistral/chat- Process invoice extraction with Mistral AI
GET /api/health- Server health checkGET /api/invoices- Get all invoicesPOST /api/invoices- Add new invoiceGET /api/invoices/quarter/:quarter/year/:year- Get invoices by quarterPUT /api/invoices/:id- Update invoiceDELETE /api/invoices/:id- Delete invoiceDELETE /api/invoices- Clear all invoicesGET /api/stats?quarter=X&year=Y- Get statisticsGET /api/suppliers?quarter=X&year=Y- Get supplier statsGET /api/suppliers/daterange?startDate=YYYY-MM-DD&endDate=YYYY-MM-DD- Get suppliers by date rangePOST /api/check-vat- Check VAT reliability
YourAppFolder/
βββ mistral_server.js
βββ mistral_database.js
βββ mistral_invoices.db β SQLite database (created automatically)
βββ package.json
βββ public/ β All frontend files go here
β βββ index.html
β βββ Assets/
β βββ favicon.png
β βββ images.png
βββ node_modules/ β Installed
- API Keys: Mistral API keys are stored encrypted in browser localStorage
- Database: SQLite database has no authentication - suitable for single-user or trusted network use
- VAT Service: Connects to official Czech tax authority API (MFCR)
- Local Storage: Invoice data persists in database, not browser storage
- Proxy: Integrated proxy prevents CORS issues when calling Mistral API
- RAM: Minimum 2GB
- Disk Space: 100MB + space for database
- Network: Required for AI extraction and VAT checking
- Browser: Modern browser (Chrome, Firefox, Safari, Edge)
- Node.js Documentation: https://nodejs.org/docs/
- SQLite Documentation: https://www.sqlite.org/docs.html
- Express Documentation: https://expressjs.com/
- Mistral AI Documentation: https://docs.mistral.ai/
- Mistral API Console: https://console.mistral.ai/
This application is provided as-is for personal and commercial use.
Last Updated: December 2025 Version: 1.2.0 - Native Node.js