{"id":13764708,"url":"https://github.com/Tony133/nestjs-api-boilerplate-jwt","last_synced_at":"2025-05-10T20:31:03.629Z","repository":{"id":37802719,"uuid":"209091974","full_name":"Tony133/nestjs-api-boilerplate-jwt","owner":"Tony133","description":"An API Boilerplate to create a ready-to-use REST API in seconds with NestJS v11.x + TypeORM and JWT Auth 😻","archived":false,"fork":false,"pushed_at":"2025-05-03T02:49:27.000Z","size":3412,"stargazers_count":552,"open_issues_count":9,"forks_count":74,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-03T03:38:08.426Z","etag":null,"topics":["api-rest","apirest","boilerplate","docker","fastify","javascript","js","jwt","nest","nestjs","node","nodejs","openapi","rest-api","swagger","typeorm","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/Tony133.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,"zenodo":null}},"created_at":"2019-09-17T15:34:18.000Z","updated_at":"2025-04-29T00:11:27.000Z","dependencies_parsed_at":"2024-04-14T17:39:40.779Z","dependency_job_id":"a7a6ded3-57b5-4b57-99c4-08ea0ee27929","html_url":"https://github.com/Tony133/nestjs-api-boilerplate-jwt","commit_stats":{"total_commits":816,"total_committers":5,"mean_commits":163.2,"dds":0.4375,"last_synced_commit":"8279dacb31efa9c83c476afde3fca71a04f87db4"},"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tony133%2Fnestjs-api-boilerplate-jwt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tony133%2Fnestjs-api-boilerplate-jwt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tony133%2Fnestjs-api-boilerplate-jwt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tony133%2Fnestjs-api-boilerplate-jwt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tony133","download_url":"https://codeload.github.com/Tony133/nestjs-api-boilerplate-jwt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253480380,"owners_count":21915246,"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":["api-rest","apirest","boilerplate","docker","fastify","javascript","js","jwt","nest","nestjs","node","nodejs","openapi","rest-api","swagger","typeorm","typescript"],"created_at":"2024-08-03T16:00:26.584Z","updated_at":"2025-05-10T20:31:03.617Z","avatar_url":"https://github.com/Tony133.png","language":"TypeScript","funding_links":[],"categories":["Resources","TypeScript"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"blank\"\u003e\u003cimg src=\"https://nestjs.com/img/logo-small.svg\" width=\"200\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n# NestJSApiBoilerplateJWT\n\nAn API Boilerplate to create a ready-to-use REST API in seconds with NestJS 11.x and JWT Auth System :heart_eyes_cat:\n\n## Installation\n\n```bash\n   pnpm install\n```\n\n## Set Environment for secret key JWT and other configurations\n\n```bash\n   cp .env.example .env\n```\n\nTo set up on multiple environments, such as development, staging or production, we do as follows:\n\n```bash\n   cp .env.example .env.development # or .env.staging, etc\n```\n\n## Config settings .env for sending a notification when a user registers, forgets password or changes password\n\n```\n   EMAIL_HOST=smtp.mailtrap.io\n   EMAIL_PORT=2525\n   EMAIL_AUTH_USER=[:user]\n   EMAIL_AUTH_PASSWORD=[:password]\n   EMAIL_DEBUG=true\n   EMAIL_LOGGER=true\n```\n\n## Config settings .env to connect MySQL\n\nOnce the database has been configured, start the Nest App via `pnpm run start:dev` it automatically synchronizes the entities so it is ready to use.\n\n```\n   TYPEORM_CONNECTION = \"mysql\"\n   TYPEORM_HOST = \"localhost\"\n   TYPEORM_PORT = 3306\n   TYPEORM_USERNAME = [:user]\n   TYPEORM_PASSWORD = [:password]\n   TYPEORM_DATABASE = [:database]\n   TYPEORM_AUTO_SCHEMA_SYNC = true\n   TYPEORM_ENTITIES = \"dist/**/*.entity.js\"\n   TYPEORM_SUBSCRIBERS = \"dist/subscriber/**/*.js\"\n   TYPEORM_MIGRATIONS = \"dist/migrations/**/*.js\"\n   TYPEORM_ENTITIES_DIR = \"src/entity\"\n   TYPEORM_MIGRATIONS_DIR = \"src/migration\"\n   TYPEORM_SUBSCRIBERS_DIR = \"src/subscriber\"\n```\n\n## Install TypeScript Node\n\n```bash\n   pnpm install -g ts-node\n```\n\n## Running migrations with typeorm\n\n```bash\n   ts-node node_modules/.bin/typeorm migration:run -d dist/typeorm-cli.config\n```\n\nor\n\n```bash\n   node_modules/.bin/typeorm migration:run -d dist/typeorm-cli.config\n```\n\n## Running the app\n\n```bash\n    # development\n    $ pnpm start\n\n    # watch mode\n    $ pnpm start:dev\n\n    # production mode\n    $ pnpm start:prod\n```\n\n## Running the app in REPL mode\n\n```bash\n   pnpm start --entryFile repl\n```\n\nor\n\n```bash\n   pnpm start:repl\n```\n\n## Docker\n\nThere is a `docker-compose.yml` file for starting MySQL with Docker.\n\n`$ docker-compose up db`\n\nAfter running, you can stop the Docker container with\n\n`$ docker-compose down`\n\n## Url Swagger for Api Documentation\n\n```\n\nhttp://127.0.0.1:3000/docs\n\n```\n\nor\n\n```\n\nhttp://127.0.0.1:3000/docs-json\n\n```\n\nor\n\n```\n\nhttp://127.0.0.1:3000/docs-yaml\n\n```\n\nConfigure `SWAGGER_USER` and `SWAGGER_PASSWORD` in the .env file for to access the Swagger(Open API) documentation with basic authentication. `NODE_ENV`\nmust not be equal to \"production\" otherwise the Swagger is not displayed.\n\n```\nNODE_ENV=[:enviroments]\nSWAGGER_USER=[:user]\nSWAGGER_PASSWORD=[:password]\n\n```\n\n## Configuring the SERVER_PORT environment variable as the default port if you don't want to use the default\n\n```\n   SERVER_PORT=3333\n```\n\n## Configuring the ENDPOINT_URL_CORS environment variable for app frontend\n\n```\n   ENDPOINT_URL_CORS='http://127.0.0.1:4200'\n```\n\n## Getting secure resource with Curl\n\n```bash\n    curl -H 'content-type: application/json' -v -X GET http://127.0.0.1:3000/api/secure  -H 'Authorization: Bearer [:token]'\n```\n\n## Generate Token JWT Authentication with Curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X POST -d '{\"email\": \"tony_admin@nest.com\", \"password\": \"mysecret\"}' http://127.0.0.1:3000/api/auth/login\n```\n\n## Registration user with Curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X POST -d '{\"name\": \"tony\", \"email\": \"tony_admin@nest.com\", \"username\":\"tony_admin\", \"password\": \"mysecret\"}' http://127.0.0.1:3000/api/auth/register\n```\n\n## Refresh token with curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X POST -d '{\"refreshToken\": \"[:token]\"}' http://127.0.0.1:3000/api/auth/refresh-tokens\n```\n\n## Forgot password with curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X POST -d '{\"email\": \"tony_admin@nest.com\"}' http://127.0.0.1:3000/api/auth/forgot-password\n```\n\n## Change password User with curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X POST -d '{\"email\": \"tony_admin@nest.com\", \"password\": \"new_password\"}' http://127.0.0.1:3000/api/auth/change-password  -H 'Authorization: Bearer [:token]'\n```\n\n## Update profile User with curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X PUT -d '{\"name\": \"tony\", \"email\": \"tony_admin@nest.com\", \"username\": \"tony_admin\"}' http://127.0.0.1:3000/api/users/:id/profile  -H 'Authorization: Bearer [:token]'\n```\n\n## Users list with Curl\n\n```bash\n   curl -H 'content-type: application/json' -H 'Accept: application/json' -v -X GET http://127.0.0.1:3000/api/users  -H 'Authorization: Bearer [:token]'\n```\n\n## User by Id with Curl\n\n```bash\n   curl -H 'content-type: application/json' -H 'Accept: application/json' -v -X GET http://127.0.0.1:3000/api/users/:id  -H 'Authorization: Bearer [:token]'\n```\n\n## Update User with Curl\n\n```bash\n   curl -H 'content-type: application/json' -v -X PUT -d '{\"name\": \"tony\", \"email\": \"tony_admin@nest.com\", \"username\": \"tony_admin\", \"password\":\"password_update\"}' http://127.0.0.1:3000/api/users/:id  -H 'Authorization: Bearer [:token]'\n```\n\n## Delete User by Id with Curl\n\n```bash\n   curl -H 'content-type: application/json' -H 'Accept: application/json' -v -X DELETE http://127.0.0.1:3000/api/users/:id  -H 'Authorization: Bearer [:token]'\n```\n\n## License\n\n[MIT licensed](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTony133%2Fnestjs-api-boilerplate-jwt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTony133%2Fnestjs-api-boilerplate-jwt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTony133%2Fnestjs-api-boilerplate-jwt/lists"}