Athena Egg (NodeJS + MongoDB)
The Athena egg runs your Node.js bot and a private MongoDB database inside the same Pterodactyl server. On its first start, the egg creates separate app and admin credentials, starts MongoDB, and saves ready-to-use connection details.
MongoDB listens on 127.0.0.1 by default. Only applications running inside
this Pterodactyl server can connect to it. Keep this setting unless Haven
Support specifically asks you to change it.
First startup
- Open your server in the Haven panel.
- Select Console, then start the server.
- Wait for
MongoDB started successfully. Password controls synchronized. - Keep both MongoDB URIs private. They contain usernames and passwords.
The egg creates two users:
- App user: Read and write access to your bot’s database. Use this URI in your bot.
- Admin user: Full MongoDB access for maintenance. Do not use this URI in normal bot configuration.
AthenaBot customers
AthenaBot is configured automatically. Each time the server starts, the egg
finds common.json and writes the app URI to:
bot.mongodb_uriYou normally do not need to copy the URI yourself. After the first successful
start, open common.json in Files and confirm that bot.mongodb_uri is
filled in.
Find the URI for another bot
Open Files and select mongodb-connection.txt in the server’s main
directory. Copy the URI shown under:
Use this URI in your Node.js app:Use that app URI—not the admin URI. The egg also creates
.env.mongodb.example with MONGODB_URI and MONGODB_DATABASE values that you
can copy into your bot’s environment file.
The same details are printed in Console whenever the server starts. If the
messages have scrolled away, read mongodb-connection.txt or restart the server
at a convenient time.
The Startup page contains MongoDB password controls, but it does not show
the final ready-to-copy URI when passwords were generated automatically. Use
mongodb-connection.txt, .env.mongodb.example, or Console instead.
Connect a Node.js bot
Most bots expect the URI in an environment variable. Use the exact name from your bot’s documentation. A common setup looks like this:
MONGODB_URI=mongodb://APP_USER:[email protected]:27017/app?authSource=appReplace that example with the complete app URI from
mongodb-connection.txt. For a bot using Mongoose:
import mongoose from 'mongoose'
await mongoose.connect(process.env.MONGODB_URI)If your bot stores its database URL in JSON or another config file, paste the same app URI into the field that bot expects.
Switch to a different bot and keep the database
You can replace AthenaBot or another Node.js bot while keeping the same egg, MongoDB data, and connection details.
- Stop the server and make a backup.
- Keep the
mongodb/directory andmongodb-connection.txtfile. - Replace the old bot files with the new bot.
- Copy the app URI from
mongodb-connection.txtinto the new bot’s config. - Set Main File on the Startup page to the new entry file.
- Start the server and watch Console for a successful MongoDB startup.
Do not reinstall the server or delete mongodb/ if you need the existing
database. Keeping mongodb-connection.txt also lets the egg reuse the same
generated credentials on later starts.
Change a MongoDB password
The MongoDB App Password and MongoDB Admin Password fields on the
Startup page are live controls. A new value is applied on the next restart.
The egg then rewrites the connection files and updates AthenaBot’s
bot.mongodb_uri automatically.
For a different bot, copy the updated app URI into its config after the restart. An old URI will fail authentication.
Keep it private
- Use the app URI in your bot and reserve the admin URI for maintenance.
- Do not post either URI in tickets, screenshots, Discord messages, or public repositories.
- Keep MongoDB bound to
127.0.0.1for per-server isolation. - Back up
mongodb/before replacing files or making major changes.