Created complete API documentation covering all 37 endpoints with detailed examples, schemas, and integration guides for News Engine Console backend. Documentation Features: - Complete endpoint reference for 5 API groups (Users, Keywords, Pipelines, Applications, Monitoring) - Request/Response schemas with JSON examples for all endpoints - cURL command examples for every endpoint - Authentication flow and JWT token usage guide - Error codes and handling examples - Integration examples in 3 languages: Python, Node.js, Browser/Fetch - Permission matrix showing required roles for each endpoint - Query parameter documentation with defaults and constraints Helper Scripts: - fix_objectid.py: Automated script to add ObjectId to string conversions across all service files (applied 20 changes to 3 service files) Testing Status: - All 37 endpoints tested and verified (100% success rate) - Test results show: * Users API: 4 endpoints working (admin user, stats, list, login) * Keywords API: 8 endpoints working (CRUD + toggle + stats) * Pipelines API: 11 endpoints working (CRUD + start/stop/restart + logs + config) * Applications API: 7 endpoints working (CRUD + secret regeneration) * Monitoring API: 8 endpoints working (health, metrics, logs, DB stats, performance) File Statistics: - API_DOCUMENTATION.md: 2,058 lines, 44KB - fix_objectid.py: 97 lines, automated ObjectId conversion helper Benefits: - Frontend developers can integrate with clear examples - All endpoints documented with real request/response examples - Multiple language examples for easy adoption - Comprehensive permission documentation for security 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
News Engine Console
뉴스 파이프라인 관리 및 모니터링 통합 콘솔 시스템
프로젝트 개요
News Engine Console은 뉴스 파이프라인의 전체 lifecycle을 관리하고 모니터링하는 통합 관리 시스템입니다.
핵심 기능
- 키워드 관리 - 파이프라인 키워드 CRUD, 활성화/비활성화
- 파이프라인 모니터링 - 파이프라인별 처리 수량, 활용도 통계
- 파이프라인 제어 - 스텝별 시작/중지, 스케줄링
- 로깅 시스템 - 파이프라인 상태 로그, 에러 추적
- 사용자 관리 - User CRUD, 역할 기반 권한 (Admin/Editor/Viewer)
- 애플리케이션 관리 - OAuth2/JWT 기반 Application CRUD
- 시스템 모니터링 - 서비스 헬스체크, 리소스 사용량
기술 스택
Backend
- FastAPI (Python 3.11)
- Motor (MongoDB async driver)
- Redis (캐싱, Pub/Sub)
- JWT + OAuth2 인증
Frontend (예정)
- React 18 + TypeScript
- Material-UI v7
- React Query
- Recharts (통계 차트)
Infrastructure
- Docker
- Kubernetes
- MongoDB (ai_writer_db)
- Redis
프로젝트 구조
services/news-engine-console/
├── README.md
├── TODO.md # 상세 구현 계획
├── backend/
│ ├── Dockerfile
│ ├── requirements.txt
│ ├── main.py
│ ├── .env.example
│ └── app/
│ ├── api/ # API 엔드포인트
│ │ ├── keywords.py # ✅ 키워드 관리
│ │ ├── pipelines.py # ✅ 파이프라인 제어/모니터링
│ │ ├── users.py # ✅ 사용자 관리
│ │ ├── applications.py # ✅ Application 관리
│ │ └── monitoring.py # ✅ 시스템 모니터링
│ ├── core/ # 핵심 설정
│ │ ├── config.py # ✅ 설정 관리
│ │ ├── database.py # ✅ MongoDB 연결
│ │ └── auth.py # ✅ JWT/OAuth2 인증
│ ├── models/ # 데이터 모델 (TODO)
│ ├── services/ # 비즈니스 로직 (TODO)
│ └── schemas/ # Pydantic 스키마 (TODO)
├── frontend/ # TODO
│ └── src/
│ ├── api/
│ ├── components/
│ ├── pages/
│ └── types/
└── k8s/ # TODO
├── namespace.yaml
├── backend-deployment.yaml
├── frontend-deployment.yaml
└── service.yaml
현재 구현 상태
✅ 완료
- 프로젝트 디렉토리 구조
- Backend 기본 설정 (config, database, auth)
- API 라우터 기본 구조 (5개 라우터)
- Keywords API
- Pipelines API
- Users API
- Applications API
- Monitoring API
🚧 진행 중
- Backend 상세 구현 (models, services, schemas)
- MongoDB 컬렉션 및 인덱스 설계
- Redis 연결 및 캐싱 로직
📋 예정
- Frontend 구현
- Dockerfile 작성
- Kubernetes 배포 설정
- CI/CD 파이프라인
- API 문서 (OpenAPI/Swagger)
API 엔드포인트
Keywords API (/api/v1/keywords)
GET /- 키워드 목록 조회POST /- 키워드 생성PUT /{keyword_id}- 키워드 수정DELETE /{keyword_id}- 키워드 삭제
Pipelines API (/api/v1/pipelines)
GET /- 파이프라인 목록 및 상태GET /{pipeline_id}/stats- 파이프라인 통계POST /{pipeline_id}/start- 파이프라인 시작POST /{pipeline_id}/stop- 파이프라인 중지
Users API (/api/v1/users)
GET /- 사용자 목록POST /- 사용자 생성GET /me- 현재 사용자 정보
Applications API (/api/v1/applications)
GET /- Application 목록POST /- Application 생성 (OAuth2 클라이언트 등록)
Monitoring API (/api/v1/monitoring)
GET /system- 시스템 상태GET /logs- 파이프라인 로그
로컬 개발 환경 설정
Prerequisites
- Python 3.11+
- MongoDB (localhost:27017)
- Redis (localhost:6379)
Backend 실행
cd services/news-engine-console/backend
# 가상환경 생성 (선택)
python3 -m venv venv
source venv/bin/activate
# 의존성 설치
pip install -r requirements.txt
# 환경 변수 설정
cp .env.example .env
# .env 파일 수정
# 서버 실행
python main.py
서버 실행 후: http://localhost:8100/docs (Swagger UI)
환경 변수
# MongoDB
MONGODB_URL=mongodb://localhost:27017
DB_NAME=ai_writer_db
# Redis
REDIS_URL=redis://localhost:6379
# JWT
SECRET_KEY=your-secret-key-here
ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
# Service
SERVICE_NAME=news-engine-console
API_V1_STR=/api/v1
PORT=8100
# CORS
ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3100
다음 단계 (TODO.md 참조)
Phase 1: Backend 완성 (우선순위 높음)
-
MongoDB 스키마 설계
- keywords 컬렉션
- pipelines 컬렉션
- users 컬렉션
- applications 컬렉션
- logs 컬렉션
-
Pydantic 모델 및 스키마 작성
- Request/Response 모델
- 유효성 검증
-
비즈니스 로직 구현
- KeywordService
- PipelineService
- UserService
- ApplicationService
- MonitoringService
-
Redis 통합
- 캐싱 레이어
- Pub/Sub for real-time updates
Phase 2: Frontend 구현
- React 프로젝트 설정
- Material-UI 레이아웃
- 페이지 구현
- Dashboard (통계 요약)
- Keywords Management
- Pipelines Control
- Users Management
- Applications Management
- System Monitoring
Phase 3: 배포
- Dockerfile 작성
- Kubernetes 매니페스트
- CI/CD 설정
데이터베이스 설계 (Draft)
keywords 컬렉션
{
"_id": "ObjectId",
"keyword": "string",
"category": "string",
"status": "active|inactive",
"created_at": "datetime",
"updated_at": "datetime",
"created_by": "user_id"
}
pipelines 컬렉션
{
"_id": "ObjectId",
"name": "string",
"type": "rss|translation|image",
"status": "running|stopped|error",
"config": {},
"stats": {
"total_processed": 0,
"success_count": 0,
"error_count": 0,
"last_run": "datetime"
}
}
users 컬렉션
{
"_id": "ObjectId",
"username": "string",
"email": "string",
"hashed_password": "string",
"full_name": "string",
"role": "admin|editor|viewer",
"disabled": false,
"created_at": "datetime"
}
역할 기반 권한
- Admin: 모든 기능 접근
- Editor: 키워드/파이프라인 관리, 모니터링 조회
- Viewer: 조회만 가능
기여 가이드
- 기능 구현 전 TODO.md 확인
- API 엔드포인트 추가 시 문서 업데이트
- 테스트 코드 작성
- Commit 메시지 규칙 준수
라이선스
Part of Site11 Platform - Internal Use
최종 업데이트: 2024-01-15 버전: 0.1.0 (Alpha) 작성자: Site11 Development Team