Skip to content

Configuration

RankHub is configured via environment variables. Copy .env.example to .env and fill in the values.

bash
cp .env.example .env

Required Variables

VariableDescription
JWT_SECRETHMAC-SHA256 secret for signing JWTs. Generate with openssl rand -hex 32.
IP_HASH_SALTSalt for hashing IP addresses in rate limiting. Generate with openssl rand -hex 32.
DO_WORKER_URLURL of the deployed Durable Object worker (e.g., https://rankhub-do.subdomain.workers.dev). Required for WebSocket support.

Database Variables

Set USE_ONLINE_DB=true for a remote Supabase project, or leave unset for local development.

VariableDescription
USE_ONLINE_DBtrue for remote Supabase, false/unset for local.
SUPABASE_URLLocal Supabase URL (default: http://127.0.0.1:54821).
SUPABASE_ANON_KEYSupabase anon/public key.
SUPABASE_SERVICE_ROLE_KEYSupabase service role key (server-side only).
DATABASE_URLPostgreSQL connection string.
ONLINE_SUPABASE_URLRemote Supabase project URL (when USE_ONLINE_DB=true).
ONLINE_SUPABASE_ANON_KEYRemote anon key (when USE_ONLINE_DB=true).
ONLINE_SUPABASE_SERVICE_ROLE_KEYRemote service role key (when USE_ONLINE_DB=true).
ONLINE_DATABASE_URLTransaction pooler URL (when USE_ONLINE_DB=true).

Optional Variables

Environment

VariableDescription
ENVIRONMENTdevelopment or production. Affects logging, error reporting, and security headers.
SERVER_URLPublic URL of the server for absolute links.
BASE_URLBase URL for email links (defaults to https://rankhub.app).

Admin

VariableDescription
DEFAULT_ADMIN_EMAILEmail for the initial admin user.
DEFAULT_ADMIN_PASSWORDPassword for the initial admin user. Must be 32+ chars in production.

Email (Resend)

VariableDescription
RESEND_API_KEYResend API key for transactional emails.
FROM_EMAILSender address (e.g., RankHub <noreply@rankhub.app>).

Analytics and Monitoring

VariableDescription
VITE_POSTHOG_KEYPostHog project key.
VITE_POSTHOG_HOSTPostHog host URL.
SENTRY_DSNSentry DSN for error tracking.
SENTRY_AUTH_TOKENSentry auth token (CI only, for source maps).
SLACK_WEBHOOK_URLSlack webhook for alerting.
PAGERDUTY_ROUTING_KEYPagerDuty routing key for critical alerts.

Cloudflare

VariableDescription
CF_ACCOUNT_IDCloudflare account ID (for analytics engine).
CF_API_TOKENCloudflare API token (for analytics engine).

Secrets

The following variables contain secrets and must never be committed to version control or exposed client-side:

  • JWT_SECRET
  • IP_HASH_SALT
  • SUPABASE_SERVICE_ROLE_KEY
  • ONLINE_SUPABASE_SERVICE_ROLE_KEY
  • DATABASE_URL
  • ONLINE_DATABASE_URL
  • DEFAULT_ADMIN_PASSWORD
  • RESEND_API_KEY
  • SENTRY_AUTH_TOKEN
  • CF_API_TOKEN
  • SNYK_TOKEN

For Cloudflare Pages deployment, set these in the dashboard under Pages > Settings > Environment variables.