Overview
This guide will walk you through set up a new project in NestJS. We've found 3 relevant code snippets to help you get started.
Prerequisites
- Node.js 18+ installed
- NestJS project initialized
- Basic understanding of NestJS
Step-by-Step Guide
Step 1: Install Dependencies
First, install any required dependencies for set up a new project:
npm install @nestjs/core @nestjs/common @nestjs/platform-express @nestjs/swagger helmet
Step 2: Copy the Code
Use our pre-built snippets to implement set up a new project:
NestJS Express Server
Production-ready NestJS HTTP server with Express adapter
npx hanma add nest-express-server --framework nest
NestJS Fastify Server
Production-ready NestJS HTTP server with Fastify adapter
npx hanma add nest-fastify-server --framework nest
Microservice Bootstrap
Configurable microservice with multiple transports
npx hanma add nest-microservice --framework nest
Step 3: Test Your Implementation
Verify that your implementation works correctly:
npm test
# or
npm run test:watch
Available Snippets for This Topic
NestJS Express Server
Production-ready NestJS HTTP server with Express adapter
npx hanma add nest-express-server --framework nest
NestJS Fastify Server
Production-ready NestJS HTTP server with Fastify adapter
npx hanma add nest-fastify-server --framework nest
Microservice Bootstrap
Configurable microservice with multiple transports
npx hanma add nest-microservice --framework nest