Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
58e2232
feat(db): Balance에 coin_amount, Coin에 is_deleted 컬럼 추가
rookedsysc Nov 21, 2025
a148d6b
feat(model): Balance와 Coin 모델 컬럼 추가
rookedsysc Nov 21, 2025
092f4e6
feat(upbit): 업비트 API 연동 모듈 추가
rookedsysc Nov 21, 2025
8027685
feat(coin): 코인 관리 API 추가
rookedsysc Nov 21, 2025
1448191
feat(router): API 라우터 설정 및 엔드포인트 등록
rookedsysc Nov 21, 2025
48871b1
feat(ai): OpenAI 기반 비트코인 분석 모듈 추가
rookedsysc Nov 21, 2025
b4419fe
refactor(upbit): Upbit 클라이언트 리팩토링 및 DI 패턴 적용
rookedsysc Nov 21, 2025
af745d6
feat(scheduler): APScheduler 기반 스케줄러 추가
rookedsysc Nov 21, 2025
c10ef86
feat(trade): RiskLevel enum에 NONE 값 추가
rookedsysc Nov 21, 2025
8d18d34
feat(coin): 코인 리포지토리 및 라우터 개선
rookedsysc Nov 21, 2025
aaa5b06
feat(trade): HOLD 결정 시 거래 기록 추가 및 TradeType enum 확장
rookedsysc Nov 21, 2025
d3c16a6
feat(trade): Trade 모델 확장 및 거래 API 추가
rookedsysc Nov 21, 2025
13f24d6
feat(scheduler): 자동 거래 스케줄러 작업 추가
rookedsysc Nov 21, 2025
f4307b6
feat(coin): 코인 삭제 시 잔고 확인 로직 추가
rookedsysc Nov 21, 2025
977f44e
style: 코드 포맷팅 및 import 정리
rookedsysc Nov 21, 2025
48fba29
chore: .gitignore에 AI 도구 관련 파일 추가
rookedsysc Nov 21, 2025
230ac1e
build: 의존성 및 설정 파일 업데이트
rookedsysc Nov 21, 2025
e50b7b8
chore: .gitignore에 Gemini 관련 파일 추가
rookedsysc Nov 21, 2025
1545cd7
build(docker): Docker 환경 설정 추가
rookedsysc Nov 21, 2025
9a4faf4
test: 테스트 환경 구성 추가
rookedsysc Nov 21, 2025
be25194
refactor(scheduler): 스케줄러 작업 함수 분리
rookedsysc Nov 21, 2025
d46c9a6
feat(trade): 거래 내역 조회에 Cursor 기반 페이지네이션 추가
rookedsysc Nov 21, 2025
7ae8ed7
docs: README 전체 문서화 업데이트
rookedsysc Nov 21, 2025
111c632
ci: GitHub Actions CI/CD 파이프라인 추가
rookedsysc Nov 21, 2025
b6586af
ci(backend): pip에서 uv로 패키지 관리자 변경
rookedsysc Nov 21, 2025
de737e9
chore: .gitignore에 Claude 설정 파일 추가
rookedsysc Nov 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/backend-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Backend Tests

on:
push:
branches: ["*"]
paths:
- "backend/**"
pull_request:
branches: ["*"]
paths:
- "backend/**"

permissions:
contents: read
pull-requests: write
issues: write
checks: write

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]

defaults:
run:
working-directory: backend

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Cache uv packages
uses: actions/cache@v3
with:
path: ~/.cache/uv
key: ${{ runner.os }}-uv-${{ hashFiles('backend/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-uv-

- name: Install dependencies
run: |
uv sync --all-groups

- name: Run tests with pytest
run: |
uv run pytest -v --tb=short --cov=app --cov-report=xml --cov-report=term --junitxml=pytest.xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./backend/coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

- name: Pytest coverage comment
if: github.event_name == 'pull_request'
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-xml-coverage-path: ./backend/coverage.xml
junitxml-path: ./backend/pytest.xml
title: Backend 테스트 커버리지 리포트
badge-title: 커버리지
hide-badge: false
hide-report: false
create-new-comment: false
hide-comment: false
report-only-changed-files: false
coverage-path-prefix: backend/app/

lint:
runs-on: ubuntu-latest

defaults:
run:
working-directory: backend

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install uv
uses: astral-sh/setup-uv@v3

- name: Install dependencies
run: |
uv sync --all-groups

- name: Run ruff
run: |
uv run ruff check . || true
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ wheels/

**/.claude/**
**CLAUDE.md**
GEMINI.md
.gemini
CLAUDE.md
.claude
Binary file added backend/.coverage
Binary file not shown.
47 changes: 47 additions & 0 deletions backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
venv/
ENV/
.venv

# uv
.uv/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~

# Environment
.env
.env.local

# Testing
.pytest_cache/
.coverage
htmlcov/

# Documentation
*.md
!README.md

# Git
.git/
.gitignore

# Alembic
alembic/versions/__pycache__/

# Logs
*.log

# Others
.DS_Store
Thumbs.db
25 changes: 16 additions & 9 deletions backend/.env.example
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
UPBIT_ACCESS_KEY=
UPBIT_SECRET_KEY=
OPENAI_API_KEY=
# Upbit API
UPBIT_ACCESS_KEY=your_upbit_access_key
UPBIT_SECRET_KEY=your_upbit_secret_key

# OpenAI API
OPENAI_API_KEY=your_openai_api_key

# FastAPI
APP_NAME=
APP_VERSION=
DATABASE_URL=
DB_POOL_SIZE=
DB_MAX_OVERFLOW=
CORS_ORIGINS=
APP_NAME=joo-coin
APP_VERSION=0.1.0

# Database (Docker 환경용 기본값)
DATABASE_URL=mysql+asyncmy://root:1234@joo-coin-db:3306/joo_coin_db
DB_POOL_SIZE=5
DB_MAX_OVERFLOW=10

# CORS (개발 환경용 기본값)
CORS_ORIGINS=http://localhost:3000,http://localhost:8000
4 changes: 4 additions & 0 deletions backend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.idea/
.DS_Store
GEMINI.md
.gemini
CLAUDE.md
.claude
68 changes: 68 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Stage 1: Builder - 의존성 설치
FROM python:3.11-slim as builder

# 빌드 도구 설치 (C 확장 모듈 빌드용)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
python3-dev \
default-libmysqlclient-dev && \
rm -rf /var/lib/apt/lists/*

# uv 설치
COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv

# 작업 디렉토리 설정
WORKDIR /app

# Python 환경변수 설정
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
UV_COMPILE_BYTECODE=1 \
UV_LINK_MODE=copy

# 의존성 파일 복사
COPY pyproject.toml uv.lock ./

# 의존성 설치 (가상환경에 설치)
RUN uv sync --frozen --no-dev

# Stage 2: Runtime - 실행 환경
FROM python:3.11-slim

# 런타임 라이브러리 설치 (C 확장 모듈 실행용)
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libmariadb3 && \
rm -rf /var/lib/apt/lists/*

# 작업 디렉토리 설정
WORKDIR /app

# Python 환경변수 설정
ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
PATH="/app/.venv/bin:$PATH"

# 비루트 사용자 생성
RUN useradd -m -u 1000 appuser && \
chown -R appuser:appuser /app

# builder에서 가상환경 복사
COPY --from=builder --chown=appuser:appuser /app/.venv /app/.venv

# 애플리케이션 코드 복사
COPY --chown=appuser:appuser . .

# 비루트 사용자로 전환
USER appuser

# 포트 노출
EXPOSE 8000

# 헬스체크
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import requests; requests.get('http://localhost:8000/health', timeout=5)"

# 애플리케이션 실행
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
Loading