An intelligent invoice management web app that uses AI to extract, organize, and manage invoice data from PDFs, images, and Excel files. Extracted data is automatically structured into three connected views โ Invoices, Products, and Customers โ with real-time editing, search, sorting, pagination, and one-click export.
๐ Live demo: https://aipims.vercel.app/
- Upload PDF, PNG/JPG, or Excel (.xlsx) files.
- PDFs and images are parsed by Google Gemini to extract invoice information, line items, charges, totals, and bank details.
- Excel files are parsed server-side and grouped into invoices automatically.
- Per-file upload progress with success/error status and one-click retry for failed files.
- Invoices โ invoice number, customer, editable date, line items, and an auto-calculated total per invoice.
- Products โ a flat, sortable list of all line items with an aggregate totals row.
- Customers โ customers grouped by name/phone with total purchase amount and bank details.
- Editing a value in one view updates it everywhere instantly via centralized Redux state.
- ๐ Search across each view.
โ๏ธ Sorting on the Products table (product, quantity, rate, amount).- ๐ Pagination for large datasets.
- ๐๏ธ Delete individual invoices/items or clear all data (with confirmation).
- ๐ค Export to CSV or Excel.
- ๐พ Local persistence โ data is saved to
localStorageand survives page reloads. - โ Inline validation for numeric fields with automatic total recalculation.
- Clean, minimal, responsive interface built with Tailwind CSS v4.
- Reusable component system (navbar, page headers, toolbars, dialogs).
- Toast notifications for key actions.
| Area | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| Language | TypeScript 5 |
| UI Library | React 19 |
| Styling | Tailwind CSS v4, shadcn/ui (Radix primitives) |
| State | Redux Toolkit + React-Redux |
| AI | Google Gemini (@google/generative-ai) |
| Files | SheetJS (xlsx) |
| Icons | lucide-react |
| Toasts | react-hot-toast |
| Linting | ESLint 9 (flat config) |
| Hosting | Vercel |
- Node.js v18.18 or higher
- npm (or yarn/pnpm)
- A Google Gemini API key โ get one here
- Clone the repository:
git clone https://github.com/thekavikumar/ai-powered-invoice.git cd ai-powered-invoice - Install dependencies:
npm install
- Create a
.env.localfile in the project root:API_KEY=your_gemini_api_key
- Start the development server:
npm run dev
- Open http://localhost:3000.
| Command | Description |
|---|---|
npm run dev |
Start the development server (Turbopack) |
npm run build |
Create an optimized production build |
npm run start |
Run the production build |
npm run lint |
Lint the project with ESLint |
.
โโโ public/ # Static assets (preview.png, logo.png, svgs)
โโโ src/
โ โโโ app/ # Next.js App Router
โ โ โโโ api/
โ โ โ โโโ extract/ # AI extraction endpoint (PDF/image โ Gemini)
โ โ โ โโโ processXlsx/ # Excel parsing endpoint
โ โ โโโ customers/ # Customers page
โ โ โโโ invoices/ # Invoices page
โ โ โโโ products/ # Products page
โ โ โโโ favicon.ico
โ โ โโโ globals.css # Tailwind v4 + theme tokens
โ โ โโโ layout.tsx # Root layout + SEO metadata
โ โ โโโ page.tsx # Landing page
โ โโโ assets/ # Source images (banner, logo, preview)
โ โโโ components/
โ โ โโโ ui/ # shadcn/ui primitives (button, dialog, input, label)
โ โ โโโ CustomLink.tsx
โ โ โโโ ExportButtons.tsx # CSV/Excel export + clear all
โ โ โโโ Navbar.tsx # Sub-route navigation
โ โ โโโ PageHeader.tsx
โ โ โโโ Pagination.tsx
โ โ โโโ ReduxWrapper.tsx # Redux provider + localStorage persistence
โ โ โโโ SearchBar.tsx
โ โ โโโ UploadBtn.tsx # Upload dialog with per-file status
โ โโโ lib/
โ โ โโโ export.ts # CSV/XLSX export helpers
โ โ โโโ ui.ts # Shared className constants
โ โ โโโ utils.ts # cn() helper
โ โโโ redux/
โ โโโ slices/
โ โ โโโ invoicesSlice.ts
โ โโโ store.ts
โโโ eslint.config.mjs # ESLint 9 flat config
โโโ next.config.ts
โโโ package.json
โโโ postcss.config.mjs
โโโ tailwind.config.ts
โโโ tsconfig.json
Extracts structured data from a PDF or image using Google Gemini.
Request body
{
"file": "<base64-encoded-file>",
"mimeType": "application/pdf | image/png | image/jpeg"
}Response
{
"success": true,
"data": "{ \"invoiceInformation\": {}, \"items\": [], \"chargesAndTotals\": {}, \"bankDetails\": {} }"
}Parses an Excel file and groups rows into invoices.
Request body
{
"file": "<base64-encoded-xlsx>"
}Response
{
"success": true,
"data": [
{
"invoiceInformation": {},
"items": [],
"chargesAndTotals": {}
}
]
}- Single invoice PDF
- Invoice PDF + image together
- Single Excel file
- Multiple Excel files
- Mixed file types in one upload
Missing fields are left blank and can be edited manually; failed uploads can be retried individually.
The app is deployed on Vercel at https://aipims.vercel.app/.
To deploy your own instance:
- Push the repository to GitHub.
- Import it into Vercel.
- Add the
API_KEYenvironment variable in the project settings. - Deploy.
- Fork the repository.
- Create a feature branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add new feature" - Push the branch:
git push origin feature-name
- Open a pull request.

