Configuration
Control Discord, React, build, server, and WebSocket behavior from one file.
ludicord.config.mjs defines the contract shared by development, build, and production. Use defineConfig() for editor checks and keep environment-specific credentials in environment variables.
#Start from the generated configuration
1import { defineConfig } from "ludicord/config";23export default defineConfig({4 discord: {5 clientId: process.env.LUDICORD_DISCORD_CLIENT_ID,6 scopes: ["identify", "guilds"],7 auth: { required: true, session: "encrypted-cookie" },8 },9 activity: { defaultEmbed: "home", outsideDiscord: "allow" },10 react: { strictMode: true },11 server: { port: 3000, host: "0.0.0.0" },12 websocket: { enabled: true },13});
Changing the configuration during development triggers a controlled runtime restart because host, auth, build, and transport settings can affect every route. Client, API, and WebSocket source edits do not require that restart.
#Discord and Activity options
Use allow for an honest limited browser preview. Use mock only for intentional development fixtures. Production behavior should not silently invent Discord context.
#React and build options
Strict Mode can expose missing effect cleanup. Fix the effect rather than disabling the check for the whole project.
#HTTP server options
Restrict allowedHosts in environments where requests can reach the server through multiple untrusted hostnames.
#WebSocket options
Lower limits for small event protocols. Enable compression only after measuring CPU and bandwidth for realistic payloads.
#Validate configuration early
Ludicord validates types and bounds before starting. Invalid ports, timeouts, limits, scopes, host lists, or reconnect ranges fail with a LUDICORD0004 configuration error instead of becoming an unstable runtime.
#Next step
Open Environment variables to separate deploy-specific values and server credentials from this checked configuration.