{"id":15137825,"url":"https://github.com/fer8a/nestjs-rest-scaffold","last_synced_at":"2025-10-23T13:30:56.889Z","repository":{"id":43272676,"uuid":"464533932","full_name":"fer8a/nestjs-rest-scaffold","owner":"fer8a","description":"REST boilerplate to build APIs / microservices using the NestJS framework","archived":false,"fork":false,"pushed_at":"2024-09-27T16:12:15.000Z","size":2358,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-16T23:13:46.985Z","etag":null,"topics":["api","fastify","microservice","nestjs","nestjs-boilerplate","nestjs-starter","open-telemetry","rest-api","swagger","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/fer8a.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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":"2022-02-28T15:19:23.000Z","updated_at":"2024-09-27T16:12:18.000Z","dependencies_parsed_at":"2024-06-24T20:16:39.563Z","dependency_job_id":"29611608-e3a4-41a3-b5cf-c06205837213","html_url":"https://github.com/fer8a/nestjs-rest-scaffold","commit_stats":{"total_commits":62,"total_committers":4,"mean_commits":15.5,"dds":"0.12903225806451613","last_synced_commit":"23b88cdbdd684723a3af80775caf068ac069f481"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fer8a%2Fnestjs-rest-scaffold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fer8a%2Fnestjs-rest-scaffold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fer8a%2Fnestjs-rest-scaffold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fer8a%2Fnestjs-rest-scaffold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fer8a","download_url":"https://codeload.github.com/fer8a/nestjs-rest-scaffold/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834619,"owners_count":19373758,"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","fastify","microservice","nestjs","nestjs-boilerplate","nestjs-starter","open-telemetry","rest-api","swagger","typescript"],"created_at":"2024-09-26T07:02:28.503Z","updated_at":"2025-10-23T13:30:56.884Z","avatar_url":"https://github.com/fer8a.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv id=\"top\"\u003e\u003c/div\u003e\n\u003c!-- PROJECT SHIELDS --\u003e\n\u003c!--\n*** I'm using markdown \"reference style\" links for readability.\n*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).\n*** See the bottom of this document for the declaration of the reference variables\n*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.\n*** https://www.markdownguide.org/basic-syntax/#reference-style-links\n--\u003e\n\u003c!-- [![Contributors][contributors-shield]][contributors-url]\n[![Forks][forks-shield]][forks-url]\n[![Stargazers][stars-shield]][stars-url]\n[![Issues][issues-shield]][issues-url]\n[![MIT License][license-shield]][license-url] --\u003e\n\n\n\n\u003c!-- PROJECT LOGO --\u003e\n\u003cbr /\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch3 align=\"center\"\u003eNestJS REST Scaffold\u003c/h3\u003e\n\n  \u003cp align=\"center\"\u003e\n    An awesome template to jumpstart your projects!\n    \u003cbr /\u003e\n    \u003ca href=\"https://docs.nestjs.com/\"\u003e\u003cstrong\u003eExplore the NestJS docs »\u003c/strong\u003e\u003c/a\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n\n\u003c!-- TABLE OF CONTENTS --\u003e\n\u003cdetails\u003e\n  \u003csummary\u003eTable of Contents\u003c/summary\u003e\n  \u003col\u003e\n    \u003cli\u003e\n      \u003ca href=\"#about-the-project\"\u003eAbout The Project\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#built-with\"\u003eBuilt With\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#features\"\u003eFeatures\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#folder-structure\"\u003eFolder Structure\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\n      \u003ca href=\"#getting-started\"\u003eGetting Started\u003c/a\u003e\n      \u003cul\u003e\n        \u003cli\u003e\u003ca href=\"#prerequisites\"\u003ePrerequisites\u003c/a\u003e\u003c/li\u003e\n        \u003cli\u003e\u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e\u003c/li\u003e\n      \u003c/ul\u003e\n    \u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#roadmap\"\u003eRoadmap\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e\u003c/li\u003e\n    \u003cli\u003e\u003ca href=\"#license\"\u003eLicense\u003c/a\u003e\u003c/li\u003e\n  \u003c/ol\u003e\n\u003c/details\u003e\n\n\n\n\u003c!-- ABOUT THE PROJECT --\u003e\n## About The Project\n\n[NestJS](https://nestjs.com/) is a great Framework to start building very robust server-side applications. There are many great templates available on GitHub; however, I couldn't find one that really suited my needs, therefore I created this ~~very opinionated~~ one. I wanted a boilerplate that would integrate many of the great features Nest has to offer, _out-of-the-box_, with the minimun configuration effort to start bootstraping an application right away.\n\nHere's why:\n* Your time should be focused on creating something amazing. A project that solves a problem and helps others.\n* You shouldn't be doing the same tasks over and over; like integrating a DB layer, a microservice layer, etc.\n* Keep it DRY and save some time :)\n\nOf course, no one template will serve all projects since your needs may be different, but here's for everyone who find it helpful.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n### Built With\n\n* [NestJS](https://nestjs.com/)\n* [Fastify](https://www.fastify.io/)\n* [Prisma](https://www.prisma.io/)\n* [Pino](https://getpino.io/)\n* [Open Telemetry](https://opentelemetry.io/)\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- FEATURES --\u003e\n## Features\n\nEvery time I start building an API, a REST microservice, a server-side app; there's always a set of features that I end up reusing over and over given the utility they provide. That's the main reason I have decided to create this project to bootstrap as much of this _core_ functionality as possible.\n\nLet's list a few of the features provided on this project:\n- Open Telemetry to instrument, generate, collect, and export telemetry data.\n- Terminus module for the healthcheck of your application exposed at the `/health` route.\n- OpenAPI specification ([Swagger](https://swagger.io/)) for all the `HTTP` routes (enhanced by the NestJS CLI plugin to reduce boilerplate).\n- Global exception middleware so you can catch and customize any target exception to your likings.\n- Global request-logger middleware for all incoming and outgoing `HTTP` (requests are logged by default with their metadata).\n- Global Cache middleware to enhance the response time of all the `GET` `HTTP` requests.\n- A programmatic way to access `environment` variables through DI.\n- A database ORM to interact with mulple DB drivers using the great [Prisma](https://www.prisma.io/) package.\n- [auto-mock](https://docs.nestjs.com/fundamentals/testing#auto-mocking) functionality for testing out of the box using the `createMock` utility from the [@golevelup/ts-jest](https://github.com/golevelup/nestjs/tree/master/packages/testing) package.\n- A programmatic way to generate logs using DI upon the right context of your application.\n- An example implementation of a [Kafka](https://kafka.apache.org/) transporter layer with a producer/consumer interface.\n- Husky package with _lint-staged_ bundled with _pre-commit and pre-push_ hooks that will run linter, formatter and tests.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- FOLDER STRUCTURE --\u003e\n## Folder Structure\n\nFollowing the _Nest way_, I ended up up with a module-based approach when it came to structuring the code.\nThat being said, the project comes with a series of folders and modules that you can reuse and extend to fit your needs, let's review them.\n- `config` Like its name implies is a folder to place all sort of configurations for your app. `cache`, `env`, configurations live here. You can also and include more modules in it.\n- `config/telemetry` Open Telemetry SDK and configuration file.\n- `config/db` Quite self explanatory, this is your DB module, the folder to place all your configs and ORM layer.\n- `config/log` Module where you can place the log driver used by your app. Comes with Pino out of the box.\n- `core` This is it, the source of ~~evil~~ the base code. It's a module wrapping the minimun functionality the app should have, again this is very opinionated of me, so you may choose to adjust it to fit your needs.\n- `providers` Folder to place external third-party SDKs or libraries.\n- `resources` Interfaces and endpoints with the bussiness logic of your app should be placed here. Modules, Controllers, Services and entities related to the solution you're building.\n- `resources/healthcheck` This exposes the healthcheck functionality of your app to the `HTTP` transport layer.\n- `transporters` Meant for all the microservices and interfaces other than `HTTP` used in your app. Kafka, Redis, NATS, etc.\n\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- GETTING STARTED --\u003e\n## Getting Started\n\nTo get a local copy up and running follow these simple example steps.\n\n### Prerequisites\n\n* npm\n  ```sh\n  npm install npm@latest -g\n  ```\n* Nest\n  ```sh\n  npm i -g @nestjs/cli\n  ```\n\n### Installation and Usage\n\n1. Clone the repo\n   ```sh\n   git clone https://github.com/your_username_/nestjs-rest-scaffold.git\n   ```\n2. Install NPM packages\n   ```sh\n   npm install\n   ```\n3. Run the application\n   ```sh\n   npm run start\n   ```\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- ROADMAP --\u003e\n## Roadmap\n\n- [x] Add unit tests\n- [x] Add e2e tests\n- [ ] Add Docker Compose\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- CONTRIBUTING --\u003e\n## Contributing\n\nContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\nIf you have a suggestion that would make this better, please fork the repo and create a pull request.\nDon't forget to give the project a star! Thanks again!\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the Branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n\n\n\n\u003c!-- LICENSE --\u003e\n## License\n\nDistributed under the MIT License. See `LICENSE.md` for more information.\n\n\u003cp align=\"right\"\u003e(\u003ca href=\"#top\"\u003eback to top\u003c/a\u003e)\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffer8a%2Fnestjs-rest-scaffold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffer8a%2Fnestjs-rest-scaffold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffer8a%2Fnestjs-rest-scaffold/lists"}