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:
.envFile: Never commit.envfiles to git or make them accessible via web roots. Lock permissions usingchmod 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:
| Variable | Description | Default | Example Value |
|---|---|---|---|
PORT | Local TCP port for the HTTP server | 3000 | 3000 |
HOST | IP interface to bind to | 127.0.0.1 | 127.0.0.1 |
BASE_URL | Canonical public URL used for redirects | http://localhost:3000 | https://go.arcn.online |
DB_PATH | Absolute path to SQLite database | ./data/go.sqlite | /root/Go-shortner/data/go.sqlite |
JWT_SECRET | Secret key for signing session tokens | (Auto-generated) | 4f9e8a7b6c5d4e3f2a1b0c9d8e7f6a5b |
SESSION_DURATION_HOURS | Lifetime of session cookie in hours | 72 | 72 |
ANONYMOUS_DAILY_QUOTA | Max links per anonymous IP per 24h | 15 | 15 |
REGISTERED_MONTHLY_QUOTA | Max links per user per calendar month | 100 | 100 |
ANONYMOUS_MAX_EXPIRATION_DAYS | Maximum link duration for guests | 7 | 7 |
REGISTERED_MAX_EXPIRATION_DAYS | Maximum link duration for users | 365 | 365 |
TURNSTILE_ENABLED | Toggle Cloudflare Turnstile verification | false | true |
TURNSTILE_SITE_KEY | Public Turnstile site key | "" | 0x4AAAAAA... |
TURNSTILE_SECRET_KEY | Private Turnstile secret key | "" | 0x4AAAAAA... |
FIREBASE_API_KEY | Firebase Web App API Key | "" | AIzaSy... |
FIREBASE_AUTH_DOMAIN | Firebase Auth Domain | "" | project.firebaseapp.com |
FIREBASE_PROJECT_ID | Firebase Project Identifier | "" | my-go-shortener |
FIREBASE_STORAGE_BUCKET | Firebase Cloud Storage Bucket | "" | project.firebasestorage.app |
FIREBASE_MESSAGING_SENDER_ID | Firebase Sender ID | "" | 1234567890 |
FIREBASE_APP_ID | Firebase 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=