A full-stack MERN application that leverages Google Gemini AI to extract structured invoice data from raw text, automate invoice creation, and provide business insights.
- AI Invoice Parser — Paste any raw text, and AI extracts client name, items, prices, and address automatically
- AI Email Reminder — Generate a professional payment reminder email for any invoice with one click
- AI Dashboard Insights — Get AI-powered business analytics based on your invoice data
- Invoice Management — Create, view, update status (Paid/Unpaid), and delete invoices
- Search & Filter — Search invoices by invoice number or client name, filter by status
- Print / Download — Print any invoice directly from the browser as a PDF
- Profile & Prefill — Save your business details and auto-fill the "Bill From" section when creating invoices
- Authentication — Secure login and signup with JWT-based auth and protected routes
- Toast Notifications — Real-time success/error feedback on all actions
- Node.js + Express.js
- MongoDB + Mongoose
- JWT for authentication
- bcryptjs for password hashing
- Google Gemini AI (
@google/genai) for all AI features
- React (Vite)
- Tailwind CSS
- Axios for API calls
- React Router DOM for routing
- React Hot Toast for notifications
- Lucide React for icons
- Inter (Google Fonts)
ai-invoice-generator/
├── backend/
│ ├── config/
│ │ └── db.js
│ ├── controllers/
│ │ ├── aicontroller.js
│ │ ├── authcontroller.js
│ │ └── invoicecontroller.js
│ ├── middlewares/
│ │ └── authmiddleware.js
│ ├── models/
│ │ ├── Invoice.js
│ │ └── User.js
│ ├── routes/
│ │ ├── airoutes.js
│ │ ├── authroutes.js
│ │ └── invoiceroutes.js
│ └── server.js
│
└── frontend/invoice-generator/
└── src/
├── components/
│ ├── auth/
│ │ └── ProtectedRoutes.jsx
│ └── layouts/
│ ├── DashboardLayout.jsx
│ ├── Navbar.jsx
│ └── Sidebar.jsx
├── context/
│ └── AuthContext.jsx
├── pages/
│ ├── AI/AIParser.jsx
│ ├── Auth/Login.jsx
│ ├── Auth/SignUp.jsx
│ ├── Dashboard/Dashboard.jsx
│ ├── Invoices/AllInvoices.jsx
│ ├── Invoices/CreateInvoice.jsx
│ ├── Invoices/InvoiceDetail.jsx
│ ├── LandingPage/LandingPage.jsx
│ └── Profile/ProfilePage.jsx
└── utils/
├── apiPaths.js
├── axiosInstance.js
└── helper.js
- Node.js (v18+)
- MongoDB Atlas account
- Google Gemini API key
git clone https://github.com/Mridul012/ai-invoice-generator.git
cd ai-invoice-generatorcd backend
npm installCreate a .env file inside the backend/ folder:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret_key
PORT=8000
GEMINI_API_KEY=your_gemini_api_keyStart the backend server:
npm run devcd frontend/invoice-generator
npm install
npm run devThe app will be available at http://localhost:5173
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/auth/register |
Register a new user |
| POST | /api/auth/login |
Login and get JWT token |
| GET | /api/auth/me |
Get current user profile |
| PUT | /api/auth/me |
Update user profile |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/invoices |
Create a new invoice |
| GET | /api/invoices |
Get all invoices for user |
| GET | /api/invoices/:id |
Get invoice by ID |
| PUT | /api/invoices/:id |
Update invoice |
| DELETE | /api/invoices/:id |
Delete invoice |
| Method | Endpoint | Description |
|---|---|---|
| POST | /api/ai/parse-text |
Parse raw text into invoice data |
| POST | /api/ai/generate-remainder |
Generate payment reminder email |
| POST | /api/ai/dashboard-summary |
Get AI business insights |
| Variable | Description |
|---|---|
MONGO_URI |
MongoDB connection string |
JWT_SECRET |
Secret key for signing JWT tokens |
PORT |
Backend server port (default: 8000) |
GEMINI_API_KEY |
Google Gemini API key |
Never commit your
.envfile. It is already listed in.gitignore.
Mridul — @Mridul012