NestJS tip: how to try any official sample in seconds
Let's say you want to run one of the official NestJS samples, the ones under the sample folder of the nestjs/nest repository, to see how some feature looks like in a real app. But you don't want to clone the whole framework just for that! What? Just run this: ## Node.js v22+ is required npx try-nest@latest Pick a sample, pick a directory, and optionally install the dependencies with npm , pnpm ,…
Running one of the official NestJS samples in just a few seconds is now possible thanks to a new tool. Even if you don't want to clone the entire framework just to see how a particular feature works, you can easily run the sample you're interested in.
To use this tool, you'll need Node.js version 22 or higher. Simply run the command `npx try-nest@latest`, pick the sample you'd like to try from the list, and optionally install the dependencies using npm, pnpm, yarn, or bun. Each sample includes its own description, so you won't have to guess what any of the features are for.
The tool reads the list of samples from the nestjs/nest repository at runtime, so new samples will appear as soon as they're added to the repository. It also reads the description field of each sample's package.json to provide a description of the sample. The tool downloads the repo tarball and writes only the sample folder into your directory, ensuring that your project has no reference back to the monorepo.
You can list all available samples, add a flag to get machine-readable output, skip the prompts, or specify a sample and directory to create a standalone project. This is especially useful if you only want to run a specific sample without having to clone the entire framework or know the sample's name beforehand.
The tool is heavily inspired by try-prisma and the source code can be found on GitHub.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.