A Node.js web app for generating barcodes. Create Code128 and Code39 barcodes with customizable options.
This tutorial requires an APIVerve API key. Sign up free - no credit card required.
- Generate Code128 barcodes (alphanumeric)
- Generate Code39 barcodes
- Option to show/hide value text
- Download generated barcodes
- Clean, modern web interface
- Built with Express.js
-
Clone this repository
git clone https://github.com/apiverve/barcode-generator-node-tutorial.git cd barcode-generator-node-tutorial -
Install dependencies
npm install
-
Add your API key
Set environment variable or edit
server.js:export API_KEY=your-api-key-here -
Start the server
npm start
-
Open in browser
Visit http://localhost:3000 and generate barcodes!
barcode-generator-node-tutorial/
├── server.js # Express server & API endpoint
├── public/
│ └── index.html # Frontend UI
├── package.json # Dependencies
├── screenshot.jpg # Preview image
├── LICENSE # MIT license
├── .gitignore # Git ignore rules
└── README.md # This file
- User enters data to encode
- User selects barcode type (Code128 or Code39)
- Frontend sends POST request to
/api/generate - Server calls the Barcode Generator API
- API returns image URL
- Frontend displays barcode with download option
const response = await fetch('https://api.apiverve.com/v1/barcodegenerator', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'x-api-key': API_KEY
},
body: JSON.stringify({
data: '1234567890',
type: 'code128',
displayValue: true
})
});Endpoint: POST https://api.apiverve.com/v1/barcodegenerator
Request Body:
| Parameter | Type | Required | Description |
|---|---|---|---|
data |
string | Yes | Data to encode |
type |
string | Yes | Barcode type (code128, code39) |
displayValue |
boolean | No | Show value below barcode (default: true) |
Example Response:
{
"status": "ok",
"error": null,
"data": {
"imageName": "cc85680f-a1d0-4627-89ff-7d7e53663a2b.png",
"format": ".png",
"type": "CODE128",
"expires": 1766010012598,
"downloadURL": "https://storage.googleapis.com/apiverve/..."
}
}| Type | Characters | Use Case |
|---|---|---|
| Code128 | All ASCII | General purpose, high density |
| Code39 | A-Z, 0-9, - . $ / + % SPACE | Industrial, government |
- Inventory management - Label products with barcodes
- Shipping labels - Generate tracking barcodes
- Asset tracking - Tag equipment and assets
- Library systems - Generate book barcodes
- Event tickets - Create scannable tickets
- ID badges - Add barcodes to ID cards
- Add more barcode formats (EAN, UPC, etc.)
- Add batch generation
- Save barcode history
- Add custom colors
- Print directly from browser
- Generate barcodes from spreadsheet
Explore more APIs at APIVerve:
- QR Code Generator - Generate QR codes
- QR Code Reader - Read QR codes
- Invoice Generator - Generate invoices
This tutorial works with the free APIVerve plan. Some APIs may have:
- Locked fields: Premium response fields return
nullon free plans - Ignored parameters: Some optional parameters require a paid plan
The API response includes a premium object when limitations apply. Upgrade anytime to unlock all features.
MIT - see LICENSE
- Get API Key - Sign up free
- APIVerve Marketplace - Browse 300+ APIs
- Barcode Generator API - API details
