BeeHive

BeeHive

Set Up Your Environment. Deploy Anywhere.

databaseMongoDB
imagesCloudinary
emailSendGrid
deployRender
deployVercel
cloudAWS

Setup

Overview

Welcome to the BeeHive Setup Guide. This guide will walk you through setting up all necessary external dependencies and third-party services required to run BeeHive. From configuring your database to setting up email notifications and cloud storage, we've got you covered.

MongoDB

First, we'll obtain the MongoDB URI from MongoDB Atlas. This URI is required to connect BeeHive to your database and perform database operations. Follow the steps below to generate and retrieve your MongoDB connection URI.

Watch this tutorial for better understanding:

Step 1: Create a MongoDB Atlas Account

  • Visit the MongoDB Atlas website.
  • Sign up for a new account or log in if you already have one.
  • After signing in, click Create or New Project.
  • Enter a project name (e.g., BeeHive) and click Create Project.

Step 2: Create a Free Cluster

  • Inside your project, click Create a Deployment or Build a Database.
  • Select the M0 (Free) cluster.
  • Choose your preferred Cloud Provider (AWS, Google Cloud, or Azure) and Region (closest to your users).
  • Give your cluster a name or keep the default.
  • Click Create Deployment and wait a few minutes for the cluster to be provisioned.

Step 3: Create a Database User

After the cluster is created, Atlas will prompt you to create a database user.

  • Enter a Username.
  • Enter a strong Password.
  • Save these credentials securely, as they will be required later.
  • Click Create Database User. Atlas requires a database user before applications can connect.
Important
Do not lose your username or password. BeeHive will use these credentials to connect to your database.

Step 4: Configure Network Access

MongoDB Atlas only accepts connections from approved IP addresses.

  • When prompted, click Add IP Address.
  • Select Allow Access from Anywhere. Atlas will automatically add 0.0.0.0/0.
  • Click Confirm or Save.

This allows connections from any IP address, which is convenient during development.

Production Recommendation
For production deployments, avoid using 0.0.0.0/0. Instead, whitelist only the public IP address of your server to improve security.

Step 5: Obtain the Connection URI

  • Go to Database.
  • Locate your cluster and click Connect.
  • Select Drivers as the connection method.
  • Choose your preferred driver version (the latest version is recommended).
  • Atlas will display a connection string similar to:
Connection Stringtext
mongodb+srv://<username>:<password>@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0

Step 6: Replace the Placeholders

Replace the placeholders with the credentials you created earlier.

Example URItext
mongodb+srv://beehive_admin:MyStrongPassword123@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0
Special Characters Note
If your password contains special characters such as @, :, /, ?, or #, URL-encode them before inserting them into the URI to avoid connection errors.

Step 7: Add the URI to BeeHive

Open your .env file and add:

.envbash
MONGO_URI=mongodb+srv://beehive_admin:MyStrongPassword123@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0

BeeHive will use this environment variable to establish a secure connection to your MongoDB Atlas database.

Sendgrid

BeeHive uses Twilio SendGrid to send emails for features such as email verification, password resets, and notifications. Before running the application, you need to create a SendGrid API key.

Watch this tutorial for better understanding:

Step 1: Create a SendGrid Account

  • Visit the Twilio SendGrid Dashboard.
  • Sign up for a new account or log in to your existing account.
  • Complete the account verification process if prompted.
Note
Depending on your account status, SendGrid may require email or identity verification before allowing email sending.

Step 2: Navigate to API Keys

  • From the SendGrid Dashboard, open the left navigation menu.
  • Go to Settings → API Keys.
  • Click Create API Key.

Step 3: Create a New API Key

Enter a descriptive name for your API key, such as BeeHive Production or BeeHive Development.

Select the appropriate permission level:

  • Full Access (Recommended for quick setup)
  • Restricted Access (Custom Access) and enable the Mail Send permission if you prefer to follow the principle of least privilege.

Step 4: Generate the API Key

  • Click Create & View.
  • SendGrid will generate your API key (e.g. SG.xxxxxxxx...).
Important
This is the only time SendGrid will display the complete API key. Copy it immediately and store it securely. If you lose it, you must generate a new API key because SendGrid cannot display it again.

Step 5: Add the API Key to BeeHive

Open your .env file and add:

.envbash
SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Replace the example value with your actual API key.

Step 6: Verify Your Sender Identity (Required)

Before SendGrid can send emails, you must verify the email address or domain you will use as the sender.

  • In the SendGrid Dashboard, go to Settings → Sender Authentication.
  • Choose Single Sender Verification (Recommended for development/testing) or Domain Authentication (Recommended for production).
  • Follow the on-screen instructions to complete the verification process.
Verification Note
BeeHive cannot send emails until the sender identity has been verified.
You're Ready!
You have successfully generated your SendGrid API key and configured it for BeeHive. The application can now authenticate with SendGrid to send emails securely.

Cloudinary

BeeHive uses Cloudinary to securely store and manage images uploaded by users. Before running the application, you need to obtain your Cloud Name, API Key, and API Secret.

Watch this tutorial for better understanding:

Step 1: Create a Cloudinary Account

  • Visit the Cloudinary Console.
  • Sign up for a free account or log in if you already have one.
  • Complete the account verification process if prompted.

Step 2: Find Your Cloud Name

After logging in, you will be taken to the Dashboard. Under the Product Environment section, locate your Cloud Name (e.g. my-cloud-name).

Your Cloud Name is used to identify your Cloudinary environment and is included in every media URL.

Step 3: Open the API Keys Page

From the Dashboard, click Go to API Keys, or navigate via the left sidebar to Settings → API Keys.

Step 4: Copy Your API Key

On the API Keys page, locate the API Key and copy the value (e.g. 123456789012345).

Step 5: Reveal and Copy Your API Secret

On the same page, locate the API Secret. Click Show (or the eye icon), verify your password if prompted, and copy the API Secret (e.g. abcdefghijklmnopqrstuvwxyz123456).

Important
Never expose your API Secret in client-side code or commit it to a public Git repository. It should always remain on your server or in environment variables.

Step 6: Add the Credentials to BeeHive

Open your .env file and add the following variables:

.envbash
CLOUD_NAME=my-cloud-name
CLOUDINARY_API_KEY=123456789012345
CLOUDINARY_SECRET_KEY=abcdefghijklmnopqrstuvwxyz123456

Replace the example values with your own Cloudinary credentials.

You're Ready!
You have successfully obtained your Cloudinary credentials. BeeHive can now securely upload, manage, and serve media files using your Cloudinary account.

Environment Variables

If you have completed all the above steps then copy the .env.example file to .env and fill in the required values.

Important
Add ?retryWrites=true&w=majority&maxIdleTimeMS=10000 after mongodb.net/.
.envbash
MONGO_URI = "mongodb+srv://<username>:<password>@<cluster-name>.<cluster-id>.mongodb.net/?retryWrites=true&w=majority&maxIdleTimeMS=10000"
SENDGRID_API_KEY = "your_sendgrid_key"
EMAIL = "your_verified_sender_email@domain.com"

CLOUD_NAME = "your_cloud_name"
CLOUDINARY_API_KEY = "your_cloudinary_key"
CLOUDINARY_SECRET_KEY = "your_cloudinary_secret"

PYTHON_VERSION = "3.10.13"

Deployment

Render

Render provides an easy way to deploy and host the BeeHive. Follow the steps below to set up and deploy your backend service on Render.

Step 1: Fork the Repository

Fork the official BeeHive repository on GitHub to your own GitHub account so Render can access and deploy your codebase.

Step 2: Create a Render Account

  • Visit the Render Dashboard.
  • Sign up or log in.
  • Connect your GitHub account when prompted and authorize Render to access your forked BeeHive repository.

Step 3: Create a New Web Service

  • From the Render Dashboard, click New +.
  • Select Web Service.
  • Choose your forked GitHub repository and click Connect next to it.

Step 4: Configure the Web Service

Fill in the service configuration details:

SettingValue
NameYour preferred service name (e.g., xyzorganization)
LanguagePython 3
Root DirectoryKeep it empty
Branchmain (or your deployment branch)
RegionChoose the nearest region
Instance TypeFree or Paid (depending on your needs)

Step 5: Configure the Build Command

Set the Build Command to:

Build Commandbash
pip install -r requirements.txt

Render installs all Python dependencies listed in your requirements.txt file during each deployment.

Step 6: Configure the Start Command

Enter the following Start Command:

Start Commandbash
uvicorn main:app --host 0.0.0.0 --port $PORT

Step 7: Add Environment Variables

Open the Environment section in your Render Web Service settings and add all required environment variables (MONGO_URI, SENDGRID_API_KEY, CLOUD_NAME, etc.).

Step 8: Deploy the Application

After verifying all settings, click Create Web Service. Render will automatically:

  • Clone your repository
  • Install dependencies
  • Build the application
  • Start your BeeHive server

Step 9: Access Your Application

Once the deployment is complete, Render will provide a public URL similar to:

Public URLtext
https://xyzorganization.onrender.com

Open the URL in your browser to verify that the application is running successfully.

Vercel

Available Soon.
Steps to deploy on vercel will be available soon.

AWS

Available Soon.
Steps to deploy on AWS will be available soon.