{"id":20732189,"url":"https://github.com/f-lsq/library-system-db","last_synced_at":"2026-04-17T12:33:58.788Z","repository":{"id":226932293,"uuid":"769936401","full_name":"f-lsq/library-system-db","owner":"f-lsq","description":"Library Management System using ExpressJS and MongoDB","archived":false,"fork":false,"pushed_at":"2024-03-12T08:48:33.000Z","size":2838,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-07T15:05:39.396Z","etag":null,"topics":["mongodb","nodejs","restfulapi"],"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/f-lsq.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-03-10T13:35:04.000Z","updated_at":"2024-12-19T15:36:03.000Z","dependencies_parsed_at":"2024-03-10T17:31:15.302Z","dependency_job_id":"c0675136-c912-4d8b-81b2-8e1b63d6bc19","html_url":"https://github.com/f-lsq/library-system-db","commit_stats":null,"previous_names":["f-lsq/library-loans-db"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/f-lsq/library-system-db","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-lsq%2Flibrary-system-db","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-lsq%2Flibrary-system-db/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-lsq%2Flibrary-system-db/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-lsq%2Flibrary-system-db/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/f-lsq","download_url":"https://codeload.github.com/f-lsq/library-system-db/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/f-lsq%2Flibrary-system-db/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31929817,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T10:35:34.458Z","status":"ssl_error","status_checked_at":"2026-04-17T10:35:09.472Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["mongodb","nodejs","restfulapi"],"created_at":"2024-11-17T05:18:23.712Z","updated_at":"2026-04-17T12:33:58.773Z","avatar_url":"https://github.com/f-lsq.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Library System Database\n\nThis project was built as a means to learn ExpressJS in conjunction with Mongo Atlas (10 March 2023).\n\n## Overview\nThis simple Javascript server acts as a basic library managemement system, allowing users to manage a collection of books. Users will be able to perform CRUD (Create, Delete, Update, Delete) operations on the books through a set of RESTFUL API endpoints. This application was built using the ExpressJS framework and utilises a Mongo Database for database interactions.\n\nHere is a simple entity relationship diagram of the library system:\n![alt text](assets/library-erd.png)\n\n## Getting Started\nTo run the Library System server,\n\n1. Install the following packages from Node.JS (Express, CORS, DotEnv and MondoDB)\n```\nnpm install express cors dotenv mongodb\n```\n\n2. Install Node Monitor\n```\nnpm install -g nodemon\n```\n\n3. Start the server using Node Monitor\n```\nnodemon\n```\n\nThe server will start and the API endpoints may be reached using tools such as Advanced REST Client (ARC), Postman or Insomnia.\n\n## Configuration and Environment Variables\nBefore running the server, ensure that the following are setup in a `.env` file. Please refer to the `.env.sample` file for the variables required.\n1. **Mongo URI**: This is your connection string from Mongo Atlas. To retrieved your connection string, do the following: Log in to Mongo Atlas \u003e Database \u003e Connect \u003e Drivers (Node.JS) \u003e Copy connection string from section 3.\n2. **MongoDB Name**: This is the name of the mongo database that will store the book information. Create a new database in `Mongo Atlas` or select a new database name by keying it in a `.env` file. An example of a database name is *library-books*.\n3. **Token Secret**: This is the private key used to generate a hash for users' password. You could generate a random key via https://randomkeygen.com/ (use the `504-bit WPA key` for better security).\n\n## API Endpoints\nThe following API endpoints are available to perform the CRUD operations.\n\n### Books\n* `GET /books` : Retrieve information of all books\n* `POST /books` : Create a new book\n* `PUT /books/{bookid}` : Update details of an existing book\n* `DELETE /books/{bookid}` : Delete an existing book\n\n### Users\n* `POST /user` : Create a new user\n* `POST /login` : Generate JSONWebToken via user login (expires in 3 days)\n* `POST /profile` : Access protected route via valid JSONWebToken\n\n## Example Usage\nHere are some examples of how you can interact with the API and how it will be logged in MongoDB.\n\n*Note: The endpoint for books in the screenshots differs from the actual endpoint. Please use the `/books` endpoint!*\n\n### Books \n* Retrieve information of all books\n```\nGET http://localhost:3001/books\n```\nSuccessful retrival of book information in ARC:\n![alt text](assets/read-books.png)\n\nBook information stored in MongoDB:\n![alt text](assets/read-books-db.png)\n\nSearch by author:\n![alt text](assets/search-author.png)\n\nSearch by language:\n![alt text](assets/search-language.png)\n\nSearch by publisher:\n![alt text](assets/search-publisher.png)\n\nSearch by title:\n![alt text](assets/search-title.png)\n\n* Create a new book\n```\nPOST http://localhost:3001/books\n```\nSuccessful creation of new book in ARC:\n![alt text](assets/create-books.png)\n\nNew book information stored in MongoDB:\n![alt text](assets/create-books-db.png)\n\nValidation of ISBN entered:\n![alt text](assets/validation-isbn.png)\n\nValidation of languages and authors entered:\n![alt text](assets/validation-array.png)\n\nValidation of publisher ID entered:\n![alt text](assets/validation-publisherid.png)\n\nValidation of other information entered:\n![alt text](assets/validation-all-info.png)\n\n* Update details of an existing book\n```\nPUT http://localhost:3001/books/{bookid}\n```\nSuccessful update of existing book information in ARC:\n![alt text](assets/update-books.png)\n\nExisting book information (before updating languages) stored in MongoDB:\n![alt text](assets/create-books-db.png)\n\nExisting book information (after updating languages) stored in MongoDB:\n![alt text](assets/update-books-db.png)\n\n*Note: Validation performed when updating a book information is the same as that when a new book is created*\n\n* Delete an existing book\n```\nDELETE http://localhost:3001/books/{bookid}\n```\nSuccessful deletion of existing book information in ARC:\n![alt text](assets/delete-books.png)\n\nExisting book information (before deletion) stored in MongoDB:\n![alt text](assets/delete-books-db-before.png)\n\nExisting book information (after deletion) stored in MongoDB:\n![alt text](assets/delete-books-db-after.png)\n\n### Users\n* Create a new user\n```\nPOST http://localhost:3001/user\n```\nSuccessful creation of new user in ARC:\n![alt text](assets/create-users.png)\n\nNew user information stored in MongoDB:\n![alt text](assets/create-users-db.png)\n\n* Generate JSONWebToken via user login (expires in 3 days)\n```\nPOST http://localhost:3001/login\n```\nSuccessful user login and generation of JSONWebToken in ARC:\n![alt text](assets/login-users.png)\n\n* Access protected route via valid JSONWebToken\n```\nPOST http://localhost:3001/profile\n```\nValid JSONWebToken used to access protected route in ARC:\n![alt text](assets/authorise-users.png)\n\nInvalid JSONWebToken used to access protected route in ARC:\n![alt text](assets/unauthorise-users.png)\n\n## Technological Stacks Used\n* JavaScript\n* NPM Packages (Express, CORS, DotEnv, bcrypt, JSONWebToken)\n* Mongo Atlas Database\n\n## References\nThis readme file was written with reference to the following repository: https://github.com/nadialefebvre/library","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-lsq%2Flibrary-system-db","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ff-lsq%2Flibrary-system-db","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ff-lsq%2Flibrary-system-db/lists"}