{"id":21595020,"url":"https://github.com/thirdmadman/nodejs2023q2-service","last_synced_at":"2025-03-18T10:43:52.069Z","repository":{"id":184422041,"uuid":"670685972","full_name":"thirdmadman/nodejs2023Q2-service","owner":"thirdmadman","description":null,"archived":false,"fork":false,"pushed_at":"2024-11-22T17:49:43.000Z","size":617,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-24T17:17:15.901Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/thirdmadman.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":"2023-07-25T15:46:14.000Z","updated_at":"2023-07-25T19:29:19.000Z","dependencies_parsed_at":"2024-11-22T18:31:57.335Z","dependency_job_id":"40e050e6-e953-471d-87bf-84eeb8832641","html_url":"https://github.com/thirdmadman/nodejs2023Q2-service","commit_stats":null,"previous_names":["thirdmadman/nodejs2023q2-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/thirdmadman%2Fnodejs2023Q2-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs2023Q2-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs2023Q2-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thirdmadman%2Fnodejs2023Q2-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thirdmadman","download_url":"https://codeload.github.com/thirdmadman/nodejs2023Q2-service/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244207477,"owners_count":20416097,"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":[],"created_at":"2024-11-24T17:24:36.577Z","updated_at":"2025-03-18T10:43:52.042Z","avatar_url":"https://github.com/thirdmadman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Home Library Service\n\n## Prerequisites\n\n- Git - [Download \u0026 Install Git](https://git-scm.com/downloads).\n- Node.js v 18 or higher - [Download \u0026 Install Node.js](https://nodejs.org/en/download/) and the npm package manager.\n- Docker **\n- PostgreSQL Server **\n\n** Conditional, depending on your desired method of run app.\n\n## Documentation\n\nYou can find the documentation in the /docs directory.\nAlso after installing and starting the app, Swagger will active on the /api route.\n\nAfter starting the app on port (4000 as default) you can open\nin your browser OpenAPI documentation by typing \u003chttp://localhost:4000/api/\u003e.\nFor more information about OpenAPI/Swagger please visit \u003chttps://swagger.io/\u003e.\n\n## Downloading\n\n``` cli\ngit clone {repository URL}\n```\n\n## Installing NPM modules\n\n``` cli\nnpm install\n```\n\n## Configuring .env\n\nRename existing ```.env.example``` to ```.env```\n\nCorrect configuration to your preferences. If on ```.env``` file is provided, then default configuration will be used.\n\n## Running application\n\n## Local run\n\nBefore starting the app you need to run postgresql on your machine, it could be a stand-alone version or docker container, or even a remote server.\n\nPut you connection data in .env file.\n\nBefore starting app you will need start\n\n``` cli\nnpx prisma generate\nnpx prisma migrate deploy\n```\n\nTo generate prisma client and push migration to DB.\n\nYou can start the application in dev or prod mode by running\n\n``` cli\nnpm run start:dev\n```\n\nor\n\n``` cli\nnpm run start:prod\n```\n\n## Docker run\n\nYou can run the application in docker containers for development mode and also in production.\n\n### Docker run in development mode\n\nIn between switching production and development mode, it should be used clean up command (this will ensure that that all corresponding containers/volumes are down):\n\n``` cli\ndocker compose -f docker-compose.dev.yaml down --rmi local --volumes\n```\n\nTo run app by docker in dev mode run this command.\n\n``` cli\ndocker compose -f docker-compose.dev.yaml up --detach --build --force-recreate\n```\n\nThis command will start build and then run containers.\n\nPostgres container will start with connection data which is stored in .env file and exposed ports.\n\nApp container after start will copy all files (excluding some from .dockerignore) to container then install all packages from ```package-lock.json``` and then generate prisma client and stop in \"install\" stage.\n\nAfter build docker compose will send commends to container:\n\n```npx prisma migrate deploy``` - this will start the prisma migration on fresh DB.\n\n```npm run start:dev``` - this will start the nestjs app in watch mode.\n\nAfter container started you are free to edit you app files in src directory in you local machine, docker container will receive all changes and rebuild app.\n\nThis command will stop containers:\n\n``` cli\ndocker compose -f docker-compose.dev.yaml stop\n```\n\n### Docker run in production mode\n\nIn between switching production and development mode, it should be used clean up command (this will ensure that that all corresponding containers/volumes are down):\n\n``` cli\ndocker compose -f docker-compose.yaml down --rmi local --volumes\n```\n\nTo run app by docker in production mode run this command.\n\n``` cli\ndocker compose -f docker-compose.yaml up --detach --build --force-recreate\n```\n\nThis command will start build and then run containers.\n\nPostgres container will start with connection data which is stored in .env file.\n\nApp container after start will copy all files (excluding some from .dockerignore) to container then install all packages from ```package-lock.json``` and then generate prisma client and stop in \"install\" stage.\n\nThen in stage build app will be builded.\n\nThen in \"production\" stage, result of build will be copied and set ownership to \"node\" user. NODE_ENV will be set to production and ```npm prune --production``` will be started to remove all dev dependencies. This step will decrease size of container.\n\nAfter build docker compose will send commends to container:\n\n```npx prisma migrate deploy``` - this will start the prisma migration on fresh DB.\n\n```npm run start:prod``` - this will start the nestjs app in prod mode.\n\nAfter container started only app container will be exposed to the world on port used in .env file.\n\n``` cli\ndocker compose -f docker-compose.yaml stop\n```\n\n## Vulnerabilities scanning\n\nYou can scan images and npm packages for vulnerabilities with command ```npm run scan:dev``` or ```npm run scan:prod```\n\nDepending on current docker composer run you need to run corresponding command.\n\n```npm run scan:dev``` - for ```docker-compose.dev.yaml```\n\n```npm run scan:prod``` - for ```docker-compose.yaml```\n\n## Testing\n\nAfter application running open new terminal and enter:\n\nTo run all tests without authorization\n\n``` cli\nnpm run test\n```\n\nTo run only one of all test suites\n\n``` cli\nnpm run test -- \u003cpath to suite\u003e\n```\n\nTo run all test with authorization\n\n``` cli\nnpm run test:auth\n```\n\nTo run only specific test suite with authorization\n\n``` cli\nnpm run test:auth -- \u003cpath to suite\u003e\n```\n\n### Auto-fix and format\n\n``` cli\nnpm run lint\n```\n\n``` cli\nnpm run format\n```\n\n### Debugging in VSCode\n\nPress \u003ckbd\u003eF5\u003c/kbd\u003e to debug.\n\nFor more information, visit: \u003chttps://code.visualstudio.com/docs/editor/debugging\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdmadman%2Fnodejs2023q2-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthirdmadman%2Fnodejs2023q2-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthirdmadman%2Fnodejs2023q2-service/lists"}