Skip to content

robticorg/robtic-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Robtic MongoDB Bot

Provision MongoDB Atlas databases directly from Discord — no dashboard required.

GitHub Stars GitHub Forks GitHub Issues License: MIT Discord Built with Bun TypeScript discord.js


What is this?

Robtic MongoDB Atlas Bot is a self-hosted Discord bot that lets your server members create and manage their own MongoDB Atlas databases entirely through Discord — no Atlas dashboard, no manual setup.

When a user requests a database, the bot:

  1. Calls the MongoDB Atlas API to create a dedicated database user with scoped readWrite access
  2. Generates a secure connection string
  3. Delivers the credentials privately via DM so no one else sees them

Everything is managed through a clean panel UI posted in a channel using /setup. Admins keep full control — only users with Manage Guild permission can deploy the panel.

Key Features

Feature Description
Create Database Provision a new MongoDB Atlas database with auto-generated credentials
Show Database View your current database info and access management actions
Reset Password Generate a new secure password for your database user
IP Access Manager Whitelist an IP address in your Atlas project's access list
Delete Database Soft-delete with a 15-day recovery window before permanent removal
Recover Database Restore a database that is pending deletion
Auto Cleanup Daily job that permanently purges expired soft-deleted databases
Audit Logging All actions are logged to a designated Discord channel

Video Tutorial

Coming Soon — A full walkthrough video showing how to set up and use the bot will be available shortly. Stay tuned in our Discord server.


Prerequisites

  • Bun v1.0 or later (recommended)
    or Node.js v18+
  • A Discord Application with a bot token
  • A MongoDB Atlas account with an existing cluster
  • An Atlas API key with Project Owner or Project Data Access Admin permissions

Getting Started

1. Clone the repository

git clone https://github.com/robticorg/mongodb-atlas-discord-bot.git
cd mongodb-atlas-discord-bot

2. Install dependencies

# Recommended
bun install

# Or with npm
npm install

3. Configure environment variables

Copy the example file and fill in your values:

cp .env.example .env

Then open .env and fill in each value (see the Environment Variables section below).

4. Run the bot

# Development (auto-restarts on file changes)
bun dev

# Production
bun start

npm users: Replace bun with npm run — e.g. npm run start / npm run dev


Environment Variables

Below is every variable in .env.example with instructions on where to find each one.

# ── Discord ──────────────────────────────────────────────────────────────────

DISCORD_TOKEN=
DISCORD_CLIENT_ID=

# ── MongoDB Atlas API ─────────────────────────────────────────────────────────

ATLAS_PUBLIC_KEY=
ATLAS_PRIVATE_KEY=

ATLAS_PROJECT_ID=
ATLAS_CLUSTER_NAME=

# ── Logging ───────────────────────────────────────────────────────────────────

LOG_GUILD_ID=
LOG_CHANNEL_ID=

# ── Internal ──────────────────────────────────────────────────────────────────

DATABASE_FILE=database.sqlite

DISCORD_TOKEN

Your bot's secret token used to log in to Discord.

  1. Go to the Discord Developer Portal
  2. Select your application (or create a new one)
  3. Navigate to Bot in the left sidebar
  4. Click Reset Token → copy the token

Keep this secret. Never commit it to source control.


DISCORD_CLIENT_ID

Your application's client (app) ID, used to register slash commands.

  1. Go to the Discord Developer Portal
  2. Select your application
  3. On the General Information page, copy the Application ID

ATLAS_PUBLIC_KEY

The public key of your MongoDB Atlas API key pair. This is the "username" for API authentication.

  1. Log in to cloud.mongodb.com
  2. In your Organization, go to Access Manager → API Keys
  3. Click Create API Key
  4. Set a description, assign at least Organization Member role
  5. On the project level, go to Project Settings → Access Manager → API Keys and grant the key Project Owner (or Project Data Access Admin) access
  6. Copy the Public Key

ATLAS_PRIVATE_KEY

The private key of the same Atlas API key pair. Shown only once at creation time.

Copy it immediately after creating the API key — it cannot be retrieved again.


ATLAS_PROJECT_ID

The ID of the Atlas project (also called "Group ID") that contains your cluster.

  1. In Atlas, open your project
  2. Go to Project Settings
  3. Copy the Project ID shown at the top of the page

ATLAS_CLUSTER_NAME

The exact name of your Atlas cluster as it appears in the Atlas dashboard.

  1. In Atlas, click Clusters in the left sidebar
  2. Use the cluster name shown in bold (e.g. Cluster0)

The name is case-sensitive.


LOG_GUILD_ID

The Discord server (guild) ID where audit logs will be posted.

  1. Enable Developer Mode in Discord: User Settings → Advanced → Developer Mode
  2. Right-click your server name in the sidebar
  3. Click Copy Server ID

LOG_CHANNEL_ID

The ID of the channel where the bot will send audit log messages.

  1. With Developer Mode enabled, right-click the target channel
  2. Click Copy Channel ID

DATABASE_FILE (optional)

Path to the SQLite file used for local state. Defaults to database.sqlite in the project root. You can leave this as-is unless you need a custom path.


Inviting the Bot

When creating your bot invite link, the bot requires the following permissions:

  • Send Messages
  • Embed Links
  • Read Message History
  • Use External Emojis

Generate an invite URL from the OAuth2 → URL Generator page in the Developer Portal, selecting the bot and applications.commands scopes.


Support

Need help? There are two ways to reach us:

Discord Community

Join our Discord server for real-time support, announcements, and to connect with other users:

Join our Discord

Email

For private inquiries or business contact, reach out at:

contact@robtic.org


License

This project is licensed under the MIT License — see the LICENSE file for details.

© 2026 Robtic Organization

About

Open-source Discord bot for creating and managing MongoDB Atlas databases directly from Discord.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors