{"id":24461664,"url":"https://github.com/ndmen/booklibrary","last_synced_at":"2026-05-10T03:18:46.741Z","repository":{"id":219084545,"uuid":"747362705","full_name":"ndmen/booklibrary","owner":"ndmen","description":"RESTful API for managing a book library with roles and error handling. The API built using Node.js, Express, and Sequelize, providing different access levels for users based on their roles, and including error handling.","archived":false,"fork":false,"pushed_at":"2024-01-25T10:39:25.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T10:21:21.494Z","etag":null,"topics":["express","javascript","nodejs","sequelize","swagger"],"latest_commit_sha":null,"homepage":"https://ibb.co/tZfDtnM","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/ndmen.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}},"created_at":"2024-01-23T19:26:32.000Z","updated_at":"2024-01-25T10:40:04.000Z","dependencies_parsed_at":"2024-01-25T12:07:03.483Z","dependency_job_id":null,"html_url":"https://github.com/ndmen/booklibrary","commit_stats":null,"previous_names":["ndmen/booklibrary"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ndmen/booklibrary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fbooklibrary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fbooklibrary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fbooklibrary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fbooklibrary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndmen","download_url":"https://codeload.github.com/ndmen/booklibrary/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fbooklibrary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266048501,"owners_count":23868738,"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":["express","javascript","nodejs","sequelize","swagger"],"created_at":"2025-01-21T04:29:16.903Z","updated_at":"2026-05-10T03:18:46.701Z","avatar_url":"https://github.com/ndmen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Book Library \n\nThis project involves developing a RESTful API for managing a book library with roles and error handling. The API built using Node.js, Express, and Sequelize, providing different access levels for users based on their roles, and including error handling.\n\n\nData Models:\nBook: Fields include id, title, author, year, and genre.\nUser: Fields include id, username, password, and roleId.\nRole: Fields include id and name (e.g., 'user', 'admin').\n\nAuthentication and Authorization:\nImplementation of authentication using JWT (JSON Web Tokens).\nImplementation of middleware for authorization, determining access based on user roles.\n\nAdmin-specific Rights:\nOnly users with the 'admin' role can edit book information (PATCH, DELETE on /books/:id).\n\nCRUD Operations for Books:\nAll users can view books.\nAdding, editing, and deleting books is restricted to admins.\n\nUser Management:\nCRUD operations for users and roles, accessible only to admins.\n\nError Handling Middleware:\nImplementation of middleware for error handling and logging.\nProperly returning errors to clients (e.g., 404 for nonexistent resources, 403 for forbidden access).\n\nDocumentation:\nPreparation of API documentation using Swagger.\n\n![image](https://i.ibb.co/n32jv4s/Screenshot-from-2024-01-25-12-32-56.png)\n\n## Getting Started\n\nThese instructions will help you set up and run the project on your local machine.\n\n### Prerequisites\n\n- Node.js 16+ installed\n- npm installed\n- PostgreSQL 12+ installed\n\n### Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/ndmen/booklibrary.git\n```\n\n2. Navigate to the project folder:\n```bash\ncd booklibrary\n```\n\n3. Install dependencies:\n```bash\nnpm install\n```\n\n4. Set up your environment variables:\nUpdate necessary environment variables for database connection in the file /confiig/config.json\n\n5. Run migrations\n```bash\nnpm run migrate:run\n```\n\n6. Run seeds (Roles)\n```bash\nnpm run seed:run\n```\n\n7. Run the project:\n```bash\nnpm start\n```\n\nThe server should now be running on http://localhost:3000. Swagger documtation can see http://localhost:3000/swagger.\n\n## Contributing\n\nIf you'd like to contribute, please fork the repository and create a pull request.\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndmen%2Fbooklibrary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndmen%2Fbooklibrary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndmen%2Fbooklibrary/lists"}