-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'chore/set-restrict-master-push'
- Loading branch information
Showing
95 changed files
with
3,707 additions
and
1,071 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
NODE_ENV=local | ||
|
||
## app | ||
TZ=Asia/Seoul | ||
PORT=3000 | ||
CORS_ORIGIN=* | ||
#CORS_ORIGIN=http://naver.com,http://map.naver.com,http://localhost:3000 | ||
APP_NAME='API' | ||
|
||
## jwt | ||
JWT_SECRET=jwt-secret | ||
JWT_EXPIRES_IN=7d | ||
JWT_ISSUER=Nest-API | ||
JWT_SUBJECT=user-info | ||
|
||
## TypeORM | ||
DATABASE_TYPE=postgres | ||
DATABASE_HOST= | ||
DATABASE_PORT= | ||
DATABASE_NAME= | ||
DATABASE_USER= | ||
DATABASE_PASSWORD= | ||
DATABASE_LOG=all | ||
#DATABASE_LOG=query,info,warn,error | ||
|
||
|
||
## (optional) connection custom setting | ||
DATABASE_MAX_QUERY_EXECUTION_TIME=10000 | ||
DATABASE_CONNECT_TIMEOUT=60000 | ||
DATABASE_POOL_MIN_SIZE=5 | ||
DATABASE_POOL_MAX_SIZE=10 | ||
|
||
## swagger | ||
SWAGGER_APIS_TITLE='Nestjs API' | ||
SWAGGER_APIS_DESCRIPTION='Nestjs API' | ||
SWAGGER_APIS_VERSION=1.0 | ||
|
||
## sentry | ||
SENTRY_DSN=0.7 | ||
SENTRY_TRACES_SAMPLE_RATE=https:// | ||
|
||
## Slack Server Error | ||
SLACK_WEB_HOOK_URI_BY_SERVER_ERROR_ALERT= | ||
SLACK_CHANNEL_NAME_BY_SERVER_ERROR_ALERT=error-alaram | ||
SLACK_DESCRIPTION_BY_SERVER_ERROR_ALERT=server-error-alaram-channel | ||
SLACK_VIEWER_URL_BY_SERVER_ERROR_ALERT=https:// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# PR Summery | ||
|
||
## [FEATURE] | ||
|
||
- ex) (공통 UI 제작)[notion 티켓 url 첨부] | ||
|
||
## [WORK-LOG] | ||
|
||
- 작업 진행 과정 설명 | ||
- ex) feature일 경우 feature 진행과정 설명 | ||
|
||
## [HOW-TO] (optional) | ||
|
||
- ex) fix PR일 경우 픽스 설명 | ||
|
||
## [ISSUE] (optional) | ||
|
||
- 관련 라이브러리 설치 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Restrict merge from develop to main | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
|
||
jobs: | ||
block_push: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Block push to master/main | ||
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') | ||
run: echo "Pushing to master/main branch is not allowed." && exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
echo '[Husky] Hooks: pre-commit' | ||
npm exec tsc --noEmit | ||
npm exec lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"*.ts": "eslint --fix" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,108 @@ | ||
# nestjs 보일러 플레이트 | ||
|
||
## 권장 환경 | ||
- node: v18.14.x | ||
- nestjs 버전: v10.x.x | ||
- @nestjs/cli: v10.1.17 | ||
- @nestjs/cli: v10.1.17 | ||
|
||
## 폴더 구조 | ||
```bash | ||
. | ||
├── app.controller.ts | ||
├── app.module.ts # app 메인 Module | ||
├── app.service.ts | ||
├── common # '@app/common'로 paths 설정 | ||
├── config # '@app/config'로 paths 설정 | ||
├── custom # '@app/custom'로 paths 설정 | ||
│ ├── express # express 관련. EX. middleware | ||
│ └── nest # nestjs 관련. EX. interceptor, provider | ||
├── domain # 모든 API는 domain 모듈 하위 모듈로 구현한다. | ||
│ └── domain.module.ts | ||
├── entity # '@app/entity'로 paths 설정, typeorm entity 전용 | ||
│ | ||
└── main.ts # 주 진입점 | ||
``` | ||
|
||
## env 파일 | ||
- 참고: .env.sample | ||
``` | ||
NODE_ENV=local | ||
## app | ||
TZ=Asia/Seoul | ||
PORT=3000 | ||
CORS_ORIGIN=* | ||
APP_NAME='API' | ||
JWT_SECRET=jwt-secret | ||
JWT_EXPIRES_IN=7d | ||
JWT_ISSUER=Nest-API | ||
JWT_SUBJECT=user-info | ||
## TypeORM | ||
DATABASE_TYPE=postgres | ||
DATABASE_HOST=localhost | ||
DATABASE_PORT=5432 | ||
DATABASE_NAME=postgres | ||
DATABASE_USER= | ||
DATABASE_PASSWORD= | ||
DATABASE_LOG=all | ||
#DATABASE_LOG=query,info,warn,error | ||
DATABASE_MAX_QUERY_EXECUTION_TIME=10000 | ||
## (optional) connection custom setting | ||
DATABASE_CONNECT_TIMEOUT=60000 | ||
DATABASE_POOL_MIN_SIZE=5 | ||
DATABASE_POOL_MAX_SIZE=10 | ||
## swagger | ||
SWAGGER_APIS_TITLE='Nestjs API' | ||
SWAGGER_APIS_DESCRIPTION='Nestjs API' | ||
SWAGGER_APIS_VERSION=1.0 | ||
## sentry | ||
SENTRY_DSN=https:// | ||
SENTRY_TRACES_SAMPLE_RATE=0.7 | ||
## Slack Server Error | ||
SLACK_WEB_HOOK_URI_BY_SERVER_ERROR_ALERT= | ||
SLACK_CHANNEL_NAME_BY_SERVER_ERROR_ALERT=error-alaram | ||
SLACK_DESCRIPTION_BY_SERVER_ERROR_ALERT=server-error-alaram-channel | ||
SLACK_VIEWER_URL_BY_SERVER_ERROR_ALERT=https:// | ||
``` | ||
|
||
## 프로젝트 실행 방법 | ||
1. npm 모듈 설치 | ||
```bash | ||
# package.json 기준으로 설치 | ||
$ npm install | ||
|
||
# package-lock.json 기준으로 설치 | ||
$ npm ci | ||
``` | ||
|
||
2. 개발환경에 사용할 env 파일 생성 및 설정 값 추가 | ||
```bash | ||
$ cp .env.sample ./env/local.env | ||
``` | ||
|
||
3. 개발 환경으로 실행 | ||
```bash | ||
# watch 모드로 실행 | ||
$ npm run start:dev | ||
|
||
# 디버그 모드로 실행 | ||
$ npm run start:debug | ||
``` | ||
|
||
4. 확인 | ||
- api: [localhost:3000/api](http://localhost:3000/api) | ||
- swagger: [localhost:3000/docs](http://localhost:3000/docs) | ||
- swagger-json: [localhost:3000/docs-json](http://localhost:3000/docs-json) | ||
|
||
5. (optional) husky 설정 | ||
```bash | ||
# husky 초기화 | ||
npm run prepare | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { CustomNamingStrategy } from '@app/common'; | ||
import { DataSource } from 'typeorm'; | ||
|
||
export default new DataSource({ | ||
type: 'postgres', | ||
namingStrategy: new CustomNamingStrategy(), | ||
host: process.env.DATABASE_HOST, | ||
port: +process.env.DATABASE_PORT, | ||
username: process.env.DATABASE_USER, | ||
password: process.env.DATABASE_PASSWORD, | ||
database: process.env.DATABASE_NAME, | ||
logging: process.env.DATABASE_LOG as any, | ||
entities: [`${__dirname}/../src/entity/**/*.entity{.ts,.js}`], | ||
migrations: [`${__dirname}/**/local/*{.ts,.js}`], | ||
migrationsTableName: 'migrations', | ||
extra: { | ||
timezone: 'Asia/Seoul', | ||
}, | ||
}); |
Oops, something went wrong.