An intelligent invoice processing system for small businesses that automatically extracts, validates, and syncs invoices to accounting software.
- Automatic Email Ingestion: Connect Gmail, Outlook, or any IMAP email account
- AI-Powered OCR: Extract structured data from invoices with confidence scores
- Human-in-the-Loop Review: Review and correct invoices with visual validation
- Accounting Integration: Sync to QuickBooks Online, Xero, and more
- Multi-Currency Support: Handle invoices in multiple currencies
- Duplicate Detection: Automatically identify and flag duplicate invoices
- Role-Based Access: Admin, Accountant, Approver, and Viewer roles
- Audit Trail: Complete history of changes and approvals
- Analytics Dashboard: Track processing metrics and confidence scores
- Frontend: Next.js 14, React, TypeScript, Tailwind CSS, shadcn/ui
- Backend: Supabase (PostgreSQL), Next.js API Routes
- Authentication: Supabase Auth
- OCR/AI: Google Document AI / Amazon Textract
- Storage: Supabase Storage
- Deployment: Vercel (recommended)
- Node.js 18+ and npm/yarn/pnpm
- Supabase account (free tier works)
- Google Cloud account (for Document AI) OR AWS account (for Textract)
- QuickBooks Developer account (for accounting integration)
```bash git clone cd InvoiceFlow npm install ```
- Create a new project at supabase.com
- Go to SQL Editor and run the schema from
supabase/schema.sql - Create a storage bucket named
invoiceswith public access - Copy your project URL and anon key
Create a .env.local file in the root directory:
```bash
NEXT_PUBLIC_SUPABASE_URL=your_supabase_project_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key
GOOGLE_CLIENT_ID=your_google_oauth_client_id GOOGLE_CLIENT_SECRET=your_google_oauth_client_secret
MICROSOFT_CLIENT_ID=your_microsoft_client_id MICROSOFT_CLIENT_SECRET=your_microsoft_client_secret
GOOGLE_CLOUD_PROJECT_ID=your_gcp_project_id GOOGLE_APPLICATION_CREDENTIALS=path_to_service_account.json
AWS_ACCESS_KEY_ID=your_aws_access_key AWS_SECRET_ACCESS_KEY=your_aws_secret_key AWS_REGION=us-east-1
QUICKBOOKS_CLIENT_ID=your_quickbooks_client_id QUICKBOOKS_CLIENT_SECRET=your_quickbooks_client_secret QUICKBOOKS_REDIRECT_URI=http://localhost:3000/api/integrations/quickbooks/callback
NEXT_PUBLIC_APP_URL=http://localhost:3000 ENCRYPTION_KEY=your_32_character_encryption_key_here ```
- Go to Google Cloud Console
- Enable Document AI API
- Create a service account and download the JSON key
- Create a Document AI processor (Invoice Parser)
- Update environment variables with your project ID and credentials path
- Go to Google Cloud Console
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
http://localhost:3000/api/integrations/gmail/callback - Enable Gmail API
- Go to Intuit Developer Portal
- Create an app and get client ID/secret
- Add redirect URI:
http://localhost:3000/api/integrations/quickbooks/callback
```bash npm run dev ```
Open http://localhost:3000 in your browser.
``` InvoiceFlow/ ├── app/ # Next.js 14 app directory │ ├── api/ # API routes │ │ ├── invoices/ # Invoice processing endpoints │ │ ├── integrations/ # OAuth & sync endpoints │ │ └── ocr/ # Document extraction │ ├── dashboard/ # Main application pages │ │ ├── inbox/ # Invoice inbox │ │ ├── review/ # Review queue │ │ ├── invoices/ # Invoice details │ │ ├── settings/ # Settings pages │ │ └── layout.tsx # Dashboard layout │ ├── login/ # Authentication │ ├── signup/ │ ├── onboarding/ # First-time setup wizard │ ├── globals.css # Global styles │ └── layout.tsx # Root layout ├── components/ │ ├── ui/ # shadcn/ui components │ ├── invoice/ # Invoice-specific components │ └── dashboard/ # Dashboard components ├── lib/ │ ├── supabase/ # Supabase clients │ ├── utils.ts # Utility functions │ └── ocr/ # OCR service integrations ├── types/ # TypeScript type definitions ├── supabase/ │ └── schema.sql # Database schema ├── public/ # Static assets └── README.md ```
- Push your code to GitHub
- Import project in Vercel
- Add all environment variables
- Deploy!
```bash npm run build ```
Make sure to update these in your production environment:
- Change
NEXT_PUBLIC_APP_URLto your production domain - Update all OAuth redirect URIs
- Use production Supabase project
- Secure your
ENCRYPTION_KEY
- Sign Up: Create an account at
/signup - Connect Email: Go to Settings → Integrations → Connect Gmail/Outlook
- Connect Accounting: Connect QuickBooks or Xero
- Configure Company: Set currency, tax codes, GL accounts
- Test with Sample: Upload a sample invoice to test the flow
- Inbox: New invoices appear automatically from connected email
- Review: Click on invoices needing attention (low confidence)
- Validate: Review extracted fields against PDF preview
- Approve: Approve to sync to accounting system
- Monitor: Check dashboard for processing metrics
- Admin: Full access, manage users and settings
- Accountant: Review, approve, and manage invoices
- Approver: Review and approve invoices
- Viewer: Read-only access
- Row-Level Security (RLS) enabled on all tables
- OAuth tokens encrypted at rest
- TLS in transit for all communications
- Role-based access control
- Complete audit trail
- Data retention policies
```bash
npm run type-check
npm run lint
npm run build ```
POST /api/invoices/upload- Upload invoice fileGET /api/invoices- List invoicesGET /api/invoices/[id]- Get invoice detailsPATCH /api/invoices/[id]- Update invoicePOST /api/invoices/[id]/approve- Approve and sync
GET /api/integrations/gmail/authorize- Start Gmail OAuthGET /api/integrations/quickbooks/authorize- Start QuickBooks OAuthPOST /api/integrations/[type]/sync- Trigger manual sync
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is proprietary software. All rights reserved.
For issues and questions:
- GitHub Issues: [Create an issue]
- Documentation: [Link to docs]
- Email: support@invoiceflow.com
- Xero integration
- Sage integration
- Mobile app (iOS/Android)
- Advanced fraud detection
- Multi-language support expansion
- Batch approval workflows
- Custom field extraction
- API for third-party integrations
- White-label option
Made with ❤️ for small businesses worldwide ```