{"id":24461658,"url":"https://github.com/ndmen/auth-microservice","last_synced_at":"2026-04-18T04:02:29.243Z","repository":{"id":213985414,"uuid":"728681020","full_name":"ndmen/auth-microservice","owner":"ndmen","description":"Auth microservice for microservices architecture.","archived":false,"fork":false,"pushed_at":"2023-12-25T09:45:33.000Z","size":156,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-14T10:21:16.519Z","etag":null,"topics":["authentication","authorization","docker","nestjs","performance","redis","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/ndmen.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-12-07T13:14:55.000Z","updated_at":"2023-12-25T09:48:04.000Z","dependencies_parsed_at":"2023-12-24T22:21:39.508Z","dependency_job_id":"46f76ae9-fb7b-4931-9134-2bbc53ae3e6e","html_url":"https://github.com/ndmen/auth-microservice","commit_stats":null,"previous_names":["ndmen/auth-microservice"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ndmen/auth-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fauth-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fauth-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fauth-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fauth-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ndmen","download_url":"https://codeload.github.com/ndmen/auth-microservice/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ndmen%2Fauth-microservice/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31955919,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","authorization","docker","nestjs","performance","redis","typescript"],"created_at":"2025-01-21T04:29:16.552Z","updated_at":"2026-04-18T04:02:29.224Z","avatar_url":"https://github.com/ndmen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auth Microservice\n\n## Description\n\nAuth microservice for microservices architecture.\n\n### Created authorization flow ###\nAdded code: https://github.com/ndmen/auth-microservice/tree/main \n\n### Added two routes: ###\n* POST /auth/signup - Register user\n* POST /auth/signin -  Login user \n\n### Added 4 e2e tests for two routes: ###\n\n### Added logic saving access_token in redis (used ioredis library) with TTL 24 hours (FOR PERFORMANCE) ###\nIf token exist in redis - return from redis\nIf token not exist - sign new token\n\n### About scale ###\n### What if this service needed to scale to 10,000 user registration requests per second? ###\nMy response:\n* We can use database sharding\n* We can use caching\n* We can use asynchronous functions (big tasks as email for example delegate to background jobs or queues)\n* We can distribute incoming requests across multiple instances\n\n### How about 100,000 user login requests per second? ###\nMy response:\n* We can use redis for returning access token (caching)\n* We can use throttling (ThrottlerModule in nest js)\n* We can optimize database queries\n\n### How to run application ###\n1. Clone code: https://github.com/ndmen/auth-microservice/tree/main \n\n2. Install packages: yarn install\n\n3. Create file .env.development and copy environments from file .env.example\n\n4. Run in docker container auth, redis and postgres using command: yarn docker:up \n(If will RECONNECT to redis inside docker container (See auth-microservice logs) - run only auth-microservice just through terminal on local machine)\n\n5. Run migrations in database postgres: yarn migration:run\n\n6. Open Swagger: http://localhost:3000/swagger#/auth/authSignUp\n\n7. Run e2e test: yarn test:e2e\n\n## Configuration\n\n### Environment Variables priority:\n\n```text\n.env.development.local\n.env.development\n.env\n```\n\n## Installation\n\n```bash\n$ yarn install\n```\n\n## Running the app\n\n```bash\n# development\n$ yarn start\n\n# watch mode\n$ yarn start:dev\n\n# development in docker\n$ yarn docker:up\n$ yarn docker:logs\n\n# production mode\n$ yarn start:prod\n```\n\n## Test\n\n```bash\n# unit tests\n$ yarn test\n\n# e2e tests\n$ yarn test:e2e\n\n# test coverage\n$ yarn test:cov\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndmen%2Fauth-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fndmen%2Fauth-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fndmen%2Fauth-microservice/lists"}