|
1 | | -<p align="center"> |
2 | | - <a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a> |
3 | | -</p> |
4 | | - |
5 | | -[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456 |
6 | | -[circleci-url]: https://circleci.com/gh/nestjs/nest |
7 | | - |
8 | | - <p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p> |
9 | | - <p align="center"> |
10 | | -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a> |
11 | | -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a> |
12 | | -<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a> |
13 | | -<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a> |
14 | | -<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a> |
15 | | -<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a> |
16 | | -<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a> |
17 | | - <a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a> |
18 | | - <a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a> |
19 | | - <a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a> |
20 | | -</p> |
21 | | - <!--[](https://opencollective.com/nest#backer) |
22 | | - [](https://opencollective.com/nest#sponsor)--> |
23 | | - |
24 | | -## Description |
25 | | - |
26 | | -[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository. |
27 | | - |
28 | | -## Project setup |
29 | | - |
30 | | -```bash |
31 | | -$ npm install |
32 | | -``` |
33 | | - |
34 | | -## Compile and run the project |
35 | | - |
36 | | -```bash |
37 | | -# development |
38 | | -$ npm run start |
39 | | - |
40 | | -# watch mode |
41 | | -$ npm run start:dev |
42 | | - |
43 | | -# production mode |
44 | | -$ npm run start:prod |
45 | | -``` |
46 | | - |
47 | | -## Run tests |
48 | | - |
49 | | -```bash |
50 | | -# unit tests |
51 | | -$ npm run test |
52 | | - |
53 | | -# e2e tests |
54 | | -$ npm run test:e2e |
55 | | - |
56 | | -# test coverage |
57 | | -$ npm run test:cov |
58 | | -``` |
59 | | - |
60 | | -## Deployment |
61 | | - |
62 | | -When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information. |
63 | | - |
64 | | -If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps: |
65 | | - |
66 | | -```bash |
67 | | -$ npm install -g @nestjs/mau |
68 | | -$ mau deploy |
| 1 | +## Challenge API |
| 2 | + |
| 3 | +### 개요 |
| 4 | +- Challenge API는 챌린지 기능을 관리하는 NestJS 기반 REST API입니다. |
| 5 | +- 단일 EC2 환경에서 **API 개발부터 CI/CD 파이프라인 구성, 서버 배포까지의 전체 흐름을 경험**하는 것을 목표로 개발했습니다. |
| 6 | +- CI/CD 자동화, 마이그레이션 실행 전략, 헬스 체크 기반 배포 검증 등 |
| 7 | + **운영 관점에서의 의사결정과 구조 설계**에 중점을 두었습니다. |
| 8 | +- 현재 서버는 종료된 상태입니다. (2025.12.30 기준) |
| 9 | + |
| 10 | +### 기술 스택 |
| 11 | +| 구분 | 기술 | |
| 12 | +| --- | --- | |
| 13 | +| Programming Language | Node.js 20.15.1 | |
| 14 | +| Framework | NestJS 11.0.6 | |
| 15 | +| Database | MariaDB 10.6 | |
| 16 | +| ORM | TypeORM | |
| 17 | +| Testing | Jest | |
| 18 | +| Version Control | Git | |
| 19 | +| Cloud | AWS (EC2, RDS, S3, CodeDeploy, Parameter Store) | |
| 20 | +| CI/CD | GitHub Actions, CodeDeploy | |
| 21 | +| Process Manager | PM2 | |
| 22 | +| API | RESTful API | |
| 23 | + |
| 24 | + |
| 25 | +### 시스템 구성 |
| 26 | +- EC2 단일 인스턴스 환경 |
| 27 | +- RDS(MariaDB) 사용 |
| 28 | +- GitHub Actions → S3 → CodeDeploy 기반 배포 |
| 29 | + |
| 30 | +### CI/CD 파이프라인 |
| 31 | +- **배포 방식**: All-at-Once |
| 32 | +- **배포 검증**: `/health` 엔드포인트 기반 상태 확인 |
| 33 | +- 개인 프로젝트 특성상 단일 서버 환경으로 운영하여 **마이그레이션은 CD 단계에서 실행**하도록 구성 |
| 34 | +- SCP, CodeDeploy 두가지 방식으로 연습했으며, 이에 대한 내용은 [scp](/anything/cicd_scp.md), [codeDeploy](/anything/cicd_codedeploy.md)에 기재 |
| 35 | + |
| 36 | +```text |
| 37 | +GitHub Actions |
| 38 | + ├─ Test, Build |
| 39 | + ├─ S3에 빌드 파일 업로드 |
| 40 | + └─ CodeDeploy 실행 |
| 41 | + ├─ ApplicationStop |
| 42 | + │ └─ PM2 프로세스 중지 |
| 43 | + ├─ BeforeInstall |
| 44 | + │ └─ AWS Parameter Store 기반 환경 변수 생성 |
| 45 | + ├─ AfterInstall |
| 46 | + │ ├─ 패키지 설치 |
| 47 | + │ └─ TypeORM 마이그레이션 실행 |
| 48 | + ├─ ApplicationStart |
| 49 | + │ └─ PM2 startOrReload |
| 50 | + └─ ValidateService |
| 51 | + └─ /health 엔드포인트 호출 |
69 | 52 | ``` |
70 | 53 |
|
71 | | -With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure. |
72 | | - |
73 | | -## Resources |
74 | | - |
75 | | -Check out a few resources that may come in handy when working with NestJS: |
76 | | - |
77 | | -- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework. |
78 | | -- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy). |
79 | | -- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/). |
80 | | -- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks. |
81 | | -- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com). |
82 | | -- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com). |
83 | | -- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs). |
84 | | -- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com). |
85 | | - |
86 | | -## Support |
87 | | - |
88 | | -Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support). |
89 | | - |
90 | | -## Stay in touch |
91 | | - |
92 | | -- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec) |
93 | | -- Website - [https://nestjs.com](https://nestjs.com/) |
94 | | -- Twitter - [@nestframework](https://twitter.com/nestframework) |
95 | | - |
96 | | -## License |
97 | | - |
98 | | -Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE). |
| 54 | +### 주요 구현 기능 |
| 55 | +- 인증 |
| 56 | + - JWT + Passport 기반 인증 처리 |
| 57 | + - Access Token 기반 API 보호 |
| 58 | +- 데이터베이스 |
| 59 | + - TypeORM Entity 구성 |
| 60 | + - 마이그레이션 파일 기반 스키마 관리 |
| 61 | +- 테스트 |
| 62 | + - Jest 기반 서비스 레이어 유닛 테스트 |
| 63 | + - E2E 테스트를 통한 API 흐름 검증 |
| 64 | +- Health Check |
| 65 | + - /health 엔드포인트 제공 |
| 66 | + - 배포 성공/실패 판단 기준으로 활용 |
| 67 | + |
| 68 | +### 의도적 선택 및 제한 사항 |
| 69 | +- 마이그레이션 중복 방지 미구현 |
| 70 | + - 단일 서버 환경에서 운영하므로, CD 단계에서 1회 실행하는 방식으로 관리 |
| 71 | + - 멀티 인스턴스 환경에서 필요한 중복 방지 로직은 범위에서 제외 |
| 72 | +- Prometheus & Grafana 미적용 |
| 73 | + - 단일 EC2 환경에서는 CloudWatch로 기본적인 서버 상태 확인이 가능하다고 판단 |
| 74 | + |
| 75 | +### 회고 |
| 76 | +- 실무에서 경험은 있었지만 개념적으로 불명확했던 부분들을 공식 문서와 직접 실습을 통해 다시 정리하는 계기가 되었다. |
| 77 | +- 생성형 AI를 보조 수단으로 활용하면서, OOP, TypeScript, Shell Script와 같은 기본 개념에 대한 이해가 있어야 AI의 결과를 판단하고 설계에 반영할 수 있다는 점을 체감했다. |
0 commit comments