Summary
bot/.env.example documents:
API_URL=http://localhost:5000/
The Discord bot (bot/) communicates with the Express server exclusively
through API_URL — every point award, task verification, and leaderboard
fetch is an HTTP call to this value. In a production deployment (the README
documents Cloudflare deployment via wrangler.toml), localhost:5000 does
not resolve to the backend — it resolves to nothing.
Exact Impact
When a community member runs /award or /verify on the Discord bot in
production:
bot/index.js fires fetch(\${process.env.API_URL}/api/points/award`)`
- The request targets
http://localhost:5000 — unreachable in production
- The bot silently swallows the connection error or returns a generic failure
- Points are never actually awarded — but the Discord user receives no
error message explaining why, leading to confusion and trust erosion in
the gamification system
Additionally, bot/.env.example is missing FRONTEND_URL (needed for
leaderboard links posted to Discord), EMAIL_USERNAME, and
EMAIL_PASSWORD — which are documented in server/.env.example but have
no corresponding entry in the bot's env template. New contributors
copy-paste the bot env without these values and have no indication anything
is missing.
Proposed Fix
Update bot/.env.example:
# Discord bot token from https://discord.com/developers/applications
DISCORD_TOKEN=your_discord_bot_token
# Guild/server ID — right-click server → Copy Server ID (developer mode)
GUILD_ID=your_guild_id
# URL of the deployed Gamify API server
# Local development: http://localhost:5000
# Production: https://your-deployed-server.com
API_URL=http://localhost:5000
# Frontend dashboard URL (used in leaderboard embeds posted to Discord)
FRONTEND_URL=http://localhost:5173
Also add a startup validation in bot/index.js:
if (process.env.API_URL === 'http://localhost:5000' &&
process.env.NODE_ENV === 'production') {
console.error('[FATAL] API_URL is set to localhost in production. Update bot/.env');
process.exit(1);
}
Acceptance Criteria
Labels: bug, security, bot, documentation, `level: beginner'
Summary
bot/.env.exampledocuments:API_URL=http://localhost:5000/
The Discord bot (
bot/) communicates with the Express server exclusivelythrough
API_URL— every point award, task verification, and leaderboardfetch is an HTTP call to this value. In a production deployment (the README
documents Cloudflare deployment via
wrangler.toml),localhost:5000doesnot resolve to the backend — it resolves to nothing.
Exact Impact
When a community member runs
/awardor/verifyon the Discord bot inproduction:
bot/index.jsfiresfetch(\${process.env.API_URL}/api/points/award`)`http://localhost:5000— unreachable in productionerror message explaining why, leading to confusion and trust erosion in
the gamification system
Additionally,
bot/.env.exampleis missingFRONTEND_URL(needed forleaderboard links posted to Discord),
EMAIL_USERNAME, andEMAIL_PASSWORD— which are documented inserver/.env.examplebut haveno corresponding entry in the bot's env template. New contributors
copy-paste the bot env without these values and have no indication anything
is missing.
Proposed Fix
Update
bot/.env.example:Also add a startup validation in
bot/index.js:Acceptance Criteria
bot/.env.exampleupdated withFRONTEND_URLand corrected commentsbot/index.jsfor production localhost checkDEPLOYMENT_GUIDE.mdupdated to explicitly list theAPI_URLconfiguration step for bot deployment
Labels:
bug,security,bot,documentation, `level: beginner'