{"id":23525779,"url":"https://github.com/albinzayedrawan/lmsproject","last_synced_at":"2026-04-09T12:02:41.471Z","repository":{"id":268938867,"uuid":"905923179","full_name":"albinzayedrawan/lmsproject","owner":"albinzayedrawan","description":"This project is a Library Management System (LMS) built with Node.js, Express, MongoDB, and Mongoose. It includes role-based access control (RBAC) to manage different user roles and their permissions.","archived":false,"fork":false,"pushed_at":"2024-12-20T00:18:05.000Z","size":37,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-17T01:45:45.638Z","etag":null,"topics":["backend-service","expressjs","jwt-authentication","library-management-system","mongodb","nodejs","postman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/albinzayedrawan.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}},"created_at":"2024-12-19T19:51:10.000Z","updated_at":"2025-01-13T13:36:57.000Z","dependencies_parsed_at":"2024-12-19T20:40:07.415Z","dependency_job_id":null,"html_url":"https://github.com/albinzayedrawan/lmsproject","commit_stats":null,"previous_names":["albinzayedrawan/lmsproject"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinzayedrawan%2Flmsproject","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinzayedrawan%2Flmsproject/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinzayedrawan%2Flmsproject/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/albinzayedrawan%2Flmsproject/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/albinzayedrawan","download_url":"https://codeload.github.com/albinzayedrawan/lmsproject/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254101554,"owners_count":22014908,"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","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":["backend-service","expressjs","jwt-authentication","library-management-system","mongodb","nodejs","postman"],"created_at":"2024-12-25T19:12:12.724Z","updated_at":"2025-12-30T20:20:29.659Z","avatar_url":"https://github.com/albinzayedrawan.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library Management System (LMS)\n\nThis project is a Library Management System (LMS) built with Node.js, Express, MongoDB, and Mongoose. It includes role-based access control (RBAC) to manage different user roles and their permissions.\n\n## Features\n\n- **Books Management**: Add, update, delete, and query books.\n- **Members Management**: Add, update, delete, and query members.\n- **Loans Management**: Manage book loans.\n- **Users Management**: Add, update, delete, and query users.\n- **Role-Based Access Control (RBAC)**: Manage different user roles and their permissions.\n\n## User Roles and Permissions\n\n- **Librarian**:\n  - Full access to all collections.\n  - Can add, update, delete, and query all data.\n  - Manages member registrations and book loans.\n- **Assistant**:\n  - Limited access to `library_books` and `book_loans`.\n  - Can query all data but only update certain fields (e.g., updating available copies in `library_books`).\n- **Member**:\n  - Read-only access to `library_books`.\n  - Can add data to `book_reviews`.\n  - Access to their own data in `library_members` and `book_loans`.\n\n## Getting Started\n\n### Prerequisites\n\n- Node.js\n- MongoDB\n\n### Installation\n\n1. Clone the repository:\n\n   ```bash\n   git clone https://github.com/albinzayedrawan/lmsproject.git\n   cd lmsproject\n   ```\n\n2. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n3. Create a .env file in the root directory and add the following environment variables:\n\n   ```properties\n   DB_URI=mongodb+srv://\u003cusername\u003e:\u003cpassword\u003e@\u003ccluster-url\u003e/\u003cdatabase\u003e?retryWrites=true\u0026w=majority\n   JWT_SECRET=your_jwt_secret_key\n   PORT=3000\n   ```\n\n4. Seed the database with sample data:\n\n   ```bash\n   node seed.js\n   ```\n\n### Running the Server\n\nStart the server:\n\n```bash\nnode server.js\n```\n\nThe server will run on `http://localhost:3000`.\n\n## API Endpoints\n\n### Authentication\n\n- **Login**: `POST /api/users/login`\n\n### Books\n\n- **Add Book**: `POST /api/books` (Librarian)\n- **Get All Books**: `GET /api/books` (Librarian, Assistant, Member)\n- **Get Book by ID**: `GET /api/books/:id` (Librarian, Assistant, Member)\n- **Update Book**: `PUT /api/books/:id` (Librarian)\n- **Delete Book**: `DELETE /api/books/:id` (Librarian)\n\n### Members\n\n- **Add Member**: `POST /api/members` (Librarian)\n- **Get All Members**: `GET /api/members` (Librarian, Assistant)\n- **Get Member by ID**: `GET /api/members/:id` (Librarian, Assistant)\n- **Update Member**: `PUT /api/members/:id` (Librarian)\n- **Delete Member**: `DELETE /api/members/:id` (Librarian)\n\n### Loans\n\n- **Add Loan**: `POST /api/loans` (Librarian)\n- **Get All Loans**: `GET /api/loans` (Librarian, Assistant)\n- **Get Loan by ID**: `GET /api/loans/:id` (Librarian, Assistant)\n- **Update Loan**: `PUT /api/loans/:id` (Librarian)\n- **Delete Loan**: `DELETE /api/loans/:id` (Librarian)\n\n### Users\n\n- **Add User**: `POST /api/users` (Librarian)\n- **Get All Users**: `GET /api/users` (Librarian)\n\n## Testing with Postman\n\n1. **Login to Get the Token**:\n   - Create a new request in Postman.\n   - Set the method to POST.\n   - Set the URL to `{{baseUrl}}/api/users/login`.\n   - In the Body tab, select `raw` and `JSON` format.\n   - Add the following JSON:\n  \n     ```json\n     {\n       \"email\": \"john.doe@library.com\",\n       \"password\": \"password123\"\n     }\n     ```\n\n   - Send the request.\n   - Copy the token from the response.\n\n2. **Set Up Environment Variable for Token**:\n   - Go back to the environment settings.\n   - Paste the copied token value into the `token` variable.\n   - Save the environment.\n\n3. **Create Requests for CRUD Operations**:\n   - Use the token in the `Authorization` header for all authenticated requests:\n     - Key: `Authorization`\n     - Value: `Bearer {{token}}`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinzayedrawan%2Flmsproject","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falbinzayedrawan%2Flmsproject","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falbinzayedrawan%2Flmsproject/lists"}