We strongly recommend using MongoDB Atlas as it offers a generous free tier, automatic backups, and professional management without the complexity of self-hosting.
MongoDB Atlas Setup (Recommended)
MongoDB Atlas provides a free M0 tier that’s perfect for most Spoo.me deployments and can handle thousands of URLs without any cost.1
Create MongoDB Atlas Account
Navigate to MongoDB Atlas and sign up for a free account.
Verify your email address when prompted to activate your account.
2
Create a New Cluster
After logging in, you’ll see the Atlas dashboard.
- Click on “Build a Database” or “Create” button
- Choose the “M0 Sandbox” option (this is the free tier)
- Select your preferred cloud provider (AWS is recommended)
- Choose a region closest to your target audience for better performance
- Give your cluster a memorable name (e.g., “spoo-me-cluster”)
- Click “Create Deployment”
The cluster creation process typically takes 3-5 minutes to complete.
3
Create Database User
Once your cluster is ready, you’ll see a “Connect to Cluster” dialog.
- In the “Username” field, enter a username (e.g., “spoo-admin”)
- Click “Autogenerate Secure Password” or create your own strong password
- Important: Copy and save the password immediately - you won’t see it again
- Click “Create Database User”
Store your username and password securely. You’ll need these credentials for your connection string.
4
Configure Network Access
Set up IP address access for your deployment.
- Click “Choose a connection method”
- Select “Drivers”
- In the IP Access List, click “Add a Different IP Address”
- Click “Allow access from anywhere” (adds 0.0.0.0/0)
- Click “Confirm”
While “Allow access from anywhere” is convenient for development, consider restricting IP access to your server’s IP address in production for better security.
5
Get Connection String
Now you’ll get your MongoDB connection string.
- Choose “Node.js” as your driver
- Copy the connection string - it should look like this:
- Replace
<username>
with your database username - Replace
<password>
with your database password - Save this complete connection string securely
Your final connection string should look like:
mongodb+srv://spoo-admin:[email protected]/?retryWrites=true&w=majority&appName=Cluster0
Connection String Security
Your MongoDB connection string contains sensitive credentials and should be treated as a secret.Never commit your connection string to version control or share it publicly. Always use environment variables to store database credentials.
Environment Variable Usage
When deploying your Spoo.me instance, you’ll use your connection string as theMONGODB_URI
environment variable:
Alternative: Self-Hosted MongoDB
If you prefer to host MongoDB on your own server, you can install MongoDB Community Edition:- Ubuntu/Debian
- Windows
- Docker
Self-hosted MongoDB requires additional configuration for security, backups, and monitoring. MongoDB Atlas handles these concerns automatically.
Verification
To verify your MongoDB setup is working correctly:- For MongoDB Atlas: Use the “Connect” button in your cluster dashboard and test the connection
- For self-hosted: Run
mongosh
command to connect to your local instance
Once you have your
MONGODB_URI
connection string ready, you can proceed to the next step of setting up webhooks or choosing your deployment method.Troubleshooting
Connection timeout errors
Connection timeout errors
- Verify your IP address is in the Atlas IP Access List
- Check if your network firewall blocks MongoDB ports (27017)
- Ensure your connection string format is correct
Authentication failed
Authentication failed
- Double-check your username and password in the connection string
- Ensure the database user has proper permissions
- Verify the database name if you’re connecting to a specific database
SSL/TLS connection issues
SSL/TLS connection issues
- MongoDB Atlas requires SSL connections by default
- Ensure your connection string includes the SSL parameters
- For self-hosted MongoDB, configure SSL certificates if needed