This is a complete full-stack application for AI-powered invoice management with QuickBooks integration, featuring a dual-panel React.js frontend and Node.js backend with AI capabilities.
- ✅ Complete QuickBooks OAuth 2.0 integration
- ✅ AI-powered natural language interface (OpenAI + Vercel AI SDK)
- ✅ Comprehensive invoice management API
- ✅ Automatic token refresh and session management
- ✅ Business analytics and insights
- ✅ Multi-step AI tool execution
- ✅ Real-time chat streaming
- ✅ Dual-Panel Interface: AI Chat + Invoice Data
- ✅ Real-time AI Chat: Natural language business queries
- ✅ Interactive Analytics: Revenue, unpaid amounts, overdue tracking
- ✅ Modern UI: TailwindCSS with responsive design
- ✅ Live Data Sync: Real-time updates between chat and data panels
- Node.js 16+ installed
- QuickBooks Developer account and app credentials
- OpenAI API key
# Install backend dependencies
npm install
# Configure environment variables
cp env.example .envEdit .env with your credentials:
QUICKBOOKS_CLIENT_ID=your_quickbooks_client_id_here
QUICKBOOKS_CLIENT_SECRET=your_quickbooks_client_secret_here
QUICKBOOKS_REDIRECT_URI=http://localhost:3000/auth/callback
QUICKBOOKS_ENVIRONMENT=sandbox
OPENAI_API_KEY=your_openai_api_key_here
PORT=3000
SESSION_SECRET=your_session_secret_here# Navigate to client directory
cd client
# Install frontend dependencies
npm install- Go to Intuit Developer Portal
- Create a new app or use existing one
- Get your Client ID and Client Secret
- Add
http://localhost:3000/auth/callbackto your app's redirect URIs
- Go to OpenAI Platform
- Create an API key
- Add it to your
.envfile
# From project root
npm startBackend will run on http://localhost:3000
# From project root
cd client
npm startFrontend will run on http://localhost:3001
- Open
http://localhost:3001in your browser - Click "Connect to QuickBooks"
- Complete the OAuth flow
- Start using the AI assistant!
server.js (Node.js + Express)
├── QuickBooks OAuth Integration
├── AI Tools (Vercel AI SDK)
│ ├── getInvoices
│ ├── getInvoiceById
│ ├── createInvoice
│ ├── getCustomers
│ ├── getCompanyInfo
│ ├── searchInvoices
│ └── analyzeInvoices
├── API Endpoints
│ ├── /auth/* (OAuth flow)
│ ├── /api/invoices
│ ├── /api/company
│ ├── /api/ai/chat
│ └── /api/ai/chat/stream
└── Token Management
client/src/
├── App.js (Main dual-panel layout)
├── components/
│ ├── ChatPanel.js (AI chat interface)
│ ├── InvoicePanel.js (Invoice data display)
│ ├── Header.js (App header)
│ └── AuthStatus.js (Authentication indicator)
├── utils/
│ └── api.js (API utilities)
└── index.css (TailwindCSS styles)
- "Show me my recent invoices" - Lists recent invoices
- "What's my total revenue?" - Displays revenue analytics
- "Find all unpaid invoices" - Filters unpaid invoices
- "Analyze my business performance" - Shows comprehensive analytics
- "Get customer information" - Lists customers
- "Show invoices over $1000" - Advanced filtering
- "Which invoices are overdue?" - Identifies overdue payments
- Natural Language Processing: Ask questions in plain English
- Multi-step Operations: AI can chain multiple tools together
- Business Analytics: Revenue analysis, payment tracking, customer insights
- Real-time Updates: Invoice panel updates automatically based on chat actions
- Tool Execution Tracking: See which tools the AI used to answer your questions
GET /auth/quickbooks- Initiate OAuth flowGET /auth/callback- Handle OAuth callbackPOST /auth/disconnect- Disconnect from QuickBooksGET /api/status- Check connection status
GET /api/company- Get company informationGET /api/invoices- Get invoices with filteringGET /api/invoices/:id- Get specific invoicePOST /api/invoices- Create new invoiceGET /api/bulk-data- Get comprehensive business data
POST /api/ai/chat- Natural language chatPOST /api/ai/chat/stream- Streaming chat responsesGET /api/ai/context- Get AI context data
# Test backend AI endpoint
curl -X POST http://localhost:3000/api/ai/chat \
-H "Content-Type: application/json" \
-d '{"message": "Show me my recent invoices", "sessionId": "test"}'
# Test frontend
# Open http://localhost:3001 and use the chat interface- Backend Changes: Server auto-restarts with nodemon
- Frontend Changes: React hot-reloads automatically
- Styling: TailwindCSS classes are available throughout
- New AI Tools: Add to
invoiceToolsobject in server.js
- Tokens stored in memory cache (use database in production)
- Session secret should be strong and unique
- Enable HTTPS in production
- Set
secure: truefor session cookies in production - Keep OpenAI API key secure and never commit to version control
npm run build # If using TypeScript
npm start # Production modecd client
npm run build # Creates optimized build/
# Deploy build/ folder to your hosting platformInvoice Management/
├── server.js # Backend server with AI integration
├── package.json # Backend dependencies
├── env.example # Environment variables template
├── README.md # This file
├── client/ # React frontend
│ ├── src/
│ │ ├── App.js # Main application
│ │ ├── components/ # React components
│ │ ├── utils/ # API utilities
│ │ └── index.css # Styles
│ ├── package.json # Frontend dependencies
│ └── README.md # Frontend documentation
└── test-request.json # API testing file
- 🤖 AI-Powered Interface: Ask questions about your business in natural language
- 📊 Real-time Analytics: Live business insights and performance tracking
- 🔄 QuickBooks Sync: Seamless integration with your accounting data
- 💬 Dual-Panel UI: Chat with AI while viewing invoice data
- 📱 Modern Design: Responsive, professional interface
- 🔧 Full API Access: Complete programmatic control over your invoice data
Start exploring your business data with natural language queries!