A React-based enrollment management system for students and faculty members.
- View available courses and enroll
- View personal enrollments
- View grades for enrolled courses
- Role-based dashboard
- View all courses
- Upload grades for students
- Role-based dashboard
- Authentication (login/logout)
- Protected routes
- Role-based access control
- Responsive design
- Loading states and error handling
- Framework: React 18.3.1
- Build Tool: Vite 5.4.1
- Routing: React Router DOM 6.26.0
- HTTP Client: Axios 1.7.2
- Styling: Inline CSS (no external library)
- Node.js (v20.14.0 or higher recommended)
- npm (v10.8.1 or higher)
- Clone the repository:
git clone <repository-url>
cd Distributed-Fault-Tolerance-- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser and navigate to:
http://localhost:5173
(Port may vary if 5173 is in use)
- Email: student@test.com
- Password: student123
- Name: John Student
- ID: 1
- Email: faculty@test.com
- Password: faculty123
- Name: Dr. Jane Faculty
- ID: 2
src/
├── components/ # Reusable components
│ ├── Navbar.jsx # Navigation bar with auth
│ ├── ProtectedRoute.jsx # Route protection wrapper
│ ├── LoadingSpinner.jsx # Loading indicator
│ └── ErrorMessage.jsx # Error display component
├── pages/ # Page components
│ ├── Login.jsx # Login page
│ ├── Dashboard.jsx # Role-based dashboard
│ ├── Courses.jsx # Course listing & enrollment
│ ├── MyEnrollments.jsx # Student enrollments
│ ├── Grades.jsx # Student grades view
│ └── UploadGrades.jsx # Faculty grade upload
├── services/ # API service layer
│ ├── authService.js # Authentication services
│ ├── courseService.js # Course & enrollment services
│ ├── gradeService.js # Grade services
│ └── mockData.js # Mock data for development
├── utils/ # Utility functions
│ └── auth.js # Auth helper functions
├── config.js # Configuration & theme
├── App.jsx # Main app component
├── main.jsx # Entry point
└── index.css # Global styles
/login- User authentication
/dashboard- Student dashboard/courses- Browse and enroll in courses/my-enrollments- View enrolled courses/grades- View grades
/dashboard- Faculty dashboard/courses- View all courses/upload-grades- Upload student grades
The application currently uses mock data for development. The following data is available:
- Web Development (30 capacity, 25 enrolled)
- Data Structures (25 capacity, 20 enrolled)
- Database Systems (20 capacity, 15 enrolled)
- Mobile Development (25 capacity, 22 enrolled)
- John Doe (student@test.com)
- Jane Smith (jane@test.com)
- Bob Johnson (bob@test.com)
- Student ID 1 is enrolled in:
- Web Development (enrolled: 2024-01-15)
- Database Systems (enrolled: 2024-01-20)
- Student ID 1 has grades:
- Web Development: A (uploaded: 2024-05-10)
- Database Systems: B+ (uploaded: 2024-05-12)
The frontend expects the following API endpoints to be implemented:
http://localhost:3000/api
Login user and return JWT token
Request:
{
"email": "string",
"password": "string"
}
Response:
{
"token": "string",
"user": {
"id": "number",
"email": "string",
"name": "string",
"role": "student" | "faculty"
}
}Logout user (optional - currently handled client-side)
Get all available courses
Response:
[
{
"id": "number",
"name": "string",
"description": "string",
"capacity": "number",
"enrolled_count": "number"
}
]Enroll student in a course
Request:
{
"studentId": "number"
}
Response:
{
"success": "boolean",
"message": "string",
"course": { /* course object */ }
}Get enrollments for a specific student
Response:
[
{
"id": "number",
"course_id": "number",
"course_name": "string",
"enrolled_at": "string (ISO date)"
}
]Get grades for a specific student
Response:
[
{
"id": "number",
"course_name": "string",
"grade": "string",
"uploaded_at": "string (ISO date)"
}
]Upload a grade (faculty only)
Request:
{
"courseId": "number",
"studentId": "number",
"grade": "string",
"facultyId": "number"
}
Response:
{
"success": "boolean",
"message": "string",
"data": {
"courseId": "number",
"courseName": "string",
"studentId": "number",
"studentName": "string",
"grade": "string",
"uploadedAt": "string (ISO date)"
}
}Get all students (faculty only)
Response:
[
{
"id": "number",
"name": "string",
"email": "string"
}
]- User logs in with email/password
- Backend validates credentials and returns JWT token
- Frontend stores token in localStorage
- Frontend includes token in Authorization header for protected requests
- On logout, token is cleared from localStorage
The application handles errors at multiple levels:
- Network errors (API unavailable)
- Authentication errors (invalid credentials)
- Validation errors (missing required fields)
- Business logic errors (course full, etc.)
All errors are displayed to users with appropriate messaging.
npm run buildThe built files will be in the dist/ directory.
npm run preview- Real-time notifications
- Email confirmations
- Advanced filtering and search
- Analytics dashboard
- Export functionality (PDF, CSV)
- File upload for bulk grade imports
- Student profile management
- Course prerequisites
- Waiting list for full courses
- Create a feature branch
- Make your changes
- Test thoroughly with both student and faculty accounts
- Submit a pull request
MIT License
For questions or support, please open an issue in the repository.