ShinChapter 프로젝트의 백엔드 API 서버로, FastAPI와 PostgreSQL 기반의 인증·그룹·앨범·AI 캐릭터 생성 관리 기능을 제공합니다.
- 대학 이메일 기반 로그인: Google OAuth + JWT 인증, 신규 사용자 온보딩
- 그룹 & 초대 관리: 그룹 생성, 학번으로 친구 초대, 수락/거절, 탈퇴
- 앨범 기능: 사진 업로드, 앨범 리스트, 최종 5장 확정 저장
- 캐릭터 관리: AI 서버와 연동해 캐릭터 생성 요청/상태 조회/다운로드
- 정적 파일 제공: 업로드 이미지·최종 산출물(
/uploads,/static) 서빙
- Python 3.9+
- PostgreSQL 데이터베이스 (로컬/클라우드)
.env환경 변수 파일 (Google OAuth, DB URL, 프론트엔드 리다이렉트 URI 등)
pip install -r requirements.txt# Alembic 마이그레이션 적용
alembic upgrade headuvicorn main:app --host 0.0.0.0 --port 8000 --reloadGET /login/google– Google OAuth 시작GET /auth/callback– OAuth 콜백 처리- JWT 발급 및
/me로 유저 정보 제공
POST /group/create– 그룹 생성POST /group/invite– 그룹 초대POST /group/respond– 초대 수락/거절GET /group/{group_id}– 그룹 상세 조회POST /album-group/leave– 그룹 탈퇴
POST /album/upload– 사진 업로드GET /album/list– 앨범 목록POST /album/save-selected– 최종 5장 저장GET /album/final-list– 확정된 이미지 조회
POST /character/create– AI 서버에 캐릭터 생성 요청GET /character/status/{job_id}– 작업 상태 조회GET /character/my– 내 캐릭터 정보 조회
backend/
├─ main.py # FastAPI 앱 초기화, 라우터 등록, CORS/정적 설정
├─ auth.py # OAuth, JWT 인증 관련 라우터
├─ user.py # 유저 정보 조회/삭제
├─ group.py, friend.py # 그룹, 초대, 친구 관리
├─ album.py # 앨범 사진 업로드/관리
├─ character.py # 캐릭터 생성/상태/조회
├─ utils.py # 파일 저장, 유틸 함수
├─ base_models.py # 공통 DB 모델
├─ jobs.py # 캐릭터 생성 작업 모델
└─ static/, uploads/ # 정적 파일 디렉터리
flowchart TD
FE[Frontend] --> BE[Backend FastAPI]
DB[(PostgreSQL)]
AI[AI Service DECA-API]
OAUTH[Google OAuth]
STORE[(Static & Uploads)]
BE --> DB
BE --> STORE
FE --> STORE
BE --> AI
BE --> OAUTH
sequenceDiagram
participant FE as Frontend
participant BE as Backend FastAPI
participant ST as Storage (static/uploads)
participant AI as AI Service (DECA-API)
participant DB as PostgreSQL
FE->>BE: POST /character/create (image, hair)
BE->>ST: Save uploads
BE->>DB: Insert job (PENDING)
BE->>AI: POST /process-deca
AI-->>ST: Write GLB & PNG
AI-->>BE: 200 OK (filenames)
BE->>DB: Update job (DONE)
FE->>BE: GET /character/status/{job_id}
BE-->>FE: status + filenames
FE->>BE: GET /download/{filename}
BE-->>FE: file stream (GLB/PNG)
- 이 백엔드는 ShinChapter 프로젝트의 일부로, FastAPI + PostgreSQL 기반 API 서버입니다.
- AI 캐릭터 생성은 ShinChapter AI 서비스와 연동됩니다.
