명세서가 Node.js 기반으로 적혀있었습니다. 백엔드 프레임워크는 적혀있지 않아 선택지를 알아보았습니다.
선택지가 Express.js와 Nest.js가 있었습니다. 저는 Express.js 경험은 있었지만 팀원은 아무도 경험하지 않았습니다.
Nest.js 선정이유
Nest.js의 엔티티 선언 방식을 보니 JPA와 유사한 점이 많아보였고, 팀원들이 JPA에 익숙한 상황에서 프로젝트의 기간과
학습 커브를 고려했을 대 Nest.js를 백엔드 프레임워크로 사용하는 것이 적절하다고 판단했습니다.
이에 더해 공식문서를 보면 볼 수록, Spring과 유사한 흐름과 코드를 확인할 수 있었고, 팀원에게 근거를 제시하며 설득했습니다.
TypeORM을 쓰기로 한 이유
ORM은 TypeORM과 SequelizeORM이 있었는데
JPA와 유사하며 Nest.js 공식 레퍼런스에도 등장하고 참조할 레퍼런스가 많다고 하여 결정하였습니다.
Nest.js 프로젝트 시작하기
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Rea
docs.nestjs.com
공식 레퍼런스가 깔끔하게 잘 정리되어 있습니다! 일단 공식 레퍼런스를 보며 배워나가야 할 것 같습니다.
@swc\core 문제 발생
Nest.js v11에서 yarn 패키지를 이용해 패키지를 추가하려는데 자꾸 에러가 발생했습니다. 공식 문서 초입에 Node.js 20 버전 이상을 요구하는거 보면 Node.js 문제는 아닌 것 같습니다.
error C:\Users\....\Desktop\...\S12P31S302\...\node_modules\@swc\core: Command failed.
Exit code: 3221225477
Command: node postinstall.js
Arguments:
Directory: C:\Users\....\Desktop\...\S12P31S302\...\node_modules\@swc\core
Output:
Segmentation fault
빌드를 빠르게 해주는 @swc에서 문제가 생기는 것 같은데..
11버전 삭제
$ npm uninstall -g @nestjs/cli
....@DESKTOP-4QCTMKG MINGW64 ~/Desktop/..../S12P31S302 (dev/be)
$ npm install -g @nestjs/cli@10
11버전 삭제 후 10버전으로 깔고 패키지 매니저로 yarn 사용하니 오류 없이 잘 깔립니다.
$ yarn run start
yarn run v1.22.22
$ nest start
error Command failed with exit code 3221225477.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Segmentation fault
그러나 실행하려하니, 유사한 코드의 문제가 발생했고, Node 버전을 20으로 낮춰야할 것 같습니다.
nvm 설치하고 nvm install 20 nvm use 20 으로 Node.js를 20으로 다운그레이드했습니다.
잘 실행되는 것을 볼 수 있습니다.
명세에는 Node.js v22라고 써있지만, 20으로 낮췄고 아무래도 window + yarn + node v22 + nest의 swc가 충돌을 일으키는 것이라고 판단했습니다.
아니 근데 팀원은 Node 22버전으로 되던데 뭐가 문제인지 아신다면 알려주시면 감사하겠습니다. 일단 Dockerfile로 빌드할 거라 넘어갔습니다.

속도 향상 기법
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
await app.listen(process.env.PORT ?? 3000);
}
bootstrap();
이 Nest.js의 main.ts 인데 이를 보고 express랑 상당히 비슷하다고 느꼈는데 공식문서를 보니 express를 래핑해서 만든거라고 합니다.
기본적으로 express이고, 원한다면 fastify로 더 가볍고 빠른 상황이 필요할 때 적용할 수 있을 것으로 보입니다.
공식문서를 보면 더 빠른만큼 지원 기능이 제한된 경우가 많아 유의해야 합니다.
Swagger 달기
잘 설명되어 있습니다. yarn 패키지 매니저의 경우
yarn add @nestjs/swagger
https://docs.nestjs.com/openapi/introduction
Documentation | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines elements of OOP (Object Oriented Programming), FP (Functional Programming), and FRP (Functional Rea
docs.nestjs.com
DB 선정 (관계형 VS NoSQL)
유저의 채팅 context(문맥)을 고려해야하기 때문에 유저가 로그인하면 유저의 채팅 기록을 가져와야 한다.
'개발 프로젝트' 카테고리의 다른 글
CSR 렌더링 시간 최적화(with.Three.js) 13초에서 5초, 다시 2초까지 (0) | 2025.05.12 |
---|---|
WebRTC P2P vs SFU 버츄얼 개발 프로젝트 (Nest.js 2편) (0) | 2025.05.02 |
Kubernetes가 왜 많이 쓰이나요? (학습과 프로젝트 도입) (0) | 2025.03.23 |
Buffer와 Cache의 차이와 GIT SUBMODULE 사용, 도커 트러블슈팅 err_name_not_resolved (0) | 2025.03.12 |
Docker-compose 환경 has blocked by CORS policy 문제 (0) | 2025.02.17 |