How ashwarygupta/invox works
Invox is an invoice-management product spanning a Next.js interface and FastAPI services. Users authenticate, import invoices by upload or connected email, review and manage extracted records, and query them through dashboard analytics or natural-language chat. The README documents Gemini-based extraction, Gmail/IMAP polling, exports, and approval automation; sampled code directly confirms the hybrid chat routing, OAuth handoff, API client behavior, and persistence setup. Several endpoint and processing implementations were not sampled, so their internal wiring is represented only at the documented subsystem level.
Main entry points: main.py FastAPI app · client.ts API client · layout.tsx Next.js app · hybrid_query_engine.py Query router
Components 27
Web app
- Next.js app
app/layout.tsx - Dashboard
app/dashboard/DashboardContent.tsx - Invoice upload
components/FileUploader.tsx - Invoice chat
components/ChatInterface.tsx - Gmail connect
components/GmailOAuthButton.tsx - Google sign-in
app/api/auth/[...nextauth]/route.ts - API client
lib/api/client.ts
Backend API
- FastAPI app
backend/app/main.py - Auth endpoints
backend/app/api/v1/endpoints/auth.py - Invoice endpoints
backend/app/api/v1/endpoints/invoices.py - Chat endpoint
backend/app/api/v1/endpoints/chat.py - Email config
backend/app/api/v1/endpoints/email_config.py - Gmail OAuth
backend/app/api/v1/endpoints/gmail_oauth.py
Invoice services
- Invoice extraction
backend/app/services/invoice_processing.py - Query router
backend/app/services/hybrid_query_engine.py - Query classifier
backend/app/services/query_classifier.py - SQL agent
backend/app/services/sql_agent.py - Semantic search
backend/app/services/rag_system.py - Email polling
backend/app/services/email_polling.py - Polling worker
backend/app/workers/email_poller.py
Data and integrations
- Relational database
backend/app/db/session.py - ChromaDB index
backend/app/services/rag_system.py
Other components
- Invoice user
- Google OAuth
- Gmail API / IMAP
- Gemini AI
- OpenRouter LLM
Connections 38
- Invoice user → Next.js app: uses
- Next.js app → Dashboard: opens
- Next.js app → Invoice upload: opens
- Next.js app → Invoice chat: opens
- Next.js app → Gmail connect: opens
- Invoice user → Google sign-in: signs in
- Google sign-in → Google OAuth: authenticates
- Google sign-in → Auth endpoints: posts OAuth data
- Dashboard → API client: requests data
- Invoice upload → API client: uploads file
- Invoice chat → API client: sends query
- Gmail connect → API client: requests OAuth
- API client → FastAPI app: calls API
- FastAPI app → Auth endpoints: dispatches
- FastAPI app → Invoice endpoints: dispatches
- FastAPI app → Chat endpoint: dispatches
- FastAPI app → Email config: dispatches
- FastAPI app → Gmail OAuth: dispatches
- Invoice endpoints → Invoice extraction: processes invoice
- Invoice extraction → Gemini AI: extracts fields
- Invoice endpoints → Relational database: reads and writes
- Invoice extraction → Relational database: stores extracted data
- Dashboard → API client: loads analytics
- Chat endpoint → Query router: queries
- Query router → Query classifier: classifies query
- Query router → SQL agent: runs analytics
- Query router → Semantic search: runs semantic search
- SQL agent → Relational database: queries invoices
- Semantic search → ChromaDB index: searches index
- Semantic search → Relational database: loads invoices
- Query router → OpenRouter LLM: synthesizes answer
- Gmail connect → Gmail OAuth: connects account
- Gmail OAuth → Gmail API / IMAP: exchanges OAuth code
- Gmail OAuth → Relational database: stores credentials
- Email config → Email polling: triggers polling
- Polling worker → Email polling: runs polling
- Email polling → Gmail API / IMAP: checks mail
- Email polling → Invoice extraction: submits invoices