Barcode generator template
- Node.js
- Express
Make Code 128 and Code 39 barcode images for products, shelves and shipping labels.
A Node.js and Express app that makes barcode images. Enter a SKU, order number or any text, pick Code 128 or Code 39, choose whether to print the value underneath, and download the barcode as a PNG. Use it to print labels by hand, or call the route to add barcodes to packing slips.

What it does
- Code 128 and Code 39
- The two formats most scanners and label printers read, for letters and numbers.
- Ready to print
- Returns a PNG with the value printed under the bars, or without it if you prefer.
- Keeps your key private
- The page calls your own server, which holds the key and limits each visitor to 10 barcodes a minute.
How it works
The route that makes a barcode.
const TYPES = ['code128', 'code39'];
// POST /api/generate { data, type, displayValue }
app.post('/api/generate', async (req, res) => {
const data = str(req.body.data, 80);
const type = TYPES.includes(req.body.type) ? req.body.type : 'code128';
const displayValue = req.body.displayValue !== false;
if (!data) return res.status(400).json({ error: 'Enter the text to encode.' });
try {
const result = await callApi('barcodegenerator', { body: { data, type, displayValue } });
res.json({ success: true, data, type, imageUrl: result.downloadURL });
} catch (err) {
res.status(err.status || 502).json({ error: err.message });
}
});Deploy it
- Get a free API key
The free plan includes 200 credits a month, no card needed. Create your key.
- Deploy it
Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for
APIVERVE_API_KEY: paste your key there. - Open your app
Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.
Try the Barcode Generator API — the call this template makes
No key required to try it. Get a key to use it in your app.
{
"status": "ok",
"error": null,
"data": {
"imageName": "cc85680f-a1d0-4627-89ff-7d7e53663a2b.png",
"format": ".png",
"type": "CODE128",
"expires": 1766010012598,
"downloadURL": "https://storage.googleapis.com/apiverve/APIData/barcodegenerator/cc85680f-a1d0-4627-89ff-7d7e53663a2b.png?GoogleAccessId=635500398038-compute%40developer.gserviceaccount.com&Expires=1766010012&Signature=cV6ANXGGaVDdl5SOFZt3xm2haHBnOklW1zXQICvJlGNlF4kwYVP9i%2F1RAN8NBGxSUiMk4Zcro%2FJUb3W%2Fwy8jA86pyEXTwIjNAiGW94ikpKSXs6%2FiV42Rwv6u2gX%2B2FH7XYyixlwJ%2B%2FHpfGcvka6u01FDk%2F2TUcR7%2FxsZ%2FmXPU2KTrzsI6XttCGBcHhex3LdTv%2F8tzMJbSshbZn%2BGcRTddwv6dC4lCcTtGE6Bl2zqY9s92KIr9X%2F4xj34q4XKBzywgXES57QaVhZeGPPOOUfLtI3pAN8fVSyM%2B9NBMU7R46xyqJ0J8PSVpQZhhAHn03T%2B40rcNp26GXqauM9K%2BLwZRw%3D%3D"
}
}