A simple full‑stack Job Portal with a Node.js/Express backend, Prisma ORM (MySQL), and a React + Vite frontend. Users can register/login and the data is persisted via Prisma models (User, Job, Application).
- Authentication: Register and login endpoints using JWT.
- Data Models:
User,Job, andApplicationmanaged via Prisma. - Prisma Studio: Explore and edit your DB in the browser.
- Node.js 18+ (Node 22 works as well)
- npm 10+
- MySQL 8+ running locally
git clone <your-repo-url>
cd Job-Portal
npm installCreate a .env file at the repository root:
DATABASE_URL="mysql://root:password@localhost:3306/job-portal"
PORT=3002
JWT_SECRET=some_test_secretNotes:
- Update the MySQL user/password/host/port/database to match your local setup.
- The backend reads env vars from the root
.env.
# Generate client
npx prisma generate --schema backend/prisma/schema.prisma
# For a fresh dev database, create tables from schema
npx prisma migrate dev --schema backend/prisma/schema.prisma --name init
# If Prisma reports drift and you want to reset dev DB
npx prisma migrate reset --schema backend/prisma/schema.prisma --forceOptional: Open Prisma Studio
npx prisma studio --schema backend/prisma/schema.prismaFrom the project root:
npm run dev
# Server will start on PORT from .env (default 3002)Health check:
curl -sS http://localhost:3002/
# {"ok": true}Common port issues:
lsof -i :3002
kill -9 <PID>
npm run devOpen a second terminal:
cd frontend
npm install
npm run devVite will print a local URL such as http://localhost:5173. The frontend can call the backend at http://localhost:3002 (adjust if you change the port).
POST /api/auth/register– body:{ name, email, password, role }POST /api/auth/login– body:{ email, password }
On success, both return a JWT token and basic user info.
npm run dev– start the backend
npm run dev– start the Vite dev servernpm run build– production buildnpm run preview– preview built app
- EPERM/EADDRINUSE on port 3002: ensure only one server is running; use
lsof -i :3002thenkill -9 <PID>and restart. You can also changePORTin.env. - Prisma drift or missing tables: run
npx prisma migrate devornpx prisma migrate reset --forcefor a clean dev database.