A full-stack automated scheduling application designed to generate conflict-free university timetables. This project utilizes a Greedy Algorithm for scheduling and enforces strict data integrity using MySQL Triggers and Constraints.
- Project Overview
- Key Features
- Tech Stack
- Database Architecture
- Installation & Setup
- How to Use
- Testing DBMS Constraints
Manual timetable generation is prone to errors like double-booking professors or assigning lab subjects to theory classrooms. This system automates the process by:
- Input Management: Collecting Batches, Faculty, Subjects, and Rooms via a modern UI.
- Smart Allocation: Running a server-side algorithm to assign slots based on availability.
- Constraint Enforcement: Using SQL Triggers to strictly block invalid entries (e.g., Lab subject in a Lecture Hall).
- Fixed Allocations: allowing admins to force specific subjects into specific rooms.
- Conflict-Free: Automatically checks for Faculty, Batch, and Room clashes before booking.
- Greedy Approach: Fills the earliest available slot to maximize resource utilization.
- Lab Logic: Prevents Lab Subjects from being scheduled in Lecture Halls.
- Theory Logic: Prevents Theory Subjects from being scheduled in Labs.
- Weekly Limits: Blocks scheduling if a subject exceeds its weekly hour quota.
- Supports "Fixed Rooms": If an admin specifies a "Fixed Room ID" for a subject (e.g., Chemistry -> Chemistry Lab), the system guarantees that class happens only in that room.
- Responsive Design: Floating input cards with hover effects.
- Visual Feedback: Success/Error messages and status pills (Lab/Lecture tags).
- Animations: Table rows cascade in with a smooth fade effect.
| Component | Technology | Role |
|---|---|---|
| Frontend | React.js | UI Components, State Management, Axios. |
| Backend | Node.js + Express | REST API, Scheduling Logic. |
| Database | MySQL | Relational Data, Triggers, Stored Procedures. |
| Styling | CSS3 | Custom Dashboard Theme, Google Fonts (Poppins). |
departments: Master list of departments.faculty: Professors linked to departments.subjects: Course details (includesis_lab,fixed_room_idfor preference).batches: Student groups (e.g., "3rd Year CSE").rooms: Physical resources (includestype: 'Lecture' or 'Lab').timeslots: Fixed slots (e.g., Mon 09:00 - 10:00).timetable: The core transaction table linking all entities.
check_lab_rules_before_insert: The "Bouncer" that rejects invalid room/subject combinations.
- Node.js installed.
- MySQL Server installed and running.
- Open your terminal or MySQL Workbench.
- Run the provided SQL script to create the database schema:
mysql -u root -p < db_setup.sql
- Navigate to the backend folder:
cd backend - Install dependencies:
npm install
- Configuration: Open
index.jsand update the database password:const pool = mysql.createPool({ // ... password: 'YOUR_MYSQL_PASSWORD', // <--- Update this! // ... });
- Start the server:
node index.js
- Open a new terminal and navigate to the frontend folder:
cd frontend - Install dependencies:
npm install
- Start the React app:
npm start
Browser will open at
http://localhost:3000
- Reset System: Click the white "Reset" button to clear old data.
- Add Resources:
- Add a Batch (e.g., "3rd Year CSE").
- Add a Faculty (e.g., "Dr. Smith").
- Add a Room (e.g., "Room 101", Type: Lecture).
- Add a Subject (e.g., "DBMS", Hours: 3).
- Optional: Enter a Fixed Room ID to force a specific room.
- Generate: Click the big "⚡ Generate Timetable" button.
- View: Select your batch from the dropdown to view the schedule.
You can verify the SQL Triggers are working by attempting to break the rules:
- Add a Lab Subject (e.g., "Physics Lab").
- Add only Lecture Rooms (e.g., "Room 101").
- Click Generate.
- Result: The system will fail to schedule that class because the SQL Trigger (
check_lab_rules_before_insert) blocked the insertion of a Lab subject into a Lecture room.
DBMS Mini Project