diff --git a/README.md b/README.md index 495182a..cf7934d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,133 @@ -# template-java-maven +# SNP Connection Monitoring -Java + Spring Boot + Maven 프로젝트 템플릿 \ No newline at end of file +API Gateway + 모니터링 통합 플랫폼. 서비스 사용자가 모니터링 애플리케이션에 데이터를 요청할 때 API 인증키를 통해 인증하고, 모든 요청/응답 데이터를 추적/관리합니다. + +## 주요 기능 + +- **API Gateway**: API Key 인증 기반 프록시, 요청/응답 자동 로깅 +- **API Key 관리**: AES-256 암호화 발급, 신청/승인 워크플로우, Permission 관리 +- **모니터링 대시보드**: 실시간 통계 (Recharts), 30초 자동 갱신 +- **서비스 헬스체크**: 1분 간격 폴링, 90일 uptime 추적, Service Status 페이지 +- **통계 분석**: 서비스/사용자/API/테넌트/사용량 추이별 상세 통계 +- **다크/라이트 모드**: 전체 UI 테마 지원 + +## 기술 스택 + +| 구분 | 기술 | +|------|------| +| Backend | Java 17, Spring Boot 3.2.1, Spring Data JPA, Spring Security (JWT) | +| Frontend | React 19, TypeScript, Vite 7, Tailwind CSS 4, Recharts | +| Database | PostgreSQL (월별 Range 파티셔닝) | +| Build | Maven, frontend-maven-plugin | +| CI/CD | Gitea Actions, systemd 자동 배포 | + +## 서버 설정 + +| 항목 | 값 | +|------|-----| +| 포트 | 8042 | +| Context Path | /snp-connection | +| DB | PostgreSQL (snp_connection / common 스키마) | +| Swagger UI | http://localhost:8042/snp-connection/swagger-ui/index.html | + +## 빌드 및 실행 + +```bash +# JDK 설정 +sdk use java 17.0.18-amzn + +# 프론트엔드 빌드 +cd frontend && npm install && npm run build && cd .. + +# 백엔드 빌드 +mvn clean package -DskipTests -Dfrontend.skip=true + +# 로컬 실행 +mvn spring-boot:run + +# 프론트엔드 개발 서버 (별도 터미널) +cd frontend && npm run dev +``` + +## 프로젝트 구조 + +``` +snp-connection-monitoring/ +├── frontend/ # React + TypeScript 프론트엔드 +│ ├── src/ +│ │ ├── pages/ # 페이지 컴포넌트 +│ │ │ ├── DashboardPage.tsx # 대시보드 (차트, 요약 카드) +│ │ │ ├── admin/ # 관리 (서비스, 사용자, 테넌트) +│ │ │ ├── apikeys/ # API Key (신청, 관리) +│ │ │ ├── monitoring/ # 모니터링 (로그, 서비스 상태) +│ │ │ └── statistics/ # 통계 (서비스, 사용자, API, 테넌트, 사용량) +│ │ ├── services/ # API 호출 모듈 +│ │ ├── store/ # 상태 관리 (Auth, Theme) +│ │ └── types/ # TypeScript 타입 정의 +│ └── vite.config.ts +├── src/main/java/com/gcsc/connection/ +│ ├── auth/ # JWT 인증 (login, refresh) +│ ├── tenant/ # 테넌트 CRUD +│ ├── user/ # 사용자 CRUD +│ ├── service/ # 서비스/API CRUD +│ ├── apikey/ # API Key 관리 (발급, 신청, 권한) +│ ├── gateway/ # API Gateway (프록시, 인증 필터) +│ ├── monitoring/ # 모니터링 (대시보드, 헬스체크, 로그) +│ ├── statistics/ # 통계 API +│ ├── config/ # 설정 (Security, WebClient, Async) +│ └── common/ # 공통 (ApiResponse, Exception, AES) +├── docs/ +│ ├── schema/ # DB 스키마 SQL +│ └── dashboard-statistics-guide.md # 대시보드/통계 가이드 +└── .gitea/workflows/deploy.yml # CI/CD 배포 워크플로우 +``` + +## API 엔드포인트 + +### 인증 +| Method | URL | 설명 | +|--------|-----|------| +| POST | /api/auth/login | 로그인 (JWT 발급) | +| POST | /api/auth/refresh | 토큰 갱신 | + +### Gateway +| Method | URL | 설명 | +|--------|-----|------| +| ANY | /gateway/{serviceCode}/** | API Key 인증 후 대상 서비스로 프록시 | + +### 관리 API +| Method | URL | 설명 | +|--------|-----|------| +| GET/POST/PUT | /api/tenants | 테넌트 CRUD | +| GET/POST/PUT/DELETE | /api/users | 사용자 CRUD | +| GET/POST/PUT | /api/services | 서비스 CRUD | +| GET/POST | /api/services/{id}/apis | 서비스 API CRUD | + +### API Key +| Method | URL | 설명 | +|--------|-----|------| +| GET/POST | /api/keys | API Key 관리 | +| POST | /api/keys/requests | API Key 신청 | +| PUT | /api/keys/requests/{id}/review | 신청 승인/반려 | + +### 모니터링 +| Method | URL | 설명 | +|--------|-----|------| +| GET | /api/dashboard/* | 대시보드 통계 | +| GET | /api/monitoring/logs | 요청 로그 검색 | +| GET | /api/heartbeat/status | 서비스 헬스 상태 | +| GET | /api/statistics/* | 도메인별 통계 | + +## 배치 스케줄러 + +| 배치 | 주기 | 작업 | +|------|------|------| +| HeartbeatScheduler | 매 1분 | 서비스 헬스체크 폴링 | +| PartitionManageScheduler | 매월 1일 00:00 | 파티션 생성/삭제 | +| DataCleanupScheduler | 매일 02:00 | health_log 90일 이전 삭제 | + +## 팀 규칙 + +- 코드 스타일: `.claude/rules/code-style.md` +- Git 워크플로우: `.claude/rules/git-workflow.md` +- 팀 정책: `.claude/rules/team-policy.md`