- funPrinting runs on Render (cloud) at
https://your-app.onrender.com - Printer API runs locally on
http://localhost:3001 - They cannot communicate directly because localhost is not accessible from the internet
ngrok creates a secure tunnel from the internet to your local server.
# macOS
brew install ngrok
# Or download from https://ngrok.com/download- Sign up for free ngrok account at https://ngrok.com
- Get your authtoken from https://dashboard.ngrok.com/get-started/your-authtoken
- Configure ngrok:
ngrok config add-authtoken YOUR_AUTH_TOKEN
# Start printer API
cd printer-api
npm start
# In another terminal, start ngrok tunnel
ngrok http 3001ngrok will give you a public URL like:
Forwarding: https://abc123.ngrok-free.app -> http://localhost:3001
Update .env.local in funPrinting:
PRINTER_API_URLS=["https://abc123.ngrok-free.app"]
PRINTER_API_KEY=your_api_key_hereNote: Free ngrok URLs change every time you restart. For production, use ngrok paid plan with static domain.
localtunnel is a free alternative to ngrok.
npm install -g localtunnel# Start printer API
cd printer-api
npm start
# In another terminal, start localtunnel
lt --port 3001 --subdomain your-unique-namelocaltunnel will give you a public URL like:
your url is: https://your-unique-name.loca.lt
Update .env.local in funPrinting:
PRINTER_API_URLS=["https://your-unique-name.loca.lt"]
PRINTER_API_KEY=your_api_key_hereNote: Free localtunnel URLs may change. Use --subdomain for more stable URLs.
Cloudflare Tunnel (formerly Argo Tunnel) provides a free, stable tunnel.
# Download cloudflared from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/-
Login to Cloudflare:
cloudflared tunnel login
-
Create tunnel:
cloudflared tunnel create printer-api
-
Configure tunnel: Create
config.yml:tunnel: printer-api credentials-file: /path/to/credentials.json ingress: - hostname: printer-api.yourdomain.com service: http://localhost:3001 - service: http_status:404
-
Start tunnel:
cloudflared tunnel run printer-api
Update .env.local in funPrinting:
PRINTER_API_URLS=["https://printer-api.yourdomain.com"]
PRINTER_API_KEY=your_api_key_hereIf both services are on the same private network:
-
Find your local IP address:
# macOS/Linux ifconfig | grep "inet " # Windows ipconfig
-
Example: Your IP is
192.168.1.100 -
Configure printer API to listen on all interfaces: Update
server.tsto listen on0.0.0.0:app.listen(PORT, '0.0.0.0', () => { console.log(`Server running on http://0.0.0.0:${PORT}`); });
-
Configure funPrinting: Update
.env.localin funPrinting:PRINTER_API_URLS=["http://192.168.1.100:3001"] PRINTER_API_KEY=your_api_key_here
Note: This only works if Render can access your private network (usually not possible).
Deploy the printer API to a server accessible from Render:
- Use a VPS (DigitalOcean, AWS EC2, etc.)
- Install Node.js and dependencies
- Deploy printer API
- Configure firewall to allow port 3001
- Use public IP or domain
# funPrinting .env.local
PRINTER_API_URLS=["http://YOUR_VPS_IP:3001"]
# or
PRINTER_API_URLS=["https://printer-api.yourdomain.com"]- Use Cloudflare Tunnel (free, stable, secure)
- Or deploy printer API to VPS (most reliable)
- Use static domain for printer API
- Use ngrok (easy setup, free tier available)
- Or use localtunnel (completely free)
# Test health endpoint
curl https://your-printer-api-url.com/health
# Test queue status (requires API key)
curl -H "X-API-Key: your_api_key" https://your-printer-api-url.com/api/queue/status- Go to
/admin/printer-monitor - Check if printer API status shows "Healthy"
- Monitor queue status
- Check if printer API is running
- Check if tunnel is active
- Verify URL in funPrinting
.env.local
- Check firewall settings
- Verify tunnel is forwarding correctly
- Check printer API logs
- Verify
API_KEYmatches in both.envfiles - Check headers are being sent correctly
- Always use HTTPS in production (ngrok, Cloudflare provide this)
- Use strong API keys (generate with:
openssl rand -hex 32) - Restrict access if possible (IP whitelist, VPN)
- Monitor logs for unauthorized access attempts
# 1. Install ngrok
brew install ngrok # macOS
# or download from https://ngrok.com
# 2. Sign up and get authtoken
# Visit https://ngrok.com and get your authtoken
# 3. Configure
ngrok config add-authtoken YOUR_AUTH_TOKEN
# 4. Start printer API
cd printer-api
npm start
# 5. In another terminal, start tunnel
ngrok http 3001
# 6. Copy the forwarding URL (e.g., https://abc123.ngrok-free.app)
# 7. Update funPrinting .env.local
PRINTER_API_URLS=["https://abc123.ngrok-free.app"]
PRINTER_API_KEY=your_api_key_here
# 8. Restart funPrintingFor more help, see the main README.md