A modern Discord.js bot that provisions MongoDB Atlas projects and returns the connection string in a private DM.
- Rebuilt the project around a clean
src/layout. - Upgraded the bot to Discord.js v14 style.
- Replaced embeds with component v2 container cards.
- Added public-repo friendly config handling and ignored secrets.
- Refreshed the docs so the project is easier to publish and maintain.
/gengenerates a fresh Atlas project, cluster, user, and connection string./custom-genlets you choose the Atlas database username and password./mongo-statuschecks whether a MongoDB URI is reachable./pingshows gateway latency, API latency, and uptime in a modern card.- Private delivery for secrets through DMs.
- Node.js 18.17 or newer
- A Discord bot application
- MongoDB Atlas API credentials
- An Atlas organization ID
Mongo Gen/
index.js
src/
commands/
config/
services/
ui/
utils/
- Install dependencies.
npm install-
Create a local
config.jsonby copyingconfig.example.json. -
Fill in your values.
{
"token": "DISCORD_BOT_TOKEN",
"clientId": "DISCORD_APPLICATION_CLIENT_ID",
"public_key": "MONGODB_ATLAS_PUBLIC_KEY",
"private_key": "MONGODB_ATLAS_PRIVATE_KEY",
"org_Id": "MONGODB_ATLAS_ORG_ID",
"atlasRegion": "US_EAST_1",
"projectPrefix": "mongo-gen"
}tokenis your Discord bot token.clientIdis your Discord application client ID.public_keyandprivate_keyare MongoDB Atlas API keys.org_Idis the Atlas organization ID.atlasRegionis the cluster region.US_EAST_1is the default.projectPrefixis the base name used for generated Atlas projects.
npm startOn startup, the bot logs in and syncs its slash commands automatically.
Generates a new Atlas project and a random username/password pair.
Generates a new Atlas project using the username and password you provide.
Checks whether a MongoDB URI can connect and respond to a ping.
Shows bot latency and uptime.
- You run a generation command.
- The bot creates an Atlas project.
- It provisions an M0 cluster.
- It creates the database user.
- It whitelists the IP access list.
- It waits for the cluster to finish provisioning.
- It DMs the final connection string to you in a component v2 card.
- Keep
config.jsonout of version control. - Do not publish real Atlas keys or Discord tokens.
- If you want to distribute this publicly, rotate your keys before pushing.
- The generator can create real cloud resources, so make sure your Atlas organization is configured the way you expect.
- If commands do not appear, restart the bot and give Discord a moment to refresh global slash commands.
- If DMs fail, enable direct messages from server members and rerun the command.
- If Atlas provisioning fails, verify the Atlas API keys, organization ID, and region.
- If
/mongo-statusfails, confirm the URI is valid and the cluster allows your current IP.
- Configure
config.json. - Start the bot.
- Invite it to your Discord server.
- Run
/pingto verify the bot is alive. - Run
/genor/custom-gen.
No license file is included yet. Add one before publishing the repository publicly if you want others to reuse the code.