A simple skeleton for modern NestJS applications.
This repository provides a highly opinionated, basic setup for modern NestJS applications. It's not intended to be a turnkey solution but a solid starting point for the most common use cases. You can, should and will need to tweak and adapt it to your needs and personal preferences.
- 🦠 Use Biome instead of ESLint and Prettier. Biome hasn't yet reached feature parity compared to a fully pimped out ESLint setup, but it causes orders of magnitude fewer headaches. It's also roughly ten billion times faster.
- 🕵️♀️ Validate DTOs, route and query parameters with Zod instead of Class Validator (powered by
nestjs-zod). - ✅ Validate OpenAPI documentation with Redocly. It can also generate reasonably pretty HTML docs.
- 🧑🔧 Use Vitest instead of Jest.
- 🏚 Comes with architecture tests powered by TSArch. The tests currently assert the core ideas of a clean architecture. Feel free to configure them to your liking.
- 🔬 Extended linting with
Knip,npm-package-json-lintandlockfile-lint. - ✨ Run TypeScript files with
jitiinstead ofts-node. - 📜 Logging is based on
pino(courtesy ofnestjs-pino). - ⚙️ Configuration is done with
configbecause it is awesome. - 📚 Use subpath imports for aliases (see here for more details). No more
tsconfig-paths. - 🚀 Did I mention that the package itself is ESM? Because it is.
- 🧰 Use
@tsconfig/basesfor TypeScript configuration. - 💁♂️ Preconfigured for commitizen.
- We can almost run the code natively using type stripping. To make this work we need the
rewriteRelativeImportExtensionsoption introduced in TypeScript 5.7 - unfortunately this doesn't play well with subpath imports because those are absolute. Guess we have to either wait for TypeScript to fix this or get rid of the subpath imports. - Maybe add linting for Markdown (
markdownlintlooks nice enough),
- We use abstract classes instead of interfaces solely because they can then double as injection tokens (interfaces don't exist at runtime, abstract classes do). Note that the concretions don't
extendbutimplementthem.
