.env) for secrets and runtime values that must stay private, and config files (config.js / config.yml) for application-level settings that can be committed to version control.
Both the client and server have their own copies of each type.
Configuration files at a glance
client/.env
Secrets and public runtime values for the Next.js client. Includes the Cloudflare Turnstile site key, the CDN URL, the client port, and the shared
CLIENT_SECRET.server/.env
Secrets for the Express.js server. Includes all encryption keys, the Discord bot token, OAuth credentials, MongoDB URL, S3 credentials, Cloudflare Turnstile secret key, and optional service keys (Lemon Squeezy, Sentry, Better Stack).
client/config.js
Application settings for the client: available locales, support invite URL, docs URL, status URL, API base URL, analytics configuration, bot invite URL, and custom profile hostnames.
server/config.yml
Application settings for the server: Discord OAuth scopes, ports, base guild ID, role IDs, channel IDs, category lists, Lemon Squeezy variant IDs, rate limit whitelist, and available locales.
.env files — secrets
Environment files hold values that must not be exposed publicly: API keys, encryption secrets, database credentials, and tokens.client/.env
server/.env
The server.env holds all sensitive credentials. Key groups include:
- Encryption secrets:
COOKIE_SECRET,BOT_API_KEY_ENCRYPT_SECRET,USER_TOKEN_ENCRYPT_SECRET,PAYMENTS_CUSTOM_DATA_ENCRYPT_SECRET_KEY,JWT_SECRET— use 256-bit hex keys for the encryption values. - Discord:
DISCORD_CLIENT_TOKEN(bot token),DISCORD_CLIENT_ID,DISCORD_CLIENT_SECRET(OAuth). - Database:
MONGO_URL— a MongoDB connection string. - S3 storage:
S3_BUCKET_NAME,S3_ACCESS_KEY_ID,S3_SECRET_ACCESS_KEY,S3_REGION,S3_ENDPOINT. - Cloudflare Turnstile:
CLOUDFLARE_TURNSTILE_SECRET_KEY. - Optional:
LEMON_SQUEEZY_API_KEY,LEMON_SQUEEZY_WEBHOOK_SECRET,SENTRY_DSN,HEARTBEAT_ID_*,WEBHOOKS_PROXY_SERVER_*.
Config files — application settings
Config files hold non-secret settings that control how the application behaves. These can safely be committed to source control.client/config.js
Located atclient/config.js. Key settings:
See the full reference at Client config.js.
server/config.yml
Located atserver/config.yml. Key settings:
See the full reference at Server config.yml.
The CLIENT_SECRET handshake
CLIENT_SECRET is a shared secret between the client and the server. When the Next.js client makes server-side API requests, it attaches this value to authenticate itself. The server verifies the value before processing the request.
Set it to any strong random string. A UUID or a random 32-character hex string works well.
Setting up your Discord application
- Go to the Discord Developer Portal and create a new application.
- In the Bot section, create a bot and copy the token — this is your
DISCORD_CLIENT_TOKEN. - In the OAuth2 section, copy the Client ID and Client Secret — these are
DISCORD_CLIENT_IDandDISCORD_CLIENT_SECRET. - Under OAuth2 → Redirects, add the redirect URL for your instance (e.g.
https://api.yourdomain.com/auth/callback). - Enable the Server Members and Message Content privileged gateway intents if your use case requires them.
The Discord OAuth scopes required by the site are defined in
server/config.yml under discordScopes. The defaults are identify, email, and guilds.
