{"id":23792210,"url":"https://github.com/juliusmarkwei/sms","last_synced_at":"2026-04-11T07:02:31.049Z","repository":{"id":268849107,"uuid":"903921602","full_name":"juliusmarkwei/SMS","owner":"juliusmarkwei","description":"school management system","archived":false,"fork":false,"pushed_at":"2025-01-06T10:27:32.000Z","size":1854,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T13:52:26.609Z","etag":null,"topics":["expressjs","mongodb","nodejs","school-management","testing-tools","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juliusmarkwei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-15T22:23:32.000Z","updated_at":"2025-01-02T10:16:29.000Z","dependencies_parsed_at":"2024-12-19T09:31:18.823Z","dependency_job_id":"ff8a352b-842a-4af8-b4da-385cad82a618","html_url":"https://github.com/juliusmarkwei/SMS","commit_stats":null,"previous_names":["julius-amt/sms"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juliusmarkwei/SMS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliusmarkwei%2FSMS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliusmarkwei%2FSMS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliusmarkwei%2FSMS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliusmarkwei%2FSMS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juliusmarkwei","download_url":"https://codeload.github.com/juliusmarkwei/SMS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juliusmarkwei%2FSMS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31671630,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expressjs","mongodb","nodejs","school-management","testing-tools","typescript"],"created_at":"2025-01-01T18:28:36.312Z","updated_at":"2026-04-11T07:02:31.030Z","avatar_url":"https://github.com/juliusmarkwei.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# School Management System API\n\n## Overview\n\nThis is a robust, scalable web application designed to digitize and streamline school administrative processes. The application focuses on comprehensive data management, complex sorting mechanisms, and efficient API design, supporting entities like **Student**, **Course**, **Instructor**, and **Enrollment**.\n\n### Features\n\n-   **Student Management**: CRUD operations for managing student data.\n-   **Course Management**: CRUD operations for managing course offerings.\n-   **Enrollment Management**: Enroll students in courses and manage their course enrollment.\n-   **Sorting Endpoints**: Various sorting algorithms applied to student and course data.\n-   **JWT Authentication**: Secure user authentication with token-based login.\n-   **Advanced Filtering**: Dynamic query filters, such as `cgpa=gte:2.8`, for refined searches.\n-   **Caching**: Dynamic key-based caching mechanism with a 1-minute expiration for optimized performance.\n-   **CORS Configuration**: Initially restricted to specific applications, now configured to accept requests from all origins.\n\n---\n\n## Project Structure\n\n```\n.\n├── package.json\n├── package-lock.json\n├── README.md\n├── src\n│   ├── controllers\n│   │   ├── auth.ts          # Handles authentication routes like login and password reset.\n│   │   ├── courses.ts       # Manages course-related operations.\n│   │   ├── enrollments.ts   # Handles student enrollments in courses.\n│   │   ├── instructor.ts    # Manages instructor-specific actions.\n│   │   ├── sort.ts          # Provides sorting functionality for students and courses.\n│   │   └── students.ts      # Manages student-related CRUD operations.\n│   ├── logs\n│   │   └── http.log         # Stores HTTP request and response logs.\n│   ├── models\n│   │   ├── Course.ts        # Schema and model for courses.\n│   │   ├── Enrollment.ts    # Schema and model for course enrollments.\n│   │   ├── Instructor.ts    # Schema for instructors extending from the User model.\n│   │   ├── Student.ts       # Schema for students extending from the User model.\n│   │   └── User.ts          # Parent model storing shared user information.\n│   ├── routes\n│   │   ├── auth.ts          # Defines routes for authentication.\n│   │   ├── courses.ts       # Defines routes for course operations.\n│   │   ├── enrollments.ts   # Defines routes for enrollment actions.\n│   │   ├── instructors.ts   # Defines routes for instructor management.\n│   │   ├── sort.ts          # Defines routes for sorting functionalities.\n│   │   └── students.ts      # Defines routes for student management.\n│   ├── script.ts            # Entry point for utility scripts or setup tasks.\n│   └── utils\n│       ├── cache.ts         # Caching mechanism for improved performance.\n│       ├── dbConfig.ts      # Database configuration file.\n│       ├── enums.ts         # Contains enumerations for constants.\n│       ├── logger.ts        # Logger setup using Winston.\n│       ├── mailer.ts        # Utility for sending emails.\n│       ├── middleware\n│       │   ├── authenticateUser.ts   # JWT-based user authentication middleware.\n│       │   ├── handleReqBodyErrors.ts # Validates and handles request body errors.\n│       │   ├── isInstructor.ts       # Middleware to check instructor roles.\n│       │   ├── processCourses.ts     # Middleware for processing course data.\n│       │   ├── rateLimitStudent.ts   # Rate-limiting middleware for students.\n│       │   └── validators\n│       │       ├── auth.ts           # Validation for authentication requests.\n│       │       ├── course.ts         # Validation for course-related requests.\n│       │       ├── instructor.ts     # Validation for instructor actions.\n│       │       └── student.ts        # Validation for student-related actions.\n│       ├── sortingTechniques.ts      # Implementation of sorting algorithms.\n│       ├── swaggerConfig.ts          # Swagger API documentation configuration.\n│       └── types\n│           ├── course.d.ts           # Type definitions for course data.\n│           ├── instructor.d.ts       # Type definitions for instructor data.\n│           ├── jwt.d.ts              # Type definitions for JWT tokens.\n│           ├── student.d.ts          # Type definitions for student data.\n│           └── user.d.ts             # Type definitions for shared user data.\n└── tsconfig.json                     # TypeScript configuration file.\n```\n\n---\n\n## Features\n\n### User Entities\n\n#### 1. **Student**\n\n-   Students have limited access to their own personal information such as enrolled courses.\n\n#### 2. **Instructor**\n\n-   Instructors have full system and management capabilities, including student account creation, course creation, etc.\n\n### Authentication\n\n-   **JWT-based Authentication**: All users must log in using email/password credentials to receive a JWT token for secure access to protected routes.\n\n---\n\n## Advanced Functionalities\n\n-   **Caching**: Implements a dynamic key-based caching system with a 1-minute expiration.\n-   **Advanced Filtering**: Supports query filters like `cgpa=gte:2.8` for precise data retrieval.\n-   **CORS Configuration**: Initially restricted to specific applications, now open to all origins for better accessibility.\n\n---\n\n## API Routes\n\n### Public Routes\n\n-   **POST** `/api/v1/auth/login`: Log in and retrieve accessToken and refreshToken.\n-   **POST** `/api/v1/auth/forgot-password`: Request a password reset link.\n-   **POST** `/api/v1/auth/password-reset`: Send the token received in your mail and your new password.\n-   **POST** `/api/v1/auth/refresh-token`: Send the refreshToken in request body to get recieve a new accessToken.\n\n### Protected Routes\n\n#### Student Management\n\n-   **GET** `/students`: Retrieve all students. (Accessible to instructors only)\n-   **GET** `/students/{id}`: Retrieve specific student details. (Instructors and self-access for students)\n-   **POST** `/students`: Create a new student record. (Instructors only)\n-   **PUT** `/students/{id}`: Update student information. (Instructors and self-access for students)\n-   **DELETE** `/students/{id}`: Remove a student from the system. (Instructors only)\n\n#### Course Management\n\n-   **GET** `/courses`: List all courses. (Accessible to all authenticated users)\n-   **GET** `/courses/{courseCode}`: Retrieve specific course details. (Accessible to all authenticated users)\n-   **POST** `/courses`: Create a new course. (Instructors only)\n-   **PUT** `/courses/{courseCode}`: Update course information. (Instructors only)\n-   **DELETE** `/courses/{courseCode}`: Remove a course. (Instructors only)\n\n#### Enrollment Management\n\n-   **POST** `/enrollments`: Enroll a student in a course. (Instructors only, self-enrollment for students with restrictions)\n-   **GET** `/enrollments/student/{studentId}`: Retrieve all courses for a student. (Self-access for students)\n-   **GET** `/enrollments/course/{courseCode}`: Retrieve all students enrolled in a course. (Instructors only)\n-   **DELETE** `/enrollments/{enrollmentId}`: Cancel an enrollment. (Instructors only, self-cancellation for students)\n\n#### Sorting Endpoints\n\n-   **GET** `/sort/students`: Sort student data by different fields (e.g., GPA, grade, etc.).\n-   **GET** `/sort/courses`: Sort course listings based on various criteria (e.g., course duration, name, etc.).\n\n#### Instructors Management (Instructors-specific only)\n\n-   **GET** `/instructors`: Retrieve all instructors.\n-   **GET** `/instructors/{id}`: Retrieve specific instructors details.\n-   **POST** `/instructors`: Create a new student record.\n-   **PUT** `/instructors/{id}`: Update instructors information.\n-   **DELETE** `/instructors/{id}`: Remove a instructors from the system.\n\n---\n\n## Advanced Requirements\n\n-   **Comprehensive Input Validation**: Middleware to validate inputs and ensure proper data formatting.\n-   **Error Handling**: Middleware for handling errors.\n-   **Logging**: Use of Winston to log system activities.\n-   **Pagination**: Implemented pagination for list endpoints (students, courses).\n-   **API Documentation**: Swagger-generated documentation for all endpoints.\n\n---\n\n## Performance Considerations\n\n-   **Caching**: Caching strategies for commonly accessed data.\n-   **Optimized Database Queries**: Ensuring fast data retrieval with optimized queries.\n-   **Indexing**: Indexing frequently accessed fields for better performance.\n\n---\n\n## Response Example\n\n#### Sorting Algorithm Endpoint\n\n**GET** `/sort/students`\n\nRequest query-parameter:\n\n```json\n{\n    \"sortBy\": \"cgpa\",\n    \"order\": \"asc\"\n}\n```\n\nResponse:\n\n```json\n{\n    \"success\": true,\n    \"count\": 2,\n    \"page\": 1,\n    \"limit\": 2,\n    \"data\": [\n        { \"_id\": 1, \"name\": \"Julius Markwei\", \"cgpa\": 3.5,... },\n        { \"_id\": 2, \"name\": \"Sherlock Holmes\", \"cgpa\": 3.8,... }\n    ]\n}\n```\n\n---\n\n## Swagger API Documentation\n\nBelow is a preview of the browsable API documentation using Swagger.\n\n![Swagger API Documentation](./public/Screenshot1.png)\n![Swagger API Documentation](./public/Screenshot2.png)\n\n---\n\n## Installation\n\n1.  Clone the repository:\n\n    ```bash\n    git clone https://github.com/julius-amt/SMS.git\n    ```\n\n2.  Move into the project directory\n\n    ```bash\n    cd SMS/\n    ```\n\n3.  Install dependencies:\n\n    ```bash\n    npm install\n    ```\n\n4.  Configure environment variables:\n\n        - Create a `.env` file in the root directory.\n        - Add required environment variables like database credentials, JWT secret, etc.\n        - Content of `.env` file:\n            * MONGODB_URI=MONGODB_URI\n            * JWT_SECRET=JWT_SECRET\n            * EMAIL_HOST=EMAIL_HOST\n            * EMAIL_PORT=EMAIL_PORT\n            * EMAIL_SECURE=EMAIL_SECURE\n            * EMAIL_USER=EMAIL_USER\n            * EMAIL_PASS=EMAIL_PASS\n            * BASE_URL=BASE_URL\n\n5.  Start the application:\n    ```bash\n    npm run dev\n    ```\n\n---\n\n## Technologies Used\n\n-   **Node.js**: JavaScript runtime for building scalable applications.\n-   **Express.js**: Web framework for building APIs.\n-   **MongoDB**: NoSQL database for storing application data.\n-   **Mongoose**: ORM for interacting with MongoDB.\n-   **JWT**: Token-based authentication for secure access.\n-   **Winston**: Logging library for logging system activities.\n-   **Swagger**: API documentation tool.\n-   **TypeScript**: Typed superset of JavaScript for improved development experience.\n\n---\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliusmarkwei%2Fsms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuliusmarkwei%2Fsms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuliusmarkwei%2Fsms/lists"}