MongoDB is a NoSQL database that Spoo.me uses to store URLs, analytics data, and user information. You can either set up a MongoDB server on your own infrastructure or use a cloud service like MongoDB Atlas.

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 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.

  1. Click on “Build a Database” or “Create” button
  2. Choose the “M0 Sandbox” option (this is the free tier)
  3. Select your preferred cloud provider (AWS is recommended)
  4. Choose a region closest to your target audience for better performance
  5. Give your cluster a memorable name (e.g., “spoo-me-cluster”)
  6. 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.

  1. In the “Username” field, enter a username (e.g., “spoo-admin”)
  2. Click “Autogenerate Secure Password” or create your own strong password
  3. Important: Copy and save the password immediately - you won’t see it again
  4. 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.

  1. Click “Choose a connection method”
  2. Select “Drivers”
  3. In the IP Access List, click “Add a Different IP Address”
  4. Click “Allow access from anywhere” (adds 0.0.0.0/0)
  5. 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.

  1. Choose “Node.js” as your driver
  2. Copy the connection string - it should look like this:
mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
  1. Replace <username> with your database username
  2. Replace <password> with your database password
  3. 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 the MONGODB_URI environment variable:

MONGODB_URI=mongodb+srv://username:[email protected]/?retryWrites=true&w=majority&appName=Cluster0

Alternative: Self-Hosted MongoDB

If you prefer to host MongoDB on your own server, you can install MongoDB Community Edition:

# Import MongoDB public GPG key
wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add -

# Add MongoDB repository
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list

# Update package database
sudo apt-get update

# Install MongoDB
sudo apt-get install -y mongodb-org

# Start MongoDB service
sudo systemctl start mongod
sudo systemctl enable mongod

Your connection string would be:

mongodb://localhost:27017

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:

  1. For MongoDB Atlas: Use the “Connect” button in your cluster dashboard and test the connection
  2. 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

Next Steps

With MongoDB configured, you can now: