This document provides a step-by-step guide to setting up the required .env
files for both the frontend and backend. These variables are essential for the application to function properly.
-
DBURL (Mongo URL)
-
Description: The MongoDB connection string.
-
How to Obtain:
- Go to MongoDB Atlas and sign up or log in.
- Create a new cluster if you don't have one already.
- Navigate to Database Access and create a new database user with the appropriate permissions (e.g., readWrite).
- In the Network Access tab, allow connections from your IP address (or use 0.0.0.0/0 for all IPs for testing).
- Go to Clusters, click on Connect, and select Connect your application.
- Copy the connection string provided (it should look like
mongodb+srv://<username>: <password>@cluster0.mongodb.net/test?retryWrites=true&w=majority
). - Replace and with the credentials you created in step 3.
- Set the DBURL variable in your env file with the full MongoDB Atlas URL.
For a local MongoDB setup, you can install MongoDB locally and use
mongodb://localhost:27017/your-database-name
-
-
HOST_EMAIL (NodeMailer)
-
Description: The email used as the sender in NodeMailer.
-
How to Obtain:
- Go to Google's App Passwords.
- Select Mail as the app and Other as the device.
- Generate a new password and copy it.
- Set HOST_EMAIL to your email address (e.g., [email protected]) and PASSWORD to the generated app password.
[email protected] PASSWORD=your_app_password PORT=587
-
-
STRIPE_SECRET_KEY
-
Description: The app password for the email account used with NodeMailer.
-
How to Obtain:
- Go to Stripe Dashboard.
- In the Developers section, find API keys.
- Copy the Secret Key (start with sk_test_ for test environments).
- Set the STRIPE_SECRET_KEY in the env file.
STRIPE_SECRET_KEY=your_stripe_secret_key
-
-
DOMAIN (Backend Server after Deployment)
- Description: This is the domain where your backend will be hosted. If you're deploying to a platform like Heroku, Vercel, or any cloud service, use the public domain provided.
For example:
DOMAIN=https://yourdomain.com
-
SECRET (JWT Secret for Encryption)
- Description: This is a secret key used for encoding JWT tokens. You can generate a random string using a tool like Random.org or by using Node.js:
require('crypto').randomBytes(64).toString('hex');
Set this in your
.env
file:SECRET=your_secret_key
-
WHATSAPP (Notification API Token)
-
Description: If you're using a WhatsApp API service like Twilio, follow these steps:
-
How to Obtain:
- Sign up for Twilio.
- Go to the Console and copy your Account SID and Auth Token.
- Set the WHATSAPP variable in your env file.
WHATSAPP=your_whatsapp_api_token
-
-
VITE_PUBLICATION_KEY
-
Description: The public Stripe key for client-side payment processing.
-
How to Obtain:
- Log in to the Stripe dashboard.
- Navigate to the Developers section.
- Click on API Keys.
- Copy the Publishable Key (starts with pk_test_ for test environments).
- Set the VITE_PUBLICATION_KEY variable in your env file with the copied key.
VITE_PUBLICATION_KEY=your_stripe_publishable_key
-
-
VITE_JAAS_APP_ID
-
Description: The key for integrating Jitsi Meet video conferencing.
-
How to Obtain:
- Go to the Jitsi developer portal.
- Sign up or log in to your account.
- Navigate to the API section.
- Create a new application if you don't have one.
- Copy the App ID provided.
- Set the VITE_JAAS_APP_ID variable in your env file with the copied App ID.
VITE_JAAS_APP_ID=your_jaas_app_id
VITE_API_KEY
- Description: The API key for Chat-Bot
- How to Obtain:
- Go to the Google AI Studio.
- Sign in with your Google account.
- Once logged in, you should see an interface for managing projects and API keys (If prompted, create a new project or select an existing one).
- Now In the API Key section, look for an option to Generate API Key & click on it to create a new API key
- Once the key is generated, it will be displayed on the screen.
- Copy the API key.
- Open your
.env
file in frontend folder. - Replacing
your_api_key
with the key you copied:VITE_API_KEY = your_API_key
-
- Always keep
.env
files private and do not expose them in version control systems like GitHub. - Use environment variable management tools like
dotenv
in development or configure the deployment environment with these variables. - Ensure secure storage and limited access to keys, passwords, and tokens.