MongoDB Database Setup

About MongoDB: LogoAIpro uses MongoDB to store user data, generated logos, credit balances, transaction history, and user statistics. You can use MongoDB Atlas (cloud) or a self-hosted MongoDB instance.

Why MongoDB for LogoAIpro?

MongoDB is the perfect database choice for LogoAIpro because:

Option 1: MongoDB Atlas (Recommended)

MongoDB Atlas is the easiest way to get started with MongoDB. It provides a free tier perfect for development and small applications.

Step 1: Create MongoDB Atlas Account

  1. Go to MongoDB Atlas
  2. Click "Try Free" to create a new account
  3. Fill in your details and verify your email
  4. Choose the "Free" tier (M0 Sandbox)
MongoDB Atlas Homepage

MongoDB Atlas homepage - Click "Try Free" to get started

MongoDB Atlas Sign Up

Create your MongoDB Atlas account with your details

Step 2: Create a Cluster

  1. After logging in, click "Build a Database"
  2. Select "M0 Sandbox" (Free tier)
  3. Choose a cloud provider and region (closest to your users)
  4. Give your cluster a name (e.g., "logoai-pro-cluster")
  5. Click "Create Cluster"
MongoDB Atlas Dashboard

MongoDB Atlas dashboard - Click "Build a Cluster" to get started

Create Cluster - Choose Free Tier

Select the Free tier (M0 Sandbox) for development

Deploy Cluster Configuration

Configure your cluster name and settings, then click "Create Deployment"

Note: Cluster creation takes 3-5 minutes. You'll receive an email when it's ready.

Step 3: Create Database User

  1. In the Atlas dashboard, go to "Database Access"
  2. Click "Add New Database User"
  3. Choose "Password" authentication
  4. Create a username and strong password
  5. Set privileges to "Read and write to any database"
  6. Click "Add User"
Important: Save the username and password securely. You'll need them for the connection string.
Connect - Choose Connection Method

Choose your connection method - Select "Compass" for GUI access

Step 4: Configure Network Access

  1. Go to "Network Access" in the Atlas dashboard
  2. Click "Add IP Address"
  3. For development: Click "Allow Access from Anywhere" (0.0.0.0/0)
  4. For production: Add your server's IP address
  5. Click "Confirm"
Network Access Configuration

Configure network access - Click "Allow Access from Anywhere" for development

Security Note: For production, restrict access to specific IP addresses only.

Step 5: Get Connection String

  1. Go to "Clusters" and click "Connect" on your cluster
  2. Choose "Connect your application"
  3. Select "Node.js" as the driver
  4. Copy the connection string
  5. Replace <password> with your database user password
  6. Replace <dbname> with your database name (e.g., "logoai-pro")
MongoDB Compass Connection Setup

Download MongoDB Compass and copy the connection string

mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/logoai-pro?retryWrites=true&w=majority

Option 2: Using MongoDB Compass (Recommended for Development)

MongoDB Compass is the official GUI for MongoDB, making it easy to visualize and manage your LogoAIpro database.

Step 1: Download MongoDB Compass

  1. Go to MongoDB Compass
  2. Download the version for your operating system
  3. Install MongoDB Compass following the setup wizard
  4. Launch the application

Step 2: Connect to Your MongoDB Atlas Cluster

  1. Open MongoDB Compass
  2. Click "New Connection"
  3. Paste your MongoDB Atlas connection string:
    mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/
  4. Click "Connect"
Pro Tip: You can get your connection string from Atlas by clicking "Connect" → "Connect using MongoDB Compass" in your cluster dashboard.
MongoDB Atlas Cluster Overview

Your MongoDB Atlas cluster is ready - Click "Connect" to get connection details

Step 3: View Your Data

Once connected, you can browse your LogoAIpro collections:

Tip: MongoDB Compass provides a visual interface to explore your database without writing queries. Perfect for monitoring logo generation activity, user credits, and troubleshooting issues.

Connection String Configuration

Add your MongoDB connection string to your environment variables:

Environment Variable

Add this to your .env.local file:

# MongoDB Atlas (Cloud)
MONGO_URI=mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/logoai-pro?retryWrites=true&w=majority

# Self-hosted MongoDB
MONGO_URI=mongodb://username:password@localhost:27017/logoai-pro

Database Schema

LogoAIpro automatically creates the following collections:

Database Collections

👥 users

Stores user account information, credit balances, and preferences.

_id email credits createdAt
logos

Stores generated logos with metadata, styles, and settings.

userId logoUrl style createdAt
�� transactions

Tracks credit purchases, usage, and payment history.

userId type amount createdAt
MongoDB Atlas Database Access Management

Database Access management - Add and manage database users

Test Database Connection

Verify your MongoDB connection is working:

Test Connection

Start your development server and check the console for connection messages:

npm run dev
# or
pnpm dev

Look for messages like:

 Connected to MongoDB
 Database connection established

Troubleshooting

Common Issues

Connection Timeout

Check your network access settings in MongoDB Atlas and ensure your IP is whitelisted.

Authentication Failed

Verify your username and password are correct in the connection string.

Database Not Found

Ensure the database name in your connection string matches your intended database.

🚫 Permission Denied

Check that your database user has read/write permissions for the database.

Next Steps

After setting up MongoDB:

Nebius AI Setup

Configure Nebius AI for logo generation.

Setup Guide →
Configure Stripe

Set up Stripe for credit purchases.

Setup Guide →
Success! Your MongoDB database is now configured and ready for LogoAIpro. The application will automatically create the necessary collections and indexes when it starts.