AutoPlanner is a full-stack timetable planning platform for schools and colleges. It helps administrators manage teachers, subjects, rooms, class groups, and timeslots, then generate optimized timetables using a constraint-based scheduling engine.
- Google OAuth authentication
- Entity management for teachers, rooms, subjects, class groups, and timeslots
- Constraint-based timetable generation
- Timetable viewer with filtering by class, teacher, and room
- PostgreSQL persistence with Prisma ORM
- Modern React dashboard UI
- Frontend: React, Vite, Tailwind CSS, React Router, Axios, React Hook Form, Zod
- Backend: Node.js, TypeScript, Express
- Database: PostgreSQL + Prisma
- Auth: Google OAuth 2.0 + JWT cookie session
AutoPlanner/
frontend/ # React + Vite web app
server/ # Express + TypeScript API and scheduler engine
plan_diagrams/ # UML and planning diagrams
- Node.js 18+ (Node.js 20+ recommended)
- npm 9+
- PostgreSQL database
- Google OAuth client (Web application)
Create server/.env and configure:
DATABASE_URL="postgresql://<user>:<password>@<host>:<port>/<db>?sslmode=require"
GOOGLE_CLIENT_ID="<google-client-id>"
GOOGLE_CLIENT_SECRET="<google-client-secret>"
GOOGLE_REDIRECT_URI="http://localhost:4000/api/auth/google/callback"
JWT_SECRET="<long-random-secret-at-least-32-chars>"
JWT_EXPIRES_IN="7d"
NODE_ENV="development"
PORT=4000
CORS_ORIGIN="http://localhost:3000"
FRONTEND_URL="http://localhost:3000"Notes:
CORS_ORIGINsupports comma-separated origins in production.FRONTEND_URLis used for OAuth success redirect target.
VITE_API_URL=http://localhost:4000/apiFor production builds, use frontend/.env.production:
VITE_API_URL=https://<your-backend-domain>/apiIn Google Cloud Console (OAuth client type: Web application):
- Authorized JavaScript origins:
http://localhost:3000- Your production frontend URL
- Authorized redirect URIs:
http://localhost:4000/api/auth/google/callbackhttps://<your-backend-domain>/api/auth/google/callback
- Install backend dependencies:
cd server
npm install- Install frontend dependencies:
cd ../frontend
npm install- Set up database and Prisma (from
server/):
npm run db:generate
npm run db:migrate
# Optional seed
npm run db:seed- Start backend (from
server/):
npm run dev- Start frontend (from
frontend/):
npm run dev- Open the app:
http://localhost:3000
npm run dev- Run API in development mode with auto-reloadnpm run build- Compile TypeScript todist/npm run start- Run compiled APInpm run lint- Type-check without emitnpm run db:generate- Generate Prisma clientnpm run db:migrate- Run Prisma migrations in devnpm run db:push- Push schema directly to DBnpm run db:seed- Seed databasenpm run db:studio- Open Prisma Studionpm run db:reset- Reset DB and reseed
npm run dev- Start Vite dev servernpm run build- Build production assetsnpm run preview- Preview production build locally
Base URL: /api
GET /healthGET /healthzGET /GET /api/auth/googleGET /api/auth/google/callbackGET /api/auth/mePOST /api/auth/logoutGET|POST|PUT|DELETE /api/teachersGET|POST|PUT|DELETE /api/roomsGET|POST|PUT|DELETE /api/subjectsGET|POST|PUT|DELETE /api/class-groupsGET|POST|PUT|DELETE /api/timeslotsGET|POST|DELETE /api/timetables(+ latest/entries/generate helpers)
Most non-auth routes require an authenticated session cookie.
The scheduler validates assignments against these constraints:
- Teacher availability
- Teacher time conflicts
- Room capacity
- Room time conflicts
- Class group time conflicts
- Subject daily session limit
- Deploy frontend and backend as separate services if needed.
- Set
VITE_API_URLto backend API URL in frontend production env. - Set backend
CORS_ORIGINto frontend URL(s). - Set backend
GOOGLE_REDIRECT_URIto deployed backend callback URL. - Set backend
FRONTEND_URLto deployed frontend URL. - Configure Render's health check path to
/healthor/healthz. - In production, auth cookies are configured for cross-origin usage (
Secure+SameSite=None).
- Login succeeds but user returns to login page:
- Verify
VITE_API_URL,CORS_ORIGIN,GOOGLE_REDIRECT_URI, andFRONTEND_URL. - Ensure frontend and backend domains match your OAuth and CORS settings.
- Verify
- CORS errors in browser console:
- Add the exact frontend origin to
CORS_ORIGIN.
- Add the exact frontend origin to
- Database connection issues:
- Confirm
DATABASE_URLand database network/SSL configuration.
- Confirm
ISC