Skip to content

ShinChapter/shinchapter-backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Project banner

ShinChapter • Backend

ShinChapter 프로젝트의 백엔드 API 서버로, FastAPI와 PostgreSQL 기반의 인증·그룹·앨범·AI 캐릭터 생성 관리 기능을 제공합니다.


핵심 기능

  • 대학 이메일 기반 로그인: Google OAuth + JWT 인증, 신규 사용자 온보딩
  • 그룹 & 초대 관리: 그룹 생성, 학번으로 친구 초대, 수락/거절, 탈퇴
  • 앨범 기능: 사진 업로드, 앨범 리스트, 최종 5장 확정 저장
  • 캐릭터 관리: AI 서버와 연동해 캐릭터 생성 요청/상태 조회/다운로드
  • 정적 파일 제공: 업로드 이미지·최종 산출물(/uploads, /static) 서빙

Tech Stack (Backend)

Framework & Language FastAPI Python

Database & ORM PostgreSQL SQLAlchemy

Server Uvicorn


빠른 시작

1) 준비물

  • Python 3.9+
  • PostgreSQL 데이터베이스 (로컬/클라우드)
  • .env 환경 변수 파일 (Google OAuth, DB URL, 프론트엔드 리다이렉트 URI 등)

2) 의존성 설치

pip install -r requirements.txt

3) 데이터베이스 초기화

# Alembic 마이그레이션 적용
alembic upgrade head

4) 서버 실행

uvicorn main:app --host 0.0.0.0 --port 8000 --reload

API 개요

인증

  • GET /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/    # 정적 파일 디렉터리

Backend Architecture (Overview)

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
Loading

Character Create – Request Flow

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)
Loading

라이선스 & Credits

  • 이 백엔드는 ShinChapter 프로젝트의 일부로, FastAPI + PostgreSQL 기반 API 서버입니다.
  • AI 캐릭터 생성은 ShinChapter AI 서비스와 연동됩니다.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages