This guide walks you through setting up the Campus Resource Reservation System from scratch. Follow each step in order.
Before starting, make sure you have:
| Requirement | How to Check | Install Link |
|---|---|---|
| Node.js 20.x | node --version |
nodejs.org |
| npm 10.x | npm --version |
Comes with Node.js |
| Docker Desktop | docker --version |
docker.com |
| Git | git --version |
git-scm.com |
β οΈ Important: You're using Node.js v22 which may have compatibility issues. Consider using Node.js 20 LTS.
You have two options for the database:
-
Create Supabase Account
- Go to supabase.com
- Sign up for free
-
Create New Project
- Click "New Project"
- Name:
campusres - Database Password: Save this password!
- Region: Choose closest to you
- Click "Create new project"
-
Wait for Setup (takes 1-2 minutes)
-
Get Your Connection String
- Go to Project Settings β Database
- Copy the "Connection string" (URI)
- It looks like:
postgresql://postgres:[YOUR-PASSWORD]@db.xxxxx.supabase.co:5432/postgres
-
Enable Required Extension
- Go to SQL Editor in Supabase
- Run this SQL:
CREATE EXTENSION IF NOT EXISTS btree_gist;
If you prefer local development with Docker:
# Make sure Docker Desktop is running first!
cd C:\Users\Ashish\Downloads\L2_SE
docker-compose up -d postgres redisConnection string will be: postgresql://campusres:campusres@localhost:5432/campusres
The npm install failed. Let's clean everything:
# Open PowerShell as Administrator
cd C:\Users\Ashish\Downloads\L2_SE
# Delete all node_modules folders
Remove-Item -Recurse -Force node_modules -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force client\node_modules -ErrorAction SilentlyContinue
Remove-Item -Recurse -Force server\node_modules -ErrorAction SilentlyContinue
# Delete package-lock files
Remove-Item package-lock.json -ErrorAction SilentlyContinue
Remove-Item client\package-lock.json -ErrorAction SilentlyContinue
Remove-Item server\package-lock.json -ErrorAction SilentlyContinue
# Clear npm cache
npm cache clean --forcecd C:\Users\Ashish\Downloads\L2_SE\server
npm installcd C:\Users\Ashish\Downloads\L2_SE\client
npm installcd C:\Users\Ashish\Downloads\L2_SE
npm installcd C:\Users\Ashish\Downloads\L2_SE\server
Copy-Item .env.example .envNow edit the .env file with your settings:
notepad .envUpdate these values:
# If using Supabase, paste your connection string here:
DATABASE_URL="postgresql://postgres:[YOUR-PASSWORD]@db.xxxxx.supabase.co:5432/postgres"
# If using Docker locally:
# DATABASE_URL="postgresql://campusres:campusres@localhost:5432/campusres"
# Redis (only needed if using Docker - skip if not)
REDIS_URL="redis://localhost:6379"
# IMPORTANT: Change this to a random string!
JWT_SECRET="change-this-to-a-very-long-random-string-at-least-32-chars"
# Server settings
PORT=3001
NODE_ENV=developmentcd C:\Users\Ashish\Downloads\L2_SE\client
Copy-Item .env.example .env.localThe defaults should work for local development.
This creates all the tables in your database:
cd C:\Users\Ashish\Downloads\L2_SE\server
# Generate Prisma client
npx prisma generate
# Push schema to database (creates tables)
npx prisma db pushNote: If you see errors about
btree_gistextension, make sure you ran the SQL in Step 1.
npx prisma db seedThis creates:
- Sample users (admin, faculty, students)
- Sample rooms
- Sample bookings
Default login credentials after seeding:
| Role | Password | |
|---|---|---|
| Admin | admin@university.edu | Password123! |
| Faculty | professor@university.edu | Password123! |
| Student | student1@university.edu | Password123! |
cd C:\Users\Ashish\Downloads\L2_SE\server
npm run devYou should see:
β
Server running on http://localhost:3001
π API Documentation: http://localhost:3001/api-docs
Open a new terminal window:
cd C:\Users\Ashish\Downloads\L2_SE\client
npm run devYou should see:
β² Next.js 14.x
- Local: http://localhost:3000
- Open Browser: Go to http://localhost:3000
- Login: Use the credentials from Step 5.1
- Test Features:
- View the booking calendar
- Browse available rooms
- Try making a booking
Solution: Close VS Code and any terminals, then:
# Run PowerShell as Administrator
taskkill /f /im node.exe
Remove-Item -Recurse -Force node_modules
npm installSolution: Check your DATABASE_URL in .env:
- Make sure it's correct
- If using Supabase, ensure the project is active
- If using Docker, ensure containers are running:
docker ps
Solution: Run this SQL in Supabase SQL Editor:
CREATE EXTENSION IF NOT EXISTS btree_gist;Solution:
# Find what's using the port
netstat -ano | findstr :3001
# Kill the process (replace PID)
taskkill /PID <PID_NUMBER> /Fβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β YOUR BROWSER β
β http://localhost:3000 β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NEXT.JS CLIENT (Port 3000) β
β React Components, Booking Calendar β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β API Calls
βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EXPRESS SERVER (Port 3001) β
β Authentication, Booking Logic, Room Management β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββ
β
ββββββββββββββββ΄βββββββββββββββ
βΌ βΌ
ββββββββββββββββββββ ββββββββββββββββββββ
β SUPABASE/ β β REDIS β
β POSTGRESQL β β (Optional) β
β (Database) β β (Caching) β
ββββββββββββββββββββ ββββββββββββββββββββ
| File | Purpose |
|---|---|
server/.env |
Server configuration (database, secrets) |
client/.env.local |
Client configuration (API URLs) |
server/prisma/schema.prisma |
Database schema definition |
docker-compose.yml |
Docker services configuration |
| Component | Description |
|---|---|
| Next.js Client | User interface - calendar, forms, dashboards |
| Express Server | API endpoints, business logic, authentication |
| PostgreSQL | Stores users, rooms, bookings |
| Redis | Optional caching for performance |
| Prisma | Database ORM - makes database queries easy |
If you're still stuck:
- Check the terminal output for specific error messages
- Verify prerequisites (Node.js 20, Docker running)
- Double-check .env files have correct values
- Try the Troubleshooting section above
# 1. Clean up
cd C:\Users\Ashish\Downloads\L2_SE
Remove-Item -Recurse -Force node_modules, client\node_modules, server\node_modules -ErrorAction SilentlyContinue
# 2. Setup Supabase at supabase.com (get your connection string)
# 3. Install dependencies
cd server && npm install
cd ..\client && npm install
# 4. Configure server
cd ..\server
Copy-Item .env.example .env
# Edit .env and add your DATABASE_URL
# 5. Setup database
npx prisma generate
npx prisma db push
npx prisma db seed
# 6. Start server
npm run dev
# 7. New terminal - Start client
cd C:\Users\Ashish\Downloads\L2_SE\client
npm run dev
# 8. Open http://localhost:3000