4d6fd1e348b79b2a2f45b77e3e73f6d2389e5eb6
All checks were successful
Deploy Production (qr.crewsportswear.app) / deploy (push) Successful in 31s
QR Code API (Node.js)
Simple micro app that returns a QR code image from an API call.
Setup
npm install
Run
npm run dev
# or
npm start
Default URL: http://localhost:3000
Endpoints
GET /healthGET /api/qr?text=Hello%20WorldPOST /api/qrwith JSON body
GET example
curl "http://localhost:3000/api/qr?text=Hello%20World&size=400" --output qr.png
POST example
curl -X POST "http://localhost:3000/api/qr" \
-H "Content-Type: application/json" \
-d '{"text":"https://crewsportswear.app","size":500,"margin":2}' \
--output qr.png
Optional parameters
size(number, default512, min128, max2048)margin(number, default2, min0, max10)dark(hex color, default#000000)light(hex color, default#FFFFFF)
Docker
Local Docker run
docker compose -f docker-compose.local.yml up -d --build
Local URL: http://localhost:3000
Production (Traefik)
docker compose -f docker-compose.prod.yml up -d --build
Traefik host rule: qr.crewsportswear.app
Notes:
- Uses external Docker networks:
traefik-publicandcrew-app-net - Internal service port is
3000 - TLS uses Traefik Let's Encrypt via
tls.certresolver=le - Includes HTTP -> HTTPS redirect via Traefik labels
Restrict QR generation by IP
The /api/qr endpoints support IP allowlisting via environment variable.
ALLOWED_QR_IPS: comma-separated list of allowed client IPsTRUST_PROXY: keep thistruebehind Traefik so client IP is read from forwarded headers
Example .env values for production:
ALLOWED_QR_IPS=203.0.113.10,198.51.100.22
TRUST_PROXY=true
If ALLOWED_QR_IPS is empty, IP filtering is disabled.
Description
Languages
JavaScript
90.2%
Dockerfile
9.8%