{"id":19959944,"url":"https://github.com/quiddlee/nodejs-home-library-service","last_synced_at":"2026-04-10T13:31:30.902Z","repository":{"id":226100064,"uuid":"767450892","full_name":"Quiddlee/nodejs-home-library-service","owner":"Quiddlee","description":"🏡 Node.js Home Library Service","archived":false,"fork":false,"pushed_at":"2024-04-01T16:04:27.000Z","size":622,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"sprint-3/logging-error-authentication-authorization","last_synced_at":"2025-01-12T07:36:18.224Z","etag":null,"topics":["docker","jwt","nestjs","nodejs","openapi","postgresql","prisma","rest-api","rs-school","supertest","swagger","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/Quiddlee.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-05T10:12:58.000Z","updated_at":"2024-05-27T16:19:29.000Z","dependencies_parsed_at":"2024-03-30T12:21:34.324Z","dependency_job_id":"2e797406-8b82-4062-9919-285cc75f023d","html_url":"https://github.com/Quiddlee/nodejs-home-library-service","commit_stats":null,"previous_names":["quiddlee/nodejs2024q1-service","quiddlee/nodejs-home-library-service"],"tags_count":0,"template":false,"template_full_name":"rolling-scopes-school/nodejs-course-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quiddlee%2Fnodejs-home-library-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quiddlee%2Fnodejs-home-library-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quiddlee%2Fnodejs-home-library-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Quiddlee%2Fnodejs-home-library-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Quiddlee","download_url":"https://codeload.github.com/Quiddlee/nodejs-home-library-service/tar.gz/refs/heads/sprint-3/logging-error-authentication-authorization","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241390459,"owners_count":19955341,"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":["docker","jwt","nestjs","nodejs","openapi","postgresql","prisma","rest-api","rs-school","supertest","swagger","typescript"],"created_at":"2024-11-13T01:52:15.708Z","updated_at":"2025-12-30T21:05:22.591Z","avatar_url":"https://github.com/Quiddlee.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🏡📚 Home Library Service\n\n*🦥 RS-School task.*\n\n# 🚀 Getting Started\nTo run the project locally, you would have to download zip file with the repository or clone it to your computer. ✨\n\n## ⚠️ Setup and Running\n\n🤔 What things do you need to do in order to run our project locally?\n\n* ⚡ Use node 20 LTS\n* ✌️ Installed [.git](https://git-scm.com/) on your computer.\n* 📝 Code Editor of your choice.\n* 🐳 Docker.\n\n## 🔮 Installation And Preparation\n\nFirst make sure you have all the things listed in the previous section. Then clone our repository to your computer: 👌\n\n```\ngit clone https://github.com/Quiddlee/nodejs2024Q1-service.git\n```\n\nor download zip file manually with the repository.\n\n📦 Navigate into project folder and run:\n\n```\nnpm install\n```\n\nCreate ```.env``` file in the root of the project and add all the necessary variables 🔥.\n\nYou can find ```.env.example``` as an example file in the project root or follow the lines below 🐺:\n\n```dotenv\nPORT=4000\n\nCRYPT_SALT=10\nJWT_SECRET_KEY=secret123123\nJWT_SECRET_REFRESH_KEY=secret123123\nTOKEN_EXPIRE_TIME=1h\nTOKEN_REFRESH_EXPIRE_TIME=24h\n\nPOSTGRES_USER=myuser\nPOSTGRES_PASSWORD=mypassword\nPOSTGRES_DB=home-library\nPOSTGRES_PORT=5432\nDATABASE_URL=\"postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public\"\n```\n\n🤩 Finally run a development server:\n```\ndocker compose up\n```\nAaaaand you're done! 🎉🥳\n\n\nAfter starting the app on port from ```.env``` you can open\nin your browser ```OpenAPI``` documentation by typing http://localhost:4000/doc.\nFor more information about OpenAPI/Swagger please visit https://swagger.io. 🙂\n\n## 🥑 Available Scripts\n\n🦚 Here you can find all the scripts that are available in the project.\n\n✅ Start the app in `base` mode:\n\n```\nnpm run start\n```\n\nStart the app in `dev` mode:\n\n```\nnpm run start:dev\n```\n\nStart the app in `prod` mode:\n\n```\nnpm run start:prod\n```\n\nStart the app in `debug` mode:\n\n```\nnpm run start:debug\n```\n\nLint adn fix the app errors with `eslint`:\n\n```\nnpm run lint\n```\n\nFormat the App with `Prettier`:\n\n```\nnpm run format\n```\n\nType check the App with `TypeScript`:\n\n```\nnpm run type-check\n```\n\n## 🧪 Testing\n\nAfter application running open new terminal and enter:\n\nTo run all tests without authorization\n\n```\nnpm run test\n```\n\nTo run only one of all test suites\n\n```\nnpm run test -- \u003cpath to suite\u003e\n```\n\nTo run all test with authorization\n\n```\nnpm run test:auth\n```\n\nTo run only specific test suite with authorization\n\n```\nnpm run test:auth -- \u003cpath to suite\u003e\n```\n\n## 🐳 Docker\nRun application\n```\ndocker compose up\n```\nRun application in watch mode\n```\ndocker compose watch\n```\nScan docker images for vulnerabilities\n```\nnpm run docker:scan\n```\n\n# ⚙️ Technology Stack\n\n## 🦈 Developing\n* 🦅 **Nest.js** - The Backend Framework\n* 💖 **TypeScript** - The Language\n* 🦄 **Prisma** - The ORM\n* 🔒 **bcrypt** - The Password Hasher\n* 🎫 **jsonwebtoken** - The JWT Token Generator\n* 📖 **Nest.js/Swagger** - The OpenAPI Documentation\n* 🐳 **Docker** - The Containerization tool\n\n## 🧹 Code Quality\n* 🧪 **Jest** - The Test Runner\n* 🫂 **Supertest** - The Testing Framework\n* 🔔 **ESLint** — Air-bnb base - The Linter\n* 👏 **Prettier** - The Code Formatter\n* 😎 **EditorConfig** - The Code Style Enforcer\n\n## 📚 External Libraries\n* ✌️ **dotenv** - The Environment Variables Library\n* 🌐 **cross-env** - The Environment Variables Loader\n\n\n# 📍 Working with the API\n🙏 Following the link below, you can find ```Postman``` collection that will make your life easier while working with the API!  [postman collection](https://www.postman.com/bold-spaceship-739379/workspace/node-js-service/overview)\n\n![img.png](public/img.png)\n\n## 🌊 API endpoints\nThe API has the following endpoints:\n\n### 🙍‍♂️ /user\n\n| Method |  Endpoint  |                         Description |\n|--------|:----------:|------------------------------------:|\n| GET\t   |   /user    | Get all the users from the database |\n| GET    | \t/user/:id |            \tGet a single user by ID |\n| POST   |   \t/user   |  \tCreate a new user in the database |\n| PUT    | \t/user/:id |                \tUpdate a user by ID |\n| DELETE | \t/user/:id |                \tDelete a user by ID |\n\n\n### 📀️ /track\n\n| Method |  Endpoint   |                          Description |\n|--------|:-----------:|-------------------------------------:|\n| GET\t   |   /track    | Get all the tracks from the database |\n| GET    | \t/track/:id |            \tGet a single track by ID |\n| POST   |   \t/track   |  \tCreate a new track in the database |\n| PUT    | \t/track/:id |                \tUpdate a track by ID |\n| DELETE | \t/track/:id |                \tDelete a track by ID |\n\n### 💽 /album\n\n| Method |  Endpoint   |                          Description |\n|--------|:-----------:|-------------------------------------:|\n| GET\t   |   /album    | Get all the albums from the database |\n| GET    | \t/album/:id |            \tGet a single album by ID |\n| POST   |   \t/album   |  \tCreate a new album in the database |\n| PUT    | \t/album/:id |                \tUpdate a album by ID |\n| DELETE | \t/album/:id |                \tDelete a album by ID |\n\n### 👩‍🎤 /artist\n\n| Method |   Endpoint   |                           Description |\n|--------|:------------:|--------------------------------------:|\n| GET\t   |   /artist    | Get all the artists from the database |\n| GET    | \t/artist/:id |            \tGet a single artist by ID |\n| POST   |   \t/artist   |  \tCreate a new artist in the database |\n| PUT    | \t/artist/:id |                \tUpdate a artist by ID |\n| DELETE | \t/artist/:id |                \tDelete a artist by ID |\n\n### 📔 /favs\n\n| Method |     Endpoint      |                                  Description |\n|--------|:-----------------:|---------------------------------------------:|\n| GET\t   |       /favs       |      Get all the favorites from the database |\n| GET    | \t/favs/track/:id  |     \tGet a single track from favorites by ID |\n| GET    | \t/favs/album/:id  |     \tGet a single album from favorites by ID |\n| GET    | \t/favs/artist/:id |    \tGet a single artist from favorites by ID |\n| POST   | \t/favs/track/:id  |  \tAdd new track to favorites in the database |\n| POST   | \t/favs/album/:id  |  \tAdd new album to favorites in the database |\n| POST   | \t/favs/artist/:id | \tAdd new artist to favorites in the database |\n| DELETE | \t/favs/track/:id  |         \tDelete a track by ID from favorites |\n| DELETE | \t/favs/album/:id  |         \tDelete a album by ID from favorites |\n| DELETE | \t/favs/artist/:id |        \tDelete a artist by ID from favorites |\n\n\n## 🍃 Response examples\n\n**GET /users**\n\n```json\n[\n  {\n    \"id\": \"62a13ccf-6de5-46ae-81dd-81a81301071d\",\n    \"login\": \"loeegin\",\n    \"version\": 1,\n    \"createdAt\": 1710072081506,\n    \"updatedAt\": 1710072081506\n  },\n  {\n    \"id\": \"2d2f65be-73af-40d2-842e-4514fc86c664\",\n    \"login\": \"loeegin\",\n    \"version\": 2,\n    \"createdAt\": 1710072083360,\n    \"updatedAt\": 1710072913111\n  },\n  {\n    \"id\": \"9fcd76d7-4d5b-45a0-9937-0b7cc9007e52\",\n    \"login\": \"loeegin\",\n    \"version\": 1,\n    \"createdAt\": 1710072084156,\n    \"updatedAt\": 1710072084156\n  },\n  {\n    \"id\": \"0d411947-0d1d-495d-aa64-04fe4a9e0549\",\n    \"login\": \"loeegin\",\n    \"version\": 1,\n    \"createdAt\": 1710072084910,\n    \"updatedAt\": 1710072084910\n  }\n]\n```\n\n**GET /users/:id Error case**\n\n```json\n{\n  \"message\": \"User not found!\",\n  \"error\": \"Not Found\",\n  \"statusCode\": 404\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiddlee%2Fnodejs-home-library-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquiddlee%2Fnodejs-home-library-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquiddlee%2Fnodejs-home-library-service/lists"}