{"id":30750824,"url":"https://github.com/shakilofficial/mini-school","last_synced_at":"2025-09-04T07:05:51.314Z","repository":{"id":311832867,"uuid":"1045249570","full_name":"Shakilofficial/mini-school","owner":"Shakilofficial","description":"A full-featured school management REST API built with Express.js, TypeScript, PostgreSQL, and Prisma. Supports role-based authentication, student \u0026 class management, and user management with JWT security. Includes Postman collection for easy testing.","archived":false,"fork":false,"pushed_at":"2025-08-27T03:28:34.000Z","size":69,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-27T06:45:10.940Z","etag":null,"topics":["express","jwt","nodejs","postgresql","prisma","restful-api","server","tyepscript"],"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/Shakilofficial.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":"2025-08-26T21:57:19.000Z","updated_at":"2025-08-27T03:28:37.000Z","dependencies_parsed_at":"2025-08-27T06:46:04.559Z","dependency_job_id":"33b7b2e7-526f-4560-ad11-e1f6bfa1f41d","html_url":"https://github.com/Shakilofficial/mini-school","commit_stats":null,"previous_names":["shakilofficial/mini-school"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/Shakilofficial/mini-school","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakilofficial%2Fmini-school","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakilofficial%2Fmini-school/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakilofficial%2Fmini-school/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakilofficial%2Fmini-school/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shakilofficial","download_url":"https://codeload.github.com/Shakilofficial/mini-school/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shakilofficial%2Fmini-school/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273568192,"owners_count":25128735,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"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":["express","jwt","nodejs","postgresql","prisma","restful-api","server","tyepscript"],"created_at":"2025-09-04T07:02:05.517Z","updated_at":"2025-09-04T07:05:51.295Z","avatar_url":"https://github.com/Shakilofficial.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mini School Management API\n\nA **robust and scalable API** for managing school operations, built with **Express.js**, **TypeScript**, and **PostgreSQL** using **Prisma ORM**. This API enables efficient management of **users, students, and classes** with **JWT-based authentication** and **role-based authorization**.\n\n---\n\n## Table of Contents\n\n* [Features](#features)\n* [Tech Stack](#tech-stack)\n* [Prerequisites](#prerequisites)\n* [Installation](#installation)\n* [Environment Variables](#environment-variables)\n* [Database Setup](#database-setup)\n* [Running the Application](#running-the-application)\n* [Docker Setup](#docker-setup)\n* [API Endpoints](#api-endpoints)\n\n  * [Authentication](#authentication-endpoints)\n  * [User Management](#user-endpoints)\n  * [Student Management](#student-endpoints)\n  * [Class Management](#class-endpoints)\n* [Project Structure](#project-structure)\n* [Authentication \u0026 Authorization](#authentication-and-authorization)\n* [Contributing](#contributing)\n* [License](#license)\n\n---\n\n## Features\n\n### **Authentication \u0026 Authorization**\n\n* JWT-based authentication with **access** and **refresh tokens**\n* Role-based access control: **Admin**, **Teacher**, **Student**\n* Login, logout, and refresh token support\n\n### **User Management**\n\n* Create and manage users\n* Role-based restrictions\n* View own profile\n\n### **Student Management**\n\n* Create, update, view, and delete students\n* Assign students to classes\n\n### **Class Management**\n\n* Create and manage classes\n* Enroll students into classes\n* Retrieve students in a class\n* Filtering and searching for classes\n\n---\n\n## Tech Stack\n\n* **Backend**: Node.js, Express.js, TypeScript\n* **Database**: PostgreSQL\n* **ORM**: Prisma\n* **Authentication**: JWT (JSON Web Tokens)\n* **Validation**: Zod\n* **Containerization**: Docker \u0026 Docker Compose\n\n---\n\n## Prerequisites\n\n* Node.js (v18+)\n* Yarn package manager\n* PostgreSQL\n* Docker \u0026 Docker Compose (optional)\n\n---\n\n## Installation\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/Shakilofficial/mini-school.git\ncd mini-school\n```\n\n2. Install dependencies:\n\n```bash\nyarn install\n```\n\n3. Set up the `.env` file (see below)\n\n---\n\n## Environment Variables\n\nCreate a `.env` file in the root directory:\n\n```env\nPORT=5000\nNODE_ENV=development\n\n# Database\nDATABASE_URL=\"postgresql://postgres:123456@localhost:5432/miniSchoolDB?schema=public\"\n\n# Bcrypt\nBCRYPT_SALT_ROUNDS=8\n\n# JWT\nJWT_ACCESS_SECRET=your_jwt_secret_key\nJWT_ACCESS_EXPIRES_IN=1h\nJWT_REFRESH_SECRET=your_jwt_refresh_secret_key\nJWT_REFRESH_EXPIRES_IN=7d\n\n# Admin credentials\nADMIN_EMAIL=admin@example.com\nADMIN_PASSWORD=123456\n\n```\n\n---\n\n## Database Setup\n\n1. Create PostgreSQL database:\n\n```sql\nCREATE DATABASE miniSchoolDB;\n```\n\n2. Run Prisma migrations:\n\n```bash\nnpx prisma migrate dev\n```\n\n---\n\n## Running the Application\n\nStart the development server:\n\n```bash\nyarn dev\n```\n\nAPI will run at: `http://localhost:5000`\n\n---\n\n## Docker Setup (Optional)\n\n1. Build and start containers:\n\n```bash\ndocker-compose up -d\n```\n\n2. API available at: `http://localhost:5000`\n\n---\n\n## API Endpoints\n\n### Authentication Endpoints\n\n| Method | Endpoint                | Role | Description          |\n| ------ | ----------------------- | ---- | -------------------- |\n| POST   | /api/v1/auth/login         | All  | Login user           |\n| POST   | /api/v1/auth/refresh-token | All  | Refresh access token |\n| POST   | /api/v1/auth/logout        | All  | Logout user          |\n\n---\n\n### User Endpoints\n\n| Method | Endpoint     | Role                  | Description                   |\n| ------ | ------------ | --------------------- | ----------------------------- |\n| GET    | /api/v1/user    | Admin                 | Get all users                 |\n| GET    | /api/v1/user/me | Admin/Teacher/Student | Get profile of logged-in user |\n| POST   | /api/v1/user    | Admin                 | Create a new user             |\n\n---\n\n### Student Endpoints\n\n| Method | Endpoint          | Role          | Description         |\n| ------ | ----------------- | ------------- | ------------------- |\n| POST   | /api/v1/student      | Admin         | Create a student    |\n| GET    | /api/v1/student      | Admin/Teacher | Get all students    |\n| GET    | /api/v1/student/\\:id | Admin/Teacher | Get student Details by ID   |\n\n---\n\n### Class Endpoints\n\n| Method | Endpoint                    | Role          | Description                          |\n| ------ | --------------------------- | ------------- | ------------------------------------ |\n| POST   | /api/v1/class               | Admin         | Create a new class                   |\n| GET    | /api/v1/class               | Admin/Teacher | Get all classes                      |\n| POST   | /api/v1/class/\\:id/enroll   | Admin/Teacher | Enroll a student in a class          |\n| GET    | /api/v1/class/\\:id/students | Admin/Teacher | Get all students of a specific class |\n\n---\n\n\n## API Documentation\n\nI have created a **Postman API documentation JSON** for this project so all routes are ready to test with examples and auth tokens.\n\nYou can explore and test all API endpoints using the Postman collection:\n\n[**Open Postman Collection**](https://cgen55.postman.co/workspace/3937c878-9731-4041-a5a4-197178344591/collection/34712513-1e508887-0571-4b95-a82c-e11aa8ba5117?action=share\u0026source=copy-link\u0026creator=34712513)\n\n---\n\n## Project Structure\n\n```\n├── prisma/                  # Prisma schema \u0026 migrations\n├── src/\n│   ├── app/\n│   │   ├── app.ts           # Express app setup\n│   │   ├── config/          # Environment \u0026 config files\n│   │   ├── errors/          # Error handling\n│   │   ├── interface/       # TypeScript interfaces\n│   │   ├── middleware/      # Express middlewares\n│   │   ├── modules/         # Feature modules\n│   │   │   ├── auth/        # Authentication module\n│   │   │   ├── class/       # Class management\n│   │   │   ├── student/     # Student management\n│   │   │   └── user/        # User management\n│   │   ├── routes/          # API routes\n│   │   └── utils/           # Utility functions\n│   └── server.ts            # App entry point\n├── .env                     # Environment variables\n├── Dockerfile               # Docker config\n├── docker-compose.yml       # Docker Compose config\n├── package.json             # Project dependencies\n└── tsconfig.json            # TypeScript config\n```\n\n---\n\n## Authentication \u0026 Authorization\n\n* **JWT Authentication**: Users get access and refresh tokens on login.\n* **Role-Based Authorization**:\n\n  * **Admin**: Full access\n  * **Teacher**: Can manage students and classes\n  * **Student**: Can view only their own profile\n\n---\n\n## Contributing\n\n1. Fork repository\n2. Create branch: `git checkout -b feature/your-feature`\n3. Commit changes: `git commit -m \"Add feature\"`\n4. Push branch: `git push origin feature/your-feature`\n5. Open a Pull Request\n\n---\n\n## License\n\nThis project is licensed under the **MIT License**. See the [LICENSE](LICENSE) file for details.\n\n---\n\n**Developed by [Md. Shakil Hossain](mailto:mrshakilhossain@outlook.com)**\n\n---\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakilofficial%2Fmini-school","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshakilofficial%2Fmini-school","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakilofficial%2Fmini-school/lists"}