EduConnect

Setup & Deployment Guide — Full walkthrough from zero to running

v1.0  ·  2025
1

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
⚠️ There is no MongoDB database bundled. You must create a database and paste its URI into .env.
2

Install Node.js and npm

node -v
npm -v
3

Create a MongoDB Database

Option A — MongoDB Atlas (cloud, recommended for demos)

  1. Sign up at https://www.mongodb.com/cloud/atlas
  2. Create a free cluster.
  3. Database Access → add a user with a password.
  4. Network Access → allow your IP (or 0.0.0.0/0 for testing only).
  5. DatabaseConnectDrivers → copy the connection string.
  6. Replace <password> with your user password.
  7. Add a database name before the query string, e.g.:
URI ...mongodb.net/educonnect?retryWrites=true&w=majority

Option B — Local MongoDB

Install MongoDB Community Server, start mongod, then use:

URI mongodb://127.0.0.1:27017/educonnect
4

Configure the Backend

1
Open a terminal in the backend folder.
2
Copy the example environment file.
Windows (PowerShell):  Copy-Item .env.example .env
macOS / Linux:         cp .env.example .env
3
Open 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
4
Install dependencies and start the API.
npm install
npm run dev

You should see MongoDB Connected and the server listening on port 5000.

Optional Backend Variables

VariablePurpose
EMAIL_USER, EMAIL_PASSOutgoing mail (Gmail App Password) for password reset
STRIPE_SECRET_KEYStripe payments
GEMINI_API_KEYAI features if enabled in your build
ℹ️Leave optional keys empty if you do not use those features yet. See § 9 for step-by-step instructions on obtaining each key.
5

Configure the Frontend

1
Open a second terminal in the frontend folder.
2
Copy the example file (same commands as above), then edit 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.

3
Install and run:
npm install
npm run dev

Open a browser at http://localhost:5173 (or the URL Vite prints).

6

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
🔑 Shared password — all accounts EduConnectDemo2025!
Password EduConnectDemo2025!
RoleEmailPassword
Admin admin@educonnect.demo EduConnectDemo2025!
Teacher teacher@educonnect.demo EduConnectDemo2025!
Institute institute@educonnect.demo EduConnectDemo2025!
Student student@educonnect.demo EduConnectDemo2025!
📄Credential config files: frontend/src/config/demoLogin.js and backend/scripts/seedDemo.js
Set VITE_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.

7

Production Notes

  1. Build the frontend with the final API URL set in VITE_API_BASE_URL, then run npm run build.
  2. Serve frontend/dist behind HTTPS.
  3. Run the backend with npm start (or PM2 / Docker).
  4. Set FRONTEND_URL to your real frontend origin (CORS) and use a strong JWT_SECRET.
  5. Set VITE_SHOW_DEMO_ACCOUNTS=false and remove or change demo users.
  6. Ensure file upload folders under backend/uploads are persisted on the server.
8

Common Problems

IssueWhat to Check
MongoServerError / connection failedMONGO_URI, Atlas IP whitelist, username/password
Login fails for teacher/instituteRun npm run seed or ensure subscriptionStatus is active in DB
Frontend calls wrong APIVITE_API_BASE_URL — rebuild after any changes
CORS errorsFRONTEND_URL in backend .env must match the site origin exactly
9

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 Passwordnot your regular Gmail login password.
1
Enable 2-Step Verification on your Google account.
  • 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.)
2
Generate an App Password.
Example abcd efgh ijkl mnop
⚠️Copy it immediately — it is shown only once.
3
Paste into backend/.env.

EMAIL_USER — your Gmail address:

EMAIL_USER yourname@gmail.com

EMAIL_PASS — the 16-character App Password (remove the spaces Google adds):

EMAIL_PASS abcdefghijklmnop
App Passwords bypass the "Less secure app" restriction entirely — no extra Gmail settings needed.

9.2  GEMINI_API_KEY — Google Gemini AI

Gemini API keys are free to create. Google offers a generous free tier suitable for development and small projects.
1
Open Google AI Studio.
2
Create an API Key.
  • 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.
3
Paste into backend/.env.

GEMINI_API_KEY — your key (starts with AIzaSy...):

GEMINI_API_KEY AIzaSyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Quick Reference

VariableValue formatWhere 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