Configuration
Settings & Security
How the system is configured and hardened across the dashboard and the self-hosted bot.
Environment variables
Set these in bot/.env (see bot/.env.example).
DISCORD_TOKENBot token from the Discord developer portal (bot only, never in the web app)DISCORD_GUILD_IDCardano Stake Bulls server IDWELCOME_CHANNEL_IDChannel that receives the welcome embedLOG_CHANNEL_IDChannel that receives join logsDEFAULT_ROLE_IDRole ID for Red BullSUPABASE_URLDatabase URL (set once Lovable Cloud is enabled)SUPABASE_SERVICE_ROLE_KEYServer-side only, used by the botLOVABLE_API_KEYAI gateway key — already configured in this projectAPI key protection
Every key is read from the server environment. No secret is ever bundled into browser code or exposed through a loader.
Discord permission checks
The bot verifies ManageRoles and SendMessages before acting, and refuses to assign a role positioned above its own.
Admin-only settings
Dashboard writes are gated by a separate user_roles table (never a flag on the profile row) checked server-side.
Rate limiting
Per-user cooldown on AI questions inside the bot, plus exponential backoff on Discord 429 responses.
Error handling
Every handler is wrapped: failures are logged to audit_logs and surfaced to admins instead of crashing the process.
Row Level Security
All tables ship with RLS enabled and explicit GRANTs; anonymous access is denied by default.