{"id":16534497,"url":"https://github.com/kyhsa93/nestjs-rest-example","last_synced_at":"2025-03-21T09:32:08.277Z","repository":{"id":42324022,"uuid":"200211118","full_name":"kyhsa93/nestjs-rest-example","owner":"kyhsa93","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-23T23:49:07.000Z","size":1461,"stargazers_count":8,"open_issues_count":19,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-01T05:05:36.889Z","etag":null,"topics":["docker","docker-compose","dockerfile","jest","mysql","nestjs","swagger-ui","typeorm","typescript"],"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/kyhsa93.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}},"created_at":"2019-08-02T09:55:07.000Z","updated_at":"2023-06-20T12:36:59.000Z","dependencies_parsed_at":"2023-02-13T05:00:48.203Z","dependency_job_id":null,"html_url":"https://github.com/kyhsa93/nestjs-rest-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhsa93%2Fnestjs-rest-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhsa93%2Fnestjs-rest-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhsa93%2Fnestjs-rest-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kyhsa93%2Fnestjs-rest-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kyhsa93","download_url":"https://codeload.github.com/kyhsa93/nestjs-rest-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244130281,"owners_count":20402753,"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","docker-compose","dockerfile","jest","mysql","nestjs","swagger-ui","typeorm","typescript"],"created_at":"2024-10-11T18:24:22.731Z","updated_at":"2025-03-21T09:32:07.984Z","avatar_url":"https://github.com/kyhsa93.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nest sample code\n\nThis is sample nestjs project.\n- link: https://nestjs.com\n\n## Getting started\n\nThis is REST api made by node.js, nest, mysql with typescript.\n\nSo you have to get node.js environment, mysql for database, know typescript syntax.\n\n### Prerequisites\n\nPlease install node.js and I recommend to use docker for your database.\n\nMy recommand node.js version is dubnium and latest docker version.\n\n* Install node.js: [https://nodejs.org/en/download/](https://nodejs.org/en/download/)\n\n* Install Docker Desktop for MAC: [https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)\n\n* Install Docker Desktop for Windows: [https://docs.docker.com/docker-for-windows/install/](https://docs.docker.com/docker-for-windows/install/)\n\n* Install compose: [https://docs.docker.com/compose/install/](https://docs.docker.com/compose/install/)\n\n## Create development environment\n\nFirst, clone this repository into your local environment. Run followed command in your terminal.\n\n```bash\n  git clone https://github.com/kyhsa93/nestJS-sample.git\n```\n\nSecond step, install package that needed in this project.\n\nIf your node.js environment is successly downloaded, you can use node package manager.\n\nRun followed command in your terminal.\n\n```bash\n  npm install\n```\n\nNext up, generate mysql database.\n\nIf you already have mysql in your development environment, you can use that.\n\nBut if you don't have mysql database, try this process.\n\nInstall docker for your OS from link in top of this documentation.\n\nAnd run followed command.\n\nIf your docker is successfully installed, you can use docker cli.\n\n```bash\n  docker run --name nest -d -p 3306:3306 -e MYSQL_DATABASE=nest -e MYSQL_ROOT_PASSWORD=test -v ~/database/nest:/var/lib/mysql mysql:5.7\n```\n\nAnd then, you can connect mysql in http://localhost:3306, user name 'root' and password is 'test'.\n\nFinaly, your develop environment is created.\n\nYou can start api with followed command.\n\n```bash\n  npm start\n```\n\nAnd if you modify code and save, you can see the process detect code changes and restart it self.\n\n## Start with docker\n\nIf you can use docker cli, you can build docker image.\n\n```bash\n  docker build -t nest-sample\n  docker images # list up docker images\n```\n\nAnd then you can create and run docker container using builded image.\n\n```bash\n  docker run -d -p 5000:5000 nest-sample\n  docker ps # list up running container\n```\n\nand now you can connect api through http://localhost:5000.\n\n## Start with docker compose\n\nDocker compose in this project is include api and mysql 5.7 for database.\n\nRun followed command in project directory.\n\n```bash\n  docker-compose up -d # build images, create and run containers in background\n```\n\nIf container is created, you can access api on http://localhost:5000.\n\nAnd you can access database through http://localhost:3306.\n\nDefault database user is root and password is test.\n\nIf you want apply your modified code into the running container, you can add build option.\n\n```bash\n  docker-compose up -d --build # if source code is changed, rebuidl image, recreate and start container\n```\n\nAfter use compose, you have to stop and remove containers.\n\n```bash\n  docker-compose down # stop and remove container in compose\n```\n\n## Configuration\n\n## Documantaion\n\nDocumentaion about this project is made swagger.\n\nStart this api and connect http://localhost:5000/api in your browser.\n\n## Scripts\n```bash\n  git clone https://github.com/kyhsa93/nestJS-sample.git # clone this project\n\n  # run mysql database container\n  docker run --name nest -d -p 3306:3306 -e MYSQL_DATABASE=nest -e MYSQL_ROOT_PASSWORD=test -v ~/database/nest:/var/lib/mysql mysql:5.7\n\n  docker build -t nest-sample # build docker image named nest-sample\n\n  docker images # list up docker images\n\n  docker run -d -p 5000:5000 nest-sample # run docker container using image nameed nest-sample (host port 5000 is mapped container port 5000 and container run background process)\n\n  docker ps # list up running container\n\n  docker-compose up -d # build images, create and start containers in background\n\n  docker-compose up -d --build # if container image's change exists, rebuild image, recreate and restart container\n\n  docker-compose down # stop and remove container in compose\n\n  npm install   # install packges\n  npm test      # run test\n  npm run build # transpile typescript\n  npm start     # run sample code\n\n  docker-compose up # use compose\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyhsa93%2Fnestjs-rest-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkyhsa93%2Fnestjs-rest-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkyhsa93%2Fnestjs-rest-example/lists"}