-
Create Frontend Project in Vercel:
- Go to Vercel Dashboard
- Click "New Project"
- Import your repository
- Important: Set the "Root Directory" to
newer - Use
vercel-frontend.jsonas the configuration file
-
Frontend Configuration:
- Root Directory:
newer - Build Command:
npm run build - Output Directory:
build - Framework Preset: Vite
- Root Directory:
-
Create Backend Project in Vercel:
- Go to Vercel Dashboard
- Click "New Project"
- Import the same repository
- Important: Set the "Root Directory" to
.(root) - Use
vercel-backend.jsonas the configuration file
-
Backend Configuration:
- Root Directory:
.(root) - Build Command: (leave empty)
- Output Directory: (leave empty)
- Framework Preset: Other
- Root Directory:
After deploying both, update the frontend to use the backend URL:
// In newer/src/components/TimetableGenerator.tsx and TimetableGrid.tsx
const response = await fetch("https://your-backend-project.vercel.app/api/generate", {-
Create new repository for frontend only
-
Copy frontend files:
# Create new repo mkdir timetable-frontend cd timetable-frontend # Copy frontend files cp -r ../SmartTimetableScheduler/newer/* . cp ../SmartTimetableScheduler/vercel-frontend.json ./vercel.json
-
Deploy to Vercel:
- Connect the frontend repository
- Vercel will auto-detect Vite configuration
-
Create new repository for backend only
-
Copy backend files:
# Create new repo mkdir timetable-backend cd timetable-backend # Copy backend files cp -r ../SmartTimetableScheduler/api . cp ../SmartTimetableScheduler/vercel-backend.json ./vercel.json cp ../SmartTimetableScheduler/package.json .
-
Deploy to Vercel:
- Connect the backend repository
- Vercel will auto-detect serverless functions
{
"name": "smart-timetable-scheduler",
"version": "1.0.0",
"private": true,
"workspaces": [
"newer",
"api"
],
"scripts": {
"dev": "cd newer && npm run dev",
"build": "cd newer && npm run build",
"install:all": "npm install && cd newer && npm install"
}
}Use the updated vercel.json (which I just fixed) that properly handles the monorepo structure.
I recommend Option 1 (Single Repository, Two Vercel Projects) because:
- ✅ Keeps everything in one repository
- ✅ Allows independent deployments
- ✅ Easier to manage
- ✅ No need to split repositories
The current vercel.json should now work correctly. The key changes:
- ✅ Uses
@vercel/static-buildfor frontend - ✅ Points to
newer/package.jsonfor frontend build - ✅ Properly routes to
newer/build/directory - ✅ Separates frontend and backend builds
Try deploying again with the updated configuration!