Deployment

Environment Variables

Comprehensive production environment variables and security hardening guidelines.

Environment Variables

GO Shortener relies exclusively on environment variables for runtime configuration. These settings are read at startup from the local .env file located in the working directory.


Critical Security Warnings

Protect Your Configuration & Database:
  • .env File: Never commit .env files to git or make them accessible via web roots. Lock permissions using chmod 600 /root/Go-shortner/.env.
  • JWT_SECRET: Must be a cryptographically random string (32+ characters). If compromised, attackers can forge valid session tokens and impersonate administrators.
  • TURNSTILE_SECRET_KEY: Keep your Turnstile secret key private. Never share it with users or include it in client scripts.
  • SQLite Database: Protect /root/Go-shortner/data/go.sqlite. Do not expose this directory to the public internet or make it world-readable (chmod 600).

Environment Variables Reference

Below is the complete configuration matrix with default behaviors and sample values:

VariableDescriptionDefaultExample Value
PORTLocal TCP port for the HTTP server30003000
HOSTIP interface to bind to127.0.0.1127.0.0.1
BASE_URLCanonical public URL used for redirectshttp://localhost:3000https://go.arcn.online
DB_PATHAbsolute path to SQLite database./data/go.sqlite/root/Go-shortner/data/go.sqlite
JWT_SECRETSecret key for signing session tokens(Auto-generated)4f9e8a7b6c5d4e3f2a1b0c9d8e7f6a5b
SESSION_DURATION_HOURSLifetime of session cookie in hours7272
ANONYMOUS_DAILY_QUOTAMax links per anonymous IP per 24h1515
REGISTERED_MONTHLY_QUOTAMax links per user per calendar month100100
ANONYMOUS_MAX_EXPIRATION_DAYSMaximum link duration for guests77
REGISTERED_MAX_EXPIRATION_DAYSMaximum link duration for users365365
TURNSTILE_ENABLEDToggle Cloudflare Turnstile verificationfalsetrue
TURNSTILE_SITE_KEYPublic Turnstile site key""0x4AAAAAA...
TURNSTILE_SECRET_KEYPrivate Turnstile secret key""0x4AAAAAA...
FIREBASE_API_KEYFirebase Web App API Key""AIzaSy...
FIREBASE_AUTH_DOMAINFirebase Auth Domain""project.firebaseapp.com
FIREBASE_PROJECT_IDFirebase Project Identifier""my-go-shortener
FIREBASE_STORAGE_BUCKETFirebase Cloud Storage Bucket""project.firebasestorage.app
FIREBASE_MESSAGING_SENDER_IDFirebase Sender ID""1234567890
FIREBASE_APP_IDFirebase Web Application ID""1:123456:web:abcdef

Example Production .env Template

/root/Go-shortner/.env
# Network Configuration
PORT=3000
HOST=127.0.0.1
BASE_URL=https://go.arcn.online

# Database Storage
DB_PATH=/root/Go-shortner/data/go.sqlite

# Cryptographic Secrets
JWT_SECRET=replace_with_a_secure_random_string_at_least_32_chars
SESSION_DURATION_HOURS=72

# Quotas & Limits
ANONYMOUS_DAILY_QUOTA=15
REGISTERED_MONTHLY_QUOTA=100
ANONYMOUS_MAX_EXPIRATION_DAYS=7
REGISTERED_MAX_EXPIRATION_DAYS=365

# Cloudflare Turnstile (Optional)
TURNSTILE_ENABLED=false
TURNSTILE_SITE_KEY=
TURNSTILE_SECRET_KEY=

# Firebase Google Authentication (Optional)
FIREBASE_API_KEY=
FIREBASE_AUTH_DOMAIN=
FIREBASE_PROJECT_ID=
FIREBASE_STORAGE_BUCKET=
FIREBASE_MESSAGING_SENDER_ID=
FIREBASE_APP_ID=
Copyright © 2026