Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d841b46
chore: 개발 도구 설정
labyrinth30 May 26, 2026
8812b4c
chore: 환경변수와 데이터베이스 설정
labyrinth30 May 26, 2026
827223f
feat: 헬스체크와 API 문서 설정
labyrinth30 May 26, 2026
f679a6c
docs: 셋업 가이드 작성
labyrinth30 May 26, 2026
bd9a4f8
chore: 환경변수 검증과 셋업 문서 정리
labyrinth30 May 26, 2026
ce90973
chore: GitHub Actions CI 파이프라인 구성
labyrinth30 May 26, 2026
c32753d
ci: PR 트리거 브랜치 필터 제거
labyrinth30 May 26, 2026
2ba5527
chore: useImportType 규칙 비활성화
labyrinth30 May 26, 2026
d8dcee8
chore: biome-ignore 주석 제거
labyrinth30 May 26, 2026
ff0c219
chore: ignore env example variants
labyrinth30 May 26, 2026
597feaa
chore: PostgreSQL 버전 16 -> 18로 업그레이드
labyrinth30 May 28, 2026
bfc0636
feat: @nestjs/terminus 기반 DB 헬스체크 추가
labyrinth30 May 28, 2026
b89cea1
refactor: 코드 리뷰 반영
labyrinth30 May 29, 2026
7644102
chore: TypeScript 6.0 업그레이드 및 tsgo 도입
labyrinth30 May 29, 2026
0cdec55
chore: vitest → bun test 전환
labyrinth30 May 29, 2026
48ba064
chore: .agents, .claude, skills-lock.json gitignore 추가
labyrinth30 May 29, 2026
780ae78
chore: 코드래빗 리뷰 반영
labyrinth30 May 29, 2026
b372322
Merge pull request #5 from mash-up-kr/chore/3-ci-pipeline
labyrinth30 Jun 6, 2026
eebc98e
chore: main 브랜치 머지 및 Hono 어댑터 기반 통합
labyrinth30 Jun 6, 2026
c5671d2
chore: biome 린트 에러 수정
labyrinth30 Jun 6, 2026
3bd3c53
fix: e2e 테스트 CI 환경 DATABASE_URL 누락 수정
labyrinth30 Jun 6, 2026
f3552ad
fix: e2e 테스트 CI 환경 DATABASE_URL 누락 수정
labyrinth30 Jun 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
NODE_ENV=development
PORT=3000
DATABASE_URL=postgres://postgres:postgres@localhost:5432/team_mino
DB_POOL_SIZE=10

@minsour minsour May 29, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

디비 풀 기본값은 Supabase 환경 고려해서 수정이 필요할 수도 있는거죠?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Supabase PgBouncer 사용한다면 풀은 1~2로 줄일게요!


POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
POSTGRES_DB=team_mino
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
dist/
node_modules/
.env
.env.*
!.env.example
!.env.*.example
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]

102 changes: 102 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Team MINO Node

NestJS 기반 Team MINO 백엔드 API 서버입니다.

## Requirements

- Bun 1.3.x
- Docker

## Setup Guide

### 1. Install Dependencies

```bash
bun install
```

### 2. Configure Environment

```bash
cp .env.example .env
```

기본 로컬 DB 연결 정보는 아래 값입니다.

```env
DATABASE_URL=postgres://postgres:postgres@localhost:5432/team_mino
```

### 3. Start Local Database

```bash
docker compose up -d postgres
```

컨테이너 상태를 확인합니다.

```bash
docker compose ps
```

### 4. Start Development Server

```bash
bun run start:dev
```

서버 기본 포트는 `3000`입니다.

```text
http://localhost:3000
```

### 5. Check Health API

```bash
curl http://localhost:3000/health
```

정상 응답은 아래와 같습니다.

```json
{
"status": "ok"
}
```

## Available Scripts

```bash
bun run start:dev
bun run build
bun run check
bun run lint
bun run format
bun run test
```

## API Docs

개발 서버 실행 후 Swagger 문서는 아래 경로에서 확인할 수 있습니다.

```text
http://localhost:3000/api-docs
```

## Database

로컬 PostgreSQL은 Docker Compose로 실행합니다.

```bash
docker compose up -d postgres
docker compose down
```

Drizzle 설정은 `drizzle.config.ts`를 사용합니다.

```bash
bun run db:generate
bun run db:migrate
bun run db:push
```
27 changes: 27 additions & 0 deletions biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"$schema": "https://biomejs.dev/schemas/2.4.15/schema.json",
"files": {
"includes": ["**", "!dist", "!node_modules"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2
},
"assist": {
"actions": {
"source": {
"organizeImports": "on"
}
}
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"style": {
"useImportType": "off"
}
}
}
}
386 changes: 380 additions & 6 deletions bun.lock

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
services:
postgres:
image: postgres:18-alpine
container_name: team-mino-postgres
restart: unless-stopped
ports:
- "${POSTGRES_PORT:-5432}:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_DB: ${POSTGRES_DB:-team_mino}
volumes:
- postgres_data:/var/lib/postgresql/data
Comment on lines +12 to +13

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

postgres 18-alpine docker image does mounting volume at /var/lib/postgresql/data still persist data via compatibility symlink

💡 Result:

No, mounting a volume at /var/lib/postgresql/data does not persist data in the way it did in previous versions for PostgreSQL 18 and newer [1][2]. In PostgreSQL 18+, the official Docker image structure has changed significantly [1][2]: 1. Changed Data Location: The default data directory (PGDATA) is now located at /var/lib/postgresql/18/docker [3][2]. 2. Volume Mount Point: The VOLUME directive in the Dockerfile has been moved from /var/lib/postgresql/data to /var/lib/postgresql [2]. 3. No Compatibility Symlink: While there was an initial attempt to include a compatibility symlink, it was explicitly removed in the Alpine images (and others) to avoid issues [4]. If you attempt to mount a volume at /var/lib/postgresql/data, it will generally be ignored or result in an unused mount point, because the container expects the data to reside within the /var/lib/postgresql directory structure [1][3]. Recommended Configuration: To ensure data persists correctly in PostgreSQL 18+, you should mount your volume at the parent directory: volumes: - my_db_data:/var/lib/postgresql This configuration allows PostgreSQL to place its data in the correct version-specific subdirectory (e.g., /var/lib/postgresql/18/docker), which is essential for proper functionality and future upgrades using tools like pg_upgrade [1][3]. If you persist in using the old mount path, you may encounter silent data loss where the container initializes a new database in an anonymous volume while ignoring your existing data on the host [3].

Citations:


PostgreSQL 18용 볼륨 마운트 경로를 /var/lib/postgresql로 변경 권장

현재 volumes가 postgres_data:/var/lib/postgresql/data로 되어 있는데, Postgres 18+ 공식 이미지의 데이터 디렉터리/VOLUME 기준이 /var/lib/postgresql로 변경되었습니다. 따라서 올드 경로(/var/lib/postgresql/data)를 유지하면 업그레이드/영속성에서 문제가 생길 수 있어, 마운트 지점을 권장 경로로 맞추는 게 안전합니다.

권장 예시
   volumes:
-    - postgres_data:/var/lib/postgresql/data
+    - postgres_data:/var/lib/postgresql

이전 리뷰에서 언급된 대로 compose를(KKardy가) 별도로 정비할 때 함께 반영해 주세요.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
volumes:
- postgres_data:/var/lib/postgresql/data
volumes:
- postgres_data:/var/lib/postgresql
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docker-compose.yml` around lines 12 - 13, Update the docker-compose volume
mount for the Postgres service: replace the current mapping that uses
postgres_data:/var/lib/postgresql/data with the Postgres 18+ recommended mount
target postgres_data:/var/lib/postgresql so the service (the volumes entry
referencing postgres_data and the current /var/lib/postgresql/data path) uses
the new VOLUME path and avoids persistence/upgrade issues with Postgres 18+.

healthcheck:
test: ["CMD-SHELL", "pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5

volumes:
postgres_data:
16 changes: 16 additions & 0 deletions drizzle.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { defineConfig } from "drizzle-kit";

const databaseUrl = process.env.DATABASE_URL;

if (!databaseUrl) {
throw new Error("DATABASE_URL is required");
}
Comment on lines +3 to +7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

DATABASE_URL 형식 검증도 같이 해두는 게 안전합니다.

빈 값만 막고 있어서 오타 URL이 들어오면 이후 단계에서 에러가 납니다. 여기서 즉시 검증하면 원인 파악이 쉬워집니다.

수정 예시
 const databaseUrl = process.env.DATABASE_URL;
 
 if (!databaseUrl) {
   throw new Error("DATABASE_URL is required");
 }
+
+try {
+  new URL(databaseUrl);
+} catch {
+  throw new Error("DATABASE_URL must be a valid URL");
+}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error("DATABASE_URL is required");
}
const databaseUrl = process.env.DATABASE_URL;
if (!databaseUrl) {
throw new Error("DATABASE_URL is required");
}
try {
new URL(databaseUrl);
} catch {
throw new Error("DATABASE_URL must be a valid URL");
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@drizzle.config.ts` around lines 3 - 7, 현재는 process.env.DATABASE_URL을 빈값만 체크하고
있어 오타나 잘못된 URL 형식이 통과됩니다; databaseUrl 변수를 읽은 직후 (databaseUrl /
process.env.DATABASE_URL) URL 형식을 검증하도록 추가하세요 — 예를 들어 프로토콜(mysql://, postgres://
등) 또는 전체 URL 파싱(정규식 또는 URL 생성자)으로 유효성 검사를 하고, 실패하면 기존 throw new
Error("DATABASE_URL is required") 대신 또는 함께 명확한 에러 메시지(예: "DATABASE_URL is
missing or invalid: <value>")를 던져 즉시 실패하게 만드세요.


export default defineConfig({
schema: "./src/database/schema/index.ts",
out: "./drizzle",
dialect: "postgresql",
dbCredentials: {
url: databaseUrl,
},
});
Loading