Create comprehensive news pipeline management and monitoring system with backend API structure and detailed implementation roadmap. Core Features (7): 1. Keyword Management - Pipeline keyword CRUD and control 2. Pipeline Monitoring - Processing stats and utilization metrics 3. Pipeline Control - Step-wise start/stop and scheduling 4. Logging System - Pipeline status logs and error tracking 5. User Management - User CRUD with role-based access (Admin/Editor/Viewer) 6. Application Management - OAuth2/JWT-based Application CRUD 7. System Monitoring - Service health checks and resource monitoring Technology Stack: - Backend: FastAPI + Motor (MongoDB async) + Redis - Frontend: React 18 + TypeScript + Material-UI v7 (planned) - Auth: JWT + OAuth2 - Infrastructure: Docker + Kubernetes Project Structure: - backend/app/api/ - 5 API routers (keywords, pipelines, users, applications, monitoring) - backend/app/core/ - Core configurations (config, database, auth) - backend/app/models/ - Data models (planned) - backend/app/services/ - Business logic (planned) - backend/app/schemas/ - Pydantic schemas (planned) - frontend/ - React application (planned) - k8s/ - Kubernetes manifests (planned) Documentation: - README.md - Project overview, current status, API endpoints, DB schema - TODO.md - Detailed implementation plan for next sessions Current Status: ✅ Project structure initialized ✅ Backend basic configuration (config, database, auth) ✅ API router skeletons (5 routers) ✅ Requirements and environment setup 🚧 Models, services, and schemas pending 📋 Frontend implementation pending 📋 Docker and Kubernetes deployment pending Next Steps (See TODO.md): 1. MongoDB schema and indexes 2. Pydantic schemas with validation 3. Service layer implementation 4. Redis integration 5. Login/authentication API 6. Frontend basic setup This provides a solid foundation for building a comprehensive news pipeline management console system. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
from contextlib import asynccontextmanager
|
|
import uvicorn
|
|
|
|
from app.core.config import settings
|
|
from app.core.database import connect_to_mongo, close_mongo_connection
|
|
from app.api import keywords, pipelines, users, applications, monitoring
|
|
|
|
@asynccontextmanager
|
|
async def lifespan(app: FastAPI):
|
|
# Startup
|
|
await connect_to_mongo()
|
|
yield
|
|
# Shutdown
|
|
await close_mongo_connection()
|
|
|
|
app = FastAPI(
|
|
title="News Engine Console API",
|
|
description="뉴스 파이프라인 관리 및 모니터링 시스템",
|
|
version="1.0.0",
|
|
lifespan=lifespan
|
|
)
|
|
|
|
# CORS
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=settings.ALLOWED_ORIGINS,
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
# Health check
|
|
@app.get("/health")
|
|
async def health_check():
|
|
return {"status": "healthy", "service": settings.SERVICE_NAME}
|
|
|
|
# Include routers
|
|
app.include_router(keywords.router, prefix=f"{settings.API_V1_STR}/keywords", tags=["Keywords"])
|
|
app.include_router(pipelines.router, prefix=f"{settings.API_V1_STR}/pipelines", tags=["Pipelines"])
|
|
app.include_router(users.router, prefix=f"{settings.API_V1_STR}/users", tags=["Users"])
|
|
app.include_router(applications.router, prefix=f"{settings.API_V1_STR}/applications", tags=["Applications"])
|
|
app.include_router(monitoring.router, prefix=f"{settings.API_V1_STR}/monitoring", tags=["Monitoring"])
|
|
|
|
if __name__ == "__main__":
|
|
uvicorn.run(
|
|
"main:app",
|
|
host="0.0.0.0",
|
|
port=settings.PORT,
|
|
reload=True
|
|
)
|