Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

Code39 Barcode Generator - Web Application

A modern, AI-powered web application for generating professional Code39 barcodes. Built with Next.js, Tailwind CSS, and Claude AI.

Features

  • ✨ AI-Powered Configuration: Describe what you need in natural language, and Claude AI automatically fills the form
  • πŸ“Š Customizable Barcodes: Adjust prefix, quantity, page size, and barcode dimensions
  • 🎨 Font Customization: Choose from multiple PDF-standard fonts (Helvetica, Times, Courier)
  • πŸ“„ PDF Output: One barcode per page, perfect for printing labels
  • ⚑ Fast Generation: Generate up to 1000 barcodes in seconds
  • 🎯 User-Friendly: Clean, modern interface with real-time preview

Quick Start

1. Install Dependencies

npm install

2. Set Up Environment

cp .env.example .env.local

Edit .env.local and add your Anthropic API key:

ANTHROPIC_API_KEY=sk-ant-xxxxx

Get your API key from: https://console.anthropic.com/

3. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.

4. Build for Production

npm run build
npm start

Usage

Basic Usage

  1. Enter barcode details:

    • Prefix: "1001", "ASSET", "PROD", etc.
    • Start Number: Starting number for sequential generation
    • Quantity: How many barcodes to generate (1-1000)
  2. Adjust page size:

    • Width: 1.5 inches (default for labels)
    • Height: 1.0 inches (default for labels)
  3. Click "Generate & Download PDF"

Using AI Assistance

  1. Describe your needs:

    • "I need 100 asset tags for inventory tracking"
    • "50 product labels starting from 5000"
    • "200 barcodes for warehouse items"
  2. Click "✨ Fill Form with AI"

  3. Claude AI automatically configures all settings with reasoning

Advanced Settings

  • Scale (1-5): Image quality/resolution
  • Bar Height: Taller bars = easier scanning
  • Bar Width: Module width in millimeters
  • Font Size: Text size below barcode
  • Font Style: Choose from 6 PDF-standard fonts

Project Structure

barcode-webapp/
β”œβ”€β”€ app/
β”‚ β”œβ”€β”€ api/
β”‚ β”‚ β”œβ”€β”€ generate/route.ts # PDF generation API
β”‚ β”‚ └── ai-assist/route.ts # Claude AI API
β”‚ └── page.tsx # Main UI
β”œβ”€β”€ lib/
β”‚ β”œβ”€β”€ barcode-generator.ts # Barcode logic
β”‚ └── pdf-builder.ts # PDF creation
β”œβ”€β”€ public/
β”‚ β”œβ”€β”€ barcode-icon.svg # Custom favicon
β”‚ └── og-image.svg # Social media preview
β”œβ”€β”€ .env.example
β”œβ”€β”€ docker-compose.yml
β”œβ”€β”€ Dockerfile
β”œβ”€β”€ deploy-to-t630.sh
└── Documentation/
 β”œβ”€β”€ README.md # This file
 β”œβ”€β”€ PROJECT-SUMMARY.md # Complete project overview
 β”œβ”€β”€ DEPLOYMENT-SUCCESS.md # Deployment status
 β”œβ”€β”€ NGINX-PROXY-SETUP.md # Public access guide
 β”œβ”€β”€ DEPLOYMENT-CHECKLIST.md # Deployment steps
 └── BRANDING.md # Favicon & metadata

Technology Stack

  • Frontend: Next.js 15, React, Tailwind CSS
  • Barcode: bwip-js (Code39)
  • PDF: PDFKit
  • AI: Claude 3.5 Sonnet
  • Type Safety: TypeScript

Deployment to T630 Homelab

Quick Deploy

  1. Set your API key in the deployment script:
export ANTHROPIC_API_KEY=sk-ant-xxxxx
  1. Run the deployment script:
./deploy-to-t630.sh
  1. Access the app:

Manual Deployment

If you prefer manual deployment:

  1. SSH to your server:
ssh t630
  1. Create app directory:
mkdir -p ~/homelab/apps/barcode-generator
cd ~/homelab/apps/barcode-generator
  1. Copy files from your local machine:
# On your Mac
rsync -avz --exclude 'node_modules' --exclude '.next' \
 . t630:~/homelab/apps/barcode-generator/
  1. Set environment variable on server:
ssh t630
cd ~/homelab/apps/barcode-generator
echo "ANTHROPIC_API_KEY=sk-ant-xxxxx" > .env.local
  1. Build and start:
docker compose up -d --build

Management Commands

# View logs
ssh t630 "docker logs -f barcode-generator"
# Restart
ssh t630 "docker restart barcode-generator"
# Stop
ssh t630 "cd ~/homelab/apps/barcode-generator && docker compose down"
# Rebuild after code changes
ssh t630 "cd ~/homelab/apps/barcode-generator && docker compose up -d --build"

Integration with Homepage Dashboard

The barcode generator will automatically appear in your Homepage dashboard under the "Tools" section with these labels configured in docker-compose.yml.

Public Internet Access

βœ… LIVE AND DEPLOYED: https://barcode.mght630.com

The barcode generator is publicly accessible from anywhere in the world!

Access URLs

Method URL Status
Public Internet https://barcode.mght630.com βœ… Live - accessible worldwide
Local Network http://192.168.254.126:3002 βœ… Direct access from home network
Tailscale VPN http://100.85.179.110:3002 βœ… Secure remote access

Current Configuration

Nginx Proxy Manager:

  • Domain: barcode.mght630.com
  • Forward to: barcode-generator:3000 (Docker internal)
  • SSL: Let's Encrypt (auto-renews every 90 days)
  • Security: Force SSL, HTTP/2, HSTS enabled

Cloudflare:

  • DNS: barcode.mght630.com β†’ 47.198.52.185
  • Proxy: ☁️ Enabled (DDoS protection + CDN)
  • SSL/TLS: Full mode

Security Note

⚠️ Important: This app uses your Anthropic API key for AI features.

Current Status: Public access (no authentication)

  • βœ… Anyone can generate barcodes manually
  • ⚠️ Anyone can use AI features (consumes API credits)
  • πŸ’‘ Monitor usage at: https://console.anthropic.com/

To add authentication later:

  • See NGINX-PROXY-SETUP.md for HTTP Basic Auth instructions
  • Or set up IP whitelisting to restrict access

Common Use Cases

Inventory Labels (1.5" ×ば぀ 1"):

  • Prefix: INV, Start: 1, Count: 500

Asset Tags (2" ×ば぀ 1"):

  • Prefix: ASSET, Start: 1000, Count: 200

Product Labels (2" ×ば぀ 3"):

  • Prefix: PROD, Start: 5000, Count: 100

Troubleshooting

AI Not Working: Verify ANTHROPIC_API_KEY in .env.local

Barcodes Won't Scan: Increase scale and bar height

Build Errors: Clear cache with rm -rf .next node_modules && npm install

License

MIT License - Free to use and modify


πŸ“š Complete Documentation


Built with Next.js, Tailwind CSS, Claude AI, and ❀️ by Matt Hicks

Live at: https://barcode.mght630.com

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /