Setting Up Environment Variables
Required Variables
MONGO_URI
MongoDB connection string for your database.Usage: The application connects to MongoDB using this URI in Or for MongoDB Atlas:Example:
src/config/database.js:8Format:JWT_SECRET
Secret key used for signing and verifying JSON Web Tokens (JWT) for user authentication.Usage: Used in authentication controllers and middleware:
src/controllers/auth.controller.js:41- Token generation during registrationsrc/controllers/auth.controller.js:87- Token generation during loginsrc/middlewares/auth.middleware.js:27- Token verification
GOOGLE_GENAI_API_KEY
API key for Google Gemini AI service used to generate interview reports and resumes.Usage: Initializes the Google GenAI client in
src/services/ai.service.js:7The AI service uses the Gemini 3 Flash Preview model to:- Generate personalized interview reports with match scores
- Create technical and behavioral interview questions
- Identify skill gaps and provide preparation plans
- Generate ATS-friendly resume PDFs
Complete .env Example
Here’s a complete example of a.env file with all required variables:
Loading Environment Variables
The application loads environment variables using thedotenv package at application startup:
server.js:1 and runs before any other application code.
Troubleshooting
Database connection fails
Database connection fails
- Verify your
MONGO_URIis correctly formatted - Ensure MongoDB is running (for local connections)
- Check network connectivity (for Atlas connections)
- Verify database user credentials have proper permissions
JWT token errors
JWT token errors
- Ensure
JWT_SECRETis set and not empty - Verify the secret is the same across all application instances
- Check that the secret hasn’t been changed while users have active sessions
AI service errors
AI service errors
- Verify your
GOOGLE_GENAI_API_KEYis valid and active - Check you have sufficient quota in Google AI Studio
- Ensure the API key has access to the Gemini models
- Review rate limits and try again later if throttled
Next Steps
Database Setup
Configure MongoDB and understand the database schema
AI Setup
Set up Google Gemini API and configure AI services