Node.js 개발 환경과 생태계 · · 1 min read

웹 프레임워크: Express, Fastify, NestJS

Node.js 대표 웹 프레임워크를 정리했다. 미니멀부터 구조적 프레임워크까지 목적에 맞게 고른다.

선택 기준

프레임워크성격언제 쓰나
Express미니멀·사실상 표준자유로운 구성, 학습·프로토타이핑
Fastify고성능·플러그인처리량 중요, 스키마 기반 검증
NestJS구조적 (TS·DI)규모 큰 팀 프로젝트, Angular 식 아키텍처

Express

가장 널리 쓰이는 미니멀 프레임워크.

npm install express
// index.js
const express = require("express");
const app = express();

app.get("/", (req, res) => res.json({ hello: "world" }));
app.listen(3000, () => console.log("http://localhost:3000"));

Fastify

스키마 기반 검증과 높은 처리량이 강점.

npm install fastify
// index.js
const fastify = require("fastify")();

fastify.get("/", async () => ({ hello: "world" }));
fastify.listen({ port: 3000 });

NestJS

TypeScript·의존성 주입(DI) 기반의 구조적 프레임워크. 자세한 내용은 아래 개별 문서 참고.

npm i -g @nestjs/cli
nest new project
npm run start:dev   # http://localhost:3000

개별 문서