A complete invoice generation application built with Node.js and Express. Create professional PDF invoices with a beautiful form interface.
This tutorial requires an APIVerve API key. Sign up free - no credit card required.
- Professional PDF invoice generation
- Beautiful dark mode form interface
- Dynamic line items (add/remove)
- Auto-calculated totals
- Company and client details
- Custom notes and payment terms
- Downloadable PDF output
- Responsive design
-
Clone this repository
git clone https://github.com/apiverve/invoice-generator-node-tutorial.git cd invoice-generator-node-tutorial -
Install dependencies
npm install
-
Add your API key
Open
src/config.jsand replace the placeholder:API_KEY: 'your-api-key-here' -
Start the server
npm start
-
Open in browser
Navigate to
http://localhost:3000
invoice-generator-node-tutorial/
├── src/
│ ├── routes/
│ │ └── generate.js # Invoice generation endpoint
│ ├── config.js # API key and settings
│ └── index.js # Express app setup
├── public/
│ └── index.html # Frontend form and UI
├── package.json # Dependencies
├── screenshot.jpg # Preview image
├── LICENSE # MIT license
├── .gitignore # Git ignore rules
└── README.md # This file
- User fills form - Enter invoice details, company info, line items
- Submit to server - POST request to
/api/generate - API call - Server sends data to APIVerve Invoice Generator
- PDF generation - API creates professional PDF invoice
- Download - User receives download link for the PDF
const response = await fetch(API_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY
},
body: JSON.stringify(invoiceData)
});Endpoint: POST https://api.apiverve.com/v1/invoicegenerator
Headers:
| Header | Value |
|---|---|
Content-Type |
application/json |
x-api-key |
Your API key |
Request Body:
{
"invoiceNumber": "INV-001",
"invoiceDate": "2024-01-15",
"dueDate": "2024-02-15",
"currency": "USD",
"from": {
"name": "Your Company Inc.",
"email": "[email protected]",
"address": "123 Business St, City, Country"
},
"to": {
"name": "Client Company",
"email": "[email protected]",
"address": "456 Client Ave, City, Country"
},
"items": [
{
"description": "Web Development Services",
"quantity": 10,
"unitPrice": 150,
"amount": 1500
}
],
"notes": "Payment due within 30 days. Thank you for your business!"
}Example Response:
{
"status": "ok",
"error": null,
"data": {
"downloadURL": "https://storage.apiverve.com/invoices/abc123.pdf",
"invoiceNumber": "INV-001"
}
}Invoice generation is essential for:
- Freelancers - Bill clients for projects
- Small Businesses - Create professional invoices
- SaaS Products - Generate subscription invoices
- Contractors - Invoice for hourly work
- E-commerce - Order receipts and invoices
- Service Providers - Bill for services rendered
- Add company logo upload
- Support multiple currencies
- Add tax calculation
- Email invoice directly to client
- Create recurring invoice templates
- Add payment status tracking
- Generate invoice from saved templates
- Node.js - JavaScript runtime
- Express - Web framework
- Vanilla JS - Frontend (no framework needed)
Explore more APIs at APIVerve:
- QR Code Generator - Add QR codes to invoices
- HTML to PDF - Convert custom HTML to PDF
- Email Validator - Validate client emails
MIT - see LICENSE
- Get API Key - Sign up free
- APIVerve Marketplace - Browse 300+ APIs
- Invoice Generator API - API details
