
BeeHive
Set Up Your Environment. Deploy Anywhere.
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.
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.
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:
mongodb+srv://<username>:<password>@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0Step 6: Replace the Placeholders
Replace the placeholders with the credentials you created earlier.
mongodb+srv://beehive_admin:MyStrongPassword123@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0@, :, /, ?, 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:
MONGO_URI=mongodb+srv://beehive_admin:MyStrongPassword123@cluster0.xxxxxx.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0BeeHive 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.
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...).
Step 5: Add the API Key to BeeHive
Open your .env file and add:
SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxReplace 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.
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).
Step 6: Add the Credentials to BeeHive
Open your .env file and add the following variables:
CLOUD_NAME=my-cloud-name
CLOUDINARY_API_KEY=123456789012345
CLOUDINARY_SECRET_KEY=abcdefghijklmnopqrstuvwxyz123456Replace the example values with your own Cloudinary credentials.
Environment Variables
If you have completed all the above steps then copy the .env.example file to .env and fill in the required values.
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:
| Setting | Value |
|---|---|
| Name | Your preferred service name (e.g., xyzorganization) |
| Language | Python 3 |
| Root Directory | Keep it empty |
| Branch | main (or your deployment branch) |
| Region | Choose the nearest region |
| Instance Type | Free or Paid (depending on your needs) |
Step 5: Configure the Build Command
Set the Build Command to:
pip install -r requirements.txtRender installs all Python dependencies listed in your requirements.txt file during each deployment.
Step 6: Configure the Start Command
Enter the following Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORTStep 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:
https://xyzorganization.onrender.comOpen the URL in your browser to verify that the application is running successfully.