{"id":16036753,"url":"https://github.com/leosuncin/nest-auth-example","last_synced_at":"2025-05-15T21:06:33.541Z","repository":{"id":37018528,"uuid":"185277772","full_name":"leosuncin/nest-auth-example","owner":"leosuncin","description":"Nest.js authentication with Passport. Realworld example","archived":false,"fork":false,"pushed_at":"2025-04-29T15:15:28.000Z","size":8310,"stargazers_count":440,"open_issues_count":11,"forks_count":61,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-29T16:27:15.997Z","etag":null,"topics":["backend","nestjs","passport","postgresql","rest-api","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leosuncin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-05-06T22:00:21.000Z","updated_at":"2025-04-29T15:13:57.000Z","dependencies_parsed_at":"2023-09-24T07:51:25.201Z","dependency_job_id":"3d63fee3-98da-4e1e-914e-32d88488dc4c","html_url":"https://github.com/leosuncin/nest-auth-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosuncin%2Fnest-auth-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosuncin%2Fnest-auth-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosuncin%2Fnest-auth-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leosuncin%2Fnest-auth-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leosuncin","download_url":"https://codeload.github.com/leosuncin/nest-auth-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422761,"owners_count":22068678,"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":["backend","nestjs","passport","postgresql","rest-api","typescript"],"created_at":"2024-10-08T22:08:33.163Z","updated_at":"2025-05-15T21:06:33.511Z","avatar_url":"https://github.com/leosuncin.png","language":"TypeScript","readme":"# 🛂 Nest.js Authentication Example\n\n[![MegaLinter](https://github.com/leosuncin/nest-auth-example/workflows/MegaLinter/badge.svg?branch=master)](https://github.com/leosuncin/nest-auth-example/actions/workflows/mega-linter.yml)\n[![Unit test](https://github.com/leosuncin/nest-auth-example/actions/workflows/unit-test.yml/badge.svg?branch=master)](https://github.com/leosuncin/nest-auth-example/actions/workflows/unit-test.yml)\n[![E2E test](https://github.com/leosuncin/nest-auth-example/actions/workflows/e2e-test.yml/badge.svg?branch=master)](https://github.com/leosuncin/nest-auth-example/actions/workflows/e2e-test.yml)\n![Prettier](https://img.shields.io/badge/Code%20style-prettier-informational?logo=prettier\u0026logoColor=white)\n[![GPL v3 License](https://img.shields.io/badge/License-GPLv3-green.svg)](./LICENSE)\n[![HitCount](https://hits.dwyl.com/leosuncin/nest-auth-example.svg)](https://hits.dwyl.com/leosuncin/nest-auth-example)\n\n\u003e Nest.js authentication with Passport. RealWorld example\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo_text.svg\" width=\"320\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## Features\n\n- Authentication using [Passport](https://www.passportjs.org/)\n- [Local](https://www.passportjs.org/packages/passport-local/) and [JWT](https://www.passportjs.org/packages/passport-local/) strategies are implemented\n- [TypeORM](https://typeorm.io/) to connect with PostgreSQL\n- Unit tests, integration tests and E2E tests\n- [ts-auto-mock](https://typescript-tdd.github.io/ts-auto-mock/) with [ttypescript](https://github.com/cevek/ttypescript) to generate mocks with jest\n- Check code quality with [MegaLinter](https://oxsecurity.github.io/megalinter/latest/)\n- Check continuous integration with [github actions](.github/workflows/unit-test.yml)\n- Run the necessary services with [docker compose](https://docs.docker.com/compose/)\n\n## Run Locally\n\nClone the project\n\n```bash\n  git clone https://github.com/leosuncin/nest-auth-example.git\n```\n\nGo to the project directory\n\n```bash\n  cd nest-auth-example\n```\n\nInstall dependencies\n\n```bash\n  npm install\n```\n\nCreate a `.env` from the example one and customize it with your [environment variables](#environment-variables)\n\n```bash\n  cp .env.example .env\n```\n\nStart the services using Docker Compose\n\n```bash\n  docker-compose up -d\n```\n\nRun migrations to create the DB schema\n\n```bash\n  npm run typeorm migration:run\n```\n\nStart the server\n\n```bash\n  npm run start:dev\n```\n\n## Environment Variables\n\nTo run this project, you will need to add the following environment variables to your .env file\n\n`POSTGRES_DB` the name of the database to connect in the PostgreSQL instance **(required)**\n\n`POSTGRES_USER` The name of the user to connect to the PostgreSQL instance **(required)**\n\n`POSTGRES_PASSWORD` The password of the user to connect to the PostgreSQL instance **(required)**\n\n`DATABASE_URL` a connection string to the PostgreSQL instance, example _postgres://postgres|@localhost/example-db_ **(required)**\n\n`PORT` the port that Nest.js will listen at **(required)**\n\n`APP_SECRET` the secret used to encrypt the session **(required)**\n\n`ALLOWED_ORIGINS` a comma separated list of [origins](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) from which accept request **(required)**\n\nYou can copy the example `.env` and edit the values\n\n```bash\n  cp .env.example .env\n```\n\n## Running Tests\n\nTo run unit tests, run the following command:\n\n```bash\n  npm test\n```\n\nTo run e2e tests (the PostgreSQL instance must be available), run the following command:\n\n```bash\n  npm run test:e2e\n```\n\nTo see the code coverage\n\n```bash\n  npm run test:cov\n```\n\n## Try it online\n\n[![Gitpod Try-it](https://img.shields.io/badge/Gitpod-Try--it-blue?logo=gitpod)](https://gitpod.io/#https://github.com/leosuncin/nest-auth-example)\n\n## Tech Stack\n\n**Server:** Typescript, PostgreSQL, Nest.js, TypeORM, Passport\n\n**Test:** Jest, SuperTest, TS auto mock\n\n**DevOps:** Docker Compose\n\n## Author\n\n👤 **Jaime Leonardo Suncin Cruz**\n\n- Twitter: [@jl_suncin](https://twitter.com/jl_suncin)\n- Github: [@leosuncin](https://github.com/leosuncin)\n\u003c!-- markdown-link-check-disable --\u003e\n- LinkedIn: [@jaimesuncin](https://linkedin.com/in/jaimesuncin)\n\u003c!-- markdown-link-check-enable --\u003e\n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n### :star2: Stargazers\n\n[![Stargazers repo roster for @leosuncin/nest-auth-example](https://reporoster.com/stars/leosuncin/nest-auth-example)](https://github.com/leosuncin/nest-auth-example/stargazers)\n\n### :fork_and_knife: Forkers\n\n[![Forkers repo roster for @leosuncin/nest-auth-example](https://reporoster.com/forks/leosuncin/nest-auth-example)](https://github.com/leosuncin/nest-auth-example/network/members)\n\n## Related\n\nHere are some more example projects with Nest.js\n\n[![GraphQL example](https://github-readme-stats.vercel.app/api/pin/?username=leosuncin\u0026repo=nest-graphql-example)](https://github.com/leosuncin/nest-graphql-example)\n\n[![API example](https://github-readme-stats.vercel.app/api/pin/?username=leosuncin\u0026repo=nest-api-example)](https://github.com/leosuncin/nest-api-example)\n\n[![TypeORM custom repository](https://github-readme-stats.vercel.app/api/pin/?username=leosuncin\u0026repo=nest-typeorm-custom-repository)](https://github.com/leosuncin/nest-typeorm-custom-repository)\n\n## License\n\nRelease under the terms of [MIT](./LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleosuncin%2Fnest-auth-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleosuncin%2Fnest-auth-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleosuncin%2Fnest-auth-example/lists"}