Contents
What You Receive
- backend — Node.js + Express + MongoDB (Mongoose)
- frontend — React + Vite + Material UI + Tailwind
- Sample data — optional seed script with demo users and content
.env.
Install Node.js and npm
- Download Node.js LTS from https://nodejs.org
- Verify in a terminal:
node -v npm -v
Create a MongoDB Database
Option A — MongoDB Atlas (cloud, recommended for demos)
- Sign up at https://www.mongodb.com/cloud/atlas
- Create a free cluster.
- Database Access → add a user with a password.
- Network Access → allow your IP (or
0.0.0.0/0for testing only). - Database → Connect → Drivers → copy the connection string.
- Replace
<password>with your user password. - Add a database name before the query string, e.g.:
Option B — Local MongoDB
Install MongoDB Community Server, start mongod, then use:
Configure the Backend
backend folder.
Windows (PowerShell): Copy-Item .env.example .env macOS / Linux: cp .env.example .env
backend/.env and set at minimum:
MONGO_URI=paste_your_full_connection_string_here JWT_SECRET=use_a_long_random_string_at_least_32_characters PORT=5000 FRONTEND_URL=http://localhost:5173
npm install npm run dev
You should see MongoDB Connected and the server listening on port 5000.
Optional Backend Variables
| Variable | Purpose |
|---|---|
EMAIL_USER, EMAIL_PASS | Outgoing mail (Gmail App Password) for password reset |
STRIPE_SECRET_KEY | Stripe payments |
GEMINI_API_KEY | AI features if enabled in your build |
Configure the Frontend
frontend folder.frontend/.env:
VITE_API_BASE_URL=http://localhost:5000 VITE_SHOW_DEMO_ACCOUNTS=true
VITE_API_BASE_URL must match your backend URL (including port). Set VITE_SHOW_DEMO_ACCOUNTS=false on any public / production site.
npm install npm run dev
Open a browser at http://localhost:5173 (or the URL Vite prints).
Demo Users & Credentials
With the backend's MONGO_URI set correctly, run the seed script:
cd backend npm run seed
This creates:
- Demo admin, teacher, institute, and student accounts
- Subscription plans required for teacher/institute login
- One demo class, one notice, support categories, and sample FAQs
| Role | Password | |
|---|---|---|
| Admin | admin@educonnect.demo |
EduConnectDemo2025! |
| Teacher | teacher@educonnect.demo |
EduConnectDemo2025! |
| Institute | institute@educonnect.demo |
EduConnectDemo2025! |
| Student | student@educonnect.demo |
EduConnectDemo2025! |
frontend/src/config/demoLogin.js and backend/scripts/seedDemo.jsVITE_SHOW_DEMO_ACCOUNTS=true to show a Demo accounts panel with one-click login on the login page.Reset Demo Data
cd backend npm run seed:reset
Removes users with demo emails (and linked demo class/notice) then re-seeds everything.
Production Notes
- Build the frontend with the final API URL set in
VITE_API_BASE_URL, then runnpm run build. - Serve
frontend/distbehind HTTPS. - Run the backend with
npm start(or PM2 / Docker). - Set
FRONTEND_URLto your real frontend origin (CORS) and use a strongJWT_SECRET. - Set
VITE_SHOW_DEMO_ACCOUNTS=falseand remove or change demo users. - Ensure file upload folders under
backend/uploadsare persisted on the server.
Common Problems
| Issue | What to Check |
|---|---|
MongoServerError / connection failed | MONGO_URI, Atlas IP whitelist, username/password |
| Login fails for teacher/institute | Run npm run seed or ensure subscriptionStatus is active in DB |
| Frontend calls wrong API | VITE_API_BASE_URL — rebuild after any changes |
| CORS errors | FRONTEND_URL in backend .env must match the site origin exactly |
How to Get Your API Keys
The following optional variables unlock email and AI features. Here is exactly how to obtain each one.
9.1 EMAIL_USER & EMAIL_PASS — Gmail SMTP App Password
EMAIL_USER = your normal Gmail address. EMAIL_PASS = a 16-character App Password — not your regular Gmail login password.
- Go to https://myaccount.google.com/security
- Under "How you sign in to Google" click 2-Step Verification.
- Follow the prompts to turn it ON. (App Passwords are unavailable without this.)
- Go to https://myaccount.google.com/apppasswords (sign in if prompted).
- In the "App name" field type EduConnect and click Create.
- Google shows a 16-character password — example format:
backend/.env.
EMAIL_USER — your Gmail address:
EMAIL_PASS — the 16-character App Password (remove the spaces Google adds):
9.2 GEMINI_API_KEY — Google Gemini AI
- Go to https://aistudio.google.com
- Sign in with your Google account.
- Click "Get API key" in the left sidebar.
- Click "Create API key".
- Choose "Create API key in new project" (or select an existing Google Cloud project).
- The key is generated instantly — copy it now.
backend/.env.
GEMINI_API_KEY — your key (starts with AIzaSy...):
Quick Reference
| Variable | Value format | Where to get it |
|---|---|---|
EMAIL_USER |
Your Gmail address | Already have it — just paste |
EMAIL_PASS |
16-char App Password | myaccount.google.com/apppasswords |
GEMINI_API_KEY |
AIzaSy… key string | aistudio.google.com |