백과
블로그
블로그
스택 시리즈
소개
로그인
백과 블로그
메뉴 열기
로그인
[NestJS] TypeORM을 사용해 Postgres 연동하기
NestJS
JavaScript
Node.js
[NestJS] TypeORM을 사용해 Postgres 연동하기
백과
2026년 2월 16일
5분 읽기
목차
TypeORM을 사용해 Postgres 연동하기
🦅 TypeORM? ORM이란?
💾 DB (Postgres) 설치 - Docker Compose
docker-compose.yml 작성
환경 변수 설정 (.env)
DB 실행 및 확인
🛠️ TypeORM 설치 및 연동
모듈 설치
TypeORM 설정 분리 (typeorm.config.ts)
App 모듈에 등록 (app.module.ts)
🏗️ 도메인 구현 (Entity, Repository, Service)
Entity 정의 (board.entity.ts)
Custom Repository 구현 (boards.repository.ts)
Module에 등록 (boards.module.ts)
Service에서 사용 (boards.service.ts)
Controller 수정 (boards.controller.ts)
🚀 실행 및 테스트
🧐 Deep Dive: 꼭 알아야 할 TypeORM 핵심 개념
Data Mapper vs Active Record 패턴
왜 async / await를 써야 할까? (동기 vs 비동기)
Custom Repository와 super()의 비밀
synchronize: true 옵션의 치명적인 함정 🚨
🚀 마무리
스택 시리즈
NestJS 스택