{"id":25601088,"url":"https://github.com/arifshariati/nestjs-graphql","last_synced_at":"2026-04-13T14:33:35.753Z","repository":{"id":125597371,"uuid":"431967844","full_name":"arifshariati/nestjs-graphql","owner":"arifshariati","description":"NestJs-graphql project with User signup, login, authentication, protected routes. Project stack is nestjs, graphql, postgres, docker.","archived":false,"fork":false,"pushed_at":"2021-11-28T20:50:01.000Z","size":414,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-27T06:28:20.736Z","etag":null,"topics":["authentication","docker","docker-compose","graphql","nestjs","postgresql"],"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/arifshariati.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":"2021-11-25T20:21:49.000Z","updated_at":"2021-12-29T08:46:22.000Z","dependencies_parsed_at":"2023-08-12T03:49:23.321Z","dependency_job_id":null,"html_url":"https://github.com/arifshariati/nestjs-graphql","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/arifshariati/nestjs-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifshariati%2Fnestjs-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifshariati%2Fnestjs-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifshariati%2Fnestjs-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifshariati%2Fnestjs-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arifshariati","download_url":"https://codeload.github.com/arifshariati/nestjs-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arifshariati%2Fnestjs-graphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31757481,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T13:27:56.013Z","status":"ssl_error","status_checked_at":"2026-04-13T13:21:23.512Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["authentication","docker","docker-compose","graphql","nestjs","postgresql"],"created_at":"2025-02-21T15:40:17.332Z","updated_at":"2026-04-13T14:33:35.727Z","avatar_url":"https://github.com/arifshariati.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Description\n\nThis is backend project which allow users to regiser, login, list properties and mark property as favorite.\n\nProject stack is;\n\n1. Nestjs\n2. Graphql\n3. Postgresql \n4. Docker\n\n## Installation\n\nFor this project i have maintained two different setup, for local development and production. However, for any of the flow you wish to run proejct, Docker is required to get postgres up and running. \n\nif you already do not have docker setup on your machine, below link for docker official website can you set up docker on your machine depening on your OS (macOS, Windows or linux).\n\n```\nhttps://www.docker.com\n```\n\n### Installation for Production\n\nProvided that you have Docker setup on your machine, making project up and running is quite straight forward. In root directory of project, run below command on yoru terminal.\n\n```\ndocker-compose up -d\n```\n\nWhat above command does is running docker-compose with default docker-compose.yml file and configures, deploys and installs project with its dependencies in their respective conainers. Above command creates docker containers with below configuration;\n\n1. Postgres container and creates database folder **\"pgData\"** (*can be used for database backup*) with external port **5432** mapped to container port **5432**.\n2. Project container with \"Backend\" name running on external port **4000** mapped to container port **4000**.\n\n### Installation for Development \n\nUnlike installation for production, installation for development does not include shipping project into container, rather installs container for Postgres only. Run below command on your terminal, in project root folder.\n\n```\ndocker-compose -f docker-compose.pg.yml up -d\n```\n\nPostgres container configuration is the same as in production installation. \n\n## Running the app\n\nSimilar to Installation, running the project production and development has different methods. \n\n### Running the app in Production\n\nSince, Installation in production already spins both containers for postgres and project, you can directly access project in your browser on below url.\n\n```\nhttp://localhost:4000\n```\n\n### Running the app in Development\n\nSince, Installation in development only spins postgres container, to run project, you need to install node packages and run project by following below commands in project folder.\n\n```bash\n# install node dependencies via npm or yarn (depends on your choice)\n\n# npm \nnpm i\n\n# yarn \nyarn \n```\n\nOnce required packages are installed, run below command to run the proejct.\n\n```bash\n\n# Set Environment variable\n\n# macOS, linux \nexport SOURCE=LOCAL\n\n# Windows \nset SOURCE=LOCAL \n\n# npm \nnpm run start:dev #with hot reload\nnpm run start\n\n# yarn \nyarn start\n```\n\nOnce project runs, go to below url.\n\n```\nhttp://localhost:4000\n```\n\n**NOTE:** project url is same regardless of your installation method.\n## Test\n\n```bash\n# unit tests\n$ npm run test\n\n# e2e tests\n$ npm run test:e2e\n\n# test coverage\n$ npm run test:cov\n```\n### Sample Test Output\nFor this project i have written test cases and below is test result.\n\n```\nPASS  src/user/test/user.service.spec.ts (5.961 s)\nPASS  src/user/test/user.resolver.spec.ts (6.219 s)\n\nTest Suites: 2 passed, 2 total\nTests:       20 passed, 20 total\nSnapshots:   0 total\nTime:        6.834 s, estimated 7 s\nRan all test suites.\n\n```\n\nBelow helps on understading details of assertions made for a test.\n\n```\nPASS  src/user/test/user.service.spec.ts\n  UserService\n    ✓ should be defined (13 ms)\n    signup\n      When signup is called\n        ✓ then it should have called this.getUserByEmail(signupInput.email) (3 ms)\n        ✓ then it should have called userRespository.create() (2 ms)\n        ✓ then should save user to database and return user (2 ms)\n    login\n      Wehen login is called\n        ✓ then it should have called useService.login() (3 ms)\n        ✓ then should return jwt token (2 ms)\n    users\n      When users is called\n        ✓ then it should have called userService.findAll() (3 ms)\n        ✓ then should return list of users (2 ms)\n    user\n      when user is called\n        ✓ then it should call userService.findOne() (2 ms)\n        ✓ then should return list of users (2 ms)\n\nTest Suites: 1 passed, 1 total\nTests:       10 passed, 10 total\nSnapshots:   0 total\nTime:        5.039 s, estimated 7 s\nRan all test suites matching /user.service/i.\n\n```\n\n## Useful commands\n\nBelow commands will come in handy while running this project.\n\n### Docker \n\n```bash\n\n# list containers \ndocker ps -a # list all containers\n\n# list images  \ndocker images \n\n# Bring down containers  \ndocker-compose down\n\n# Stop specific container\ndocker stop [container_id]\n\n# Remove specific container  \ndocker rm container [container_id]\n\n# Remove specif imagee \ndocker rm image [image_id]\n\n# Remove all images and containers from your machine  \ndocker system prune -a\n```\n\n### Environment \n\n```bash\n# list all environments \nenv or printenv   \n\n# get specific env variable \nenv | grep SOURCE OR printenv | grep SOURCE \n\n```\n\n## Best of Luck \u0026nbsp; \u0026nbsp; 🚀","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farifshariati%2Fnestjs-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farifshariati%2Fnestjs-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farifshariati%2Fnestjs-graphql/lists"}