---
title: MongoDB Setup Guide
description: Step-by-step guide to set up your own MongoDB database for Taskflow AI
---

# MongoDB Setup Guide

This guide will walk you through setting up your own MongoDB database for self-hosting your Taskflow AI organization data.

## Why Self-Host?

Self-hosting your organization data gives you:

- **Full Control**: Complete ownership of your data
- **Customization**: Configure database settings to your needs
- **Privacy**: Keep sensitive data on your own infrastructure
- **Compliance**: Meet specific regulatory requirements

> **Note**: With self-hosting enabled, your organization membership is still maintained in our system for discoverability, but all organization, project, and task data is stored in your custom database.

## MongoDB Atlas Setup (Recommended)

MongoDB Atlas is the easiest way to get started with a cloud MongoDB database.

### Step 1: Create an Account

1. Go to [MongoDB Atlas](https://www.mongodb.com/atlas)
2. Click **"Try Free"** or **"Sign Up"**
3. Create your account with email or Google/GitHub

### Step 2: Create a Cluster

1. After logging in, click **"Create a New Cluster"**
2. Choose **"Free"** for the free tier (perfect for getting started)
3. Select your preferred cloud provider and region
4. Give your cluster a name (e.g., "taskflow")
5. Click **"Create Cluster"**

> **Tip**: The free tier (M0) provides 512 MB of storage, which is sufficient for small to medium organizations.

### Step 3: Configure Network Access

1. Click **"Network Access"** in the left sidebar.
2. Click **"Add IP Address"**.
3. Click **"Allow Access from Anywhere"** (0.0.0.0/0). (Or add only specific IP addresses for a more secure connection. Get your IP [Here](https://www.whatismyip.com/)).
4. Click **"Confirm"**.

> **Security Note**: For secure use, always restrict network access to specific IP addresses rather than allowing access from anywhere.

### Step 4: Create a Database User

1. Go back to **"Clusters"** in the left sidebar.
2. Click the **"Connect"** button for your cluster.
3. It will ask you to create a new database user (if you haven't already).
4. Choose a username and a secure password (Remember or copy these).
5. Click **"Create Database User"**, then click **"Choose a connection method"**.

### Step 5: Get Your Connection String

1. In the connection method page, choose **"Drivers"**.
2. Scroll down and find the **"Add your connection string into your application code"** section.
3. Copy the string. It should look like: `mongodb+srv://<username>:<password>@cluster0.xxxxx.mongodb.net/?retryWrites=true&w=majority`
4. Replace `<password>` with the password of the user you made earlier. (Do not keep the `<>` symbols). The username should be auto-filled.
5. Paste the completed string into Taskflow.

### Step 6: Set the Database Name

1. Once you paste the URL, if the database name is in the URL it should be auto-detected. If it is not, or you want to create a new one, put the name into the second input field.
2. You're Done!

## Self-Hosted MongoDB Setup

I will not provide instructions on how to host MongoDB on your own machine or using another service.

You can follow the official MongoDB installation guide for your operating system:
- [Install on Linux](https://docs.mongodb.com/manual/administration/install-on-linux/)
- [Install on macOS](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/)
- [Install on Windows](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/)

## Testing Your Connection

Once you have your connection string:

1. Go to Taskflow AI **Settings** → **Database** tab (Or click the checkbox when creating an organization).
2. Paste your connection string in the **"MongoDB Connection URL"** field.
3. The database name should auto-populate. (Put it in manually if it doesn't auto-detect or if you want to make a new one).
4. Click **"Test Connection"** to verify everything works.
5. If successful, click **"Save Configuration"**.

## Security Best Practices

### For MongoDB Atlas:

1. **Use Strong Passwords**: Create complex passwords for database users.
2. **Restrict IP Access**: Only allow connections from trusted IP addresses.
3. **Enable Encryption**: Atlas enables encryption at rest by default.
4. **Regular Backups**: Atlas provides automated backups.
5. **Monitor Access**: Review database access logs regularly.

## Database Schema

Taskflow AI will automatically create the following collections in your database:

- **organizations**: Organization metadata and settings
- **projects**: Project information and configurations
- **tasks**: Task data and history
- **columns**: Kanban board column definitions

All collections include proper indexes for optimal performance.

## Troubleshooting

### Common Connection Issues:

1. **Network Access**: Ensure your IP address is whitelisted (or allow all by adding 0.0.0.0/0).
2. **Credentials**: Verify username and password are correct.
3. **Database Name**: Make sure the database name in the URL is correct.
4. **SSL Requirements**: Some providers require SSL connections.

### Performance Optimization:

1. **Indexing**: Taskflow AI creates necessary indexes automatically.
2. **Connection Pooling**: Use connection pooling for better performance.
3. **Monitoring**: Monitor database performance and usage.

## Migration

If you need to migrate from the official database to your self-hosted setup:

> **Warning**: Currently, data migration between databases is not automated. Contact support if you need assistance migrating existing data.

## Support

Need help with your MongoDB setup?

- Contact our [Support Team](mailto:support@taskflow-ai.tech)