Refactor: Next.js+Firebase → React(Vite) + FastAPI + PostgreSQL
- 백엔드: FastAPI + SQLAlchemy(async) + PostgreSQL, 별도 워커(APScheduler) - 프론트: React 19 + Vite + TS + Tailwind v4 (기존 UI 이식, API 연동) - docker-compose: db · api · worker · frontend 일괄 실행 - 경기 일정: openfootball 매일 09:00 크롤링 → DB upsert (신규 경기 자동 삽입+예측 생성) - AI 예측: GPT·Claude·Gemini 실 API 매일 생성 → DB 저장 → 조회 (목데이터 제거) - 투표창: 오픈 킥오프 D-2 / 마감 킥오프 1시간 전, lockAt 백엔드 전달→프론트 카운트다운 - 채점/리더보드: docs/SCORING.md 기준 누적 포인트 - crowd: 0 시작, 실제 제출로만 증분 - 구 Next.js/Firebase 파일 제거, README/AGENTS 갱신 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
35414a8d47
commit
6ffe0dfca3
95 files changed
+5266
-8856
No files matched your search
@@ -1,5 +1,46 @@
|
||||
<!-- BEGIN:nextjs-agent-rules -->
|
||||
# This is NOT the Next.js you know
|
||||
# TriplePick — 아키텍처 (에이전트용 안내)
|
||||
|
||||
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` before writing any code. Heed deprecation notices.
|
||||
<!-- END:nextjs-agent-rules -->
|
||||
"AI(GPT·Claude·Gemini) vs 너" 글로벌 축구 승부예측 서비스. 모바일 우선.
|
||||
|
||||
## 스택 (2026 리팩토링)
|
||||
- **frontend/** — React 19 + Vite + TypeScript + Tailwind v4, react-router. nginx 정적 서빙.
|
||||
- **backend/** — Python FastAPI + SQLAlchemy(async) + PostgreSQL. 별도 워커(APScheduler).
|
||||
- **docker-compose.yml** (루트) — db · api · worker · frontend 를 한 번에 실행.
|
||||
|
||||
## 디렉토리
|
||||
```
|
||||
backend/app/
|
||||
config.py 설정(.env): DB·투표윈도우·스케줄러시각·외부키
|
||||
database.py async 엔진/세션, init_db
|
||||
models.py ORM: matches / ai_predictions / crowd_stats / user_predictions
|
||||
schemas.py Pydantic API 계약 (프론트 lib/types.ts 와 정합)
|
||||
scoring.py 채점(docs/SCORING.md SSOT) + 임직원 배제
|
||||
schedule_data.py 경기 일정 SSOT (Group A 6경기, KST)
|
||||
seed_data.py 부트스트랩(결정론적) 예측/crowd 생성기
|
||||
seed.py DB 시드 (idempotent)
|
||||
domain.py phase 계산 + ORM→응답 직렬화
|
||||
services/ ai.py(3모델 실연동) · email.py(SMTP) · grading.py
|
||||
routers/ matches · predictions · leaderboard · admin
|
||||
main.py FastAPI 앱(API)
|
||||
worker.py APScheduler 워커(상태전이·AI생성·결과메일)
|
||||
frontend/src/
|
||||
lib/ types · i18n · format · api(백엔드 호출) · useLang
|
||||
components/ Hero · MatchupHUD · Arena · ScheduleBoard · TeamFlag · …
|
||||
pages/ Dashboard · MatchDetail · Leaderboard · NotFound
|
||||
```
|
||||
|
||||
## 시간/스케줄 규칙 (워커가 자동 처리)
|
||||
- 투표 오픈 = 킥오프 − 48h(D-2, `VOTE_OPEN_HOURS_BEFORE`)
|
||||
- 투표 마감 = 킥오프 정각(`VOTE_LOCK_MINUTES_BEFORE=0`)
|
||||
- 상태 전이: scheduled → open → locked → finished (`STATUS_TICK_SECONDS` 주기)
|
||||
- AI 예측 생성: 매일 KST `AI_GENERATE_HOUR:MINUTE` (실 LLM API 호출)
|
||||
- 결과 메일: 경기 종료 후 `RESULT_EMAIL_DELAY_MINUTES`(기본 180=3h) 경과 시 발송
|
||||
- `DEMO_FORCE_OPEN=true` 면 마감 전까지 항상 투표 가능(운영 시 false)
|
||||
|
||||
## SSOT 문서
|
||||
- `docs/SCORING.md` — 채점·심사(100만원) 단일 기준
|
||||
- `docs/DESIGN.md` — 룩앤필/디자인 토큰 (변경 시 먼저 갱신)
|
||||
- `docs/BACKEND.md` — 초기 백엔드 설계 메모(원본 Firebase 기준 — 현 구현은 FastAPI)
|
||||
|
||||
## 실행
|
||||
`cp backend/.env.example backend/.env` → 키 채우기 → `docker compose up --build` → http://localhost:8080
|
||||
Reference in new issue
Block a user