Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ MYSQL_PASSWORD=appuser123
# Frontend / Vite
########################################
# 프록시 대상은 compose.dev.yaml의 백엔드 서비스명(backtest-be-fast)이다.
VITE_API_BASE_URL=/api
#
# VITE_API_BASE_URL은 비워 두어야 한다.
# 서비스 레이어(backtestService.ts, backtestApi.ts)가 axios에 전체 경로
# `/api/v1/...`를 그대로 넘기므로, 여기에 `/api`를 넣으면 baseURL과 겹쳐
# `/api/api/v1/backtest`가 되어 vite 프록시에 매칭되지 않고 404가 난다.
# (운영 빌드는 이 값을 주입하지 않아 자연히 빈 값이 된다)
VITE_API_BASE_URL=
API_PROXY_TARGET=http://backtest-be-fast:8000
FASTAPI_PROXY_TARGET=http://backtest-be-fast:8000
23 changes: 4 additions & 19 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,22 @@

**라고할때살걸** — Korean trading strategy backtesting platform (SMA, RSI, MACD, Bollinger, EMA, Buy&Hold). Supports portfolios, DCA, rebalancing.

**Stack:** Python 3.11 / FastAPI | TypeScript / React / Vite | MySQL 8.0 (prod) / SQLite (tests) | Docker Compose | Jenkins CI/CD

## Commands

```bash
# BE tests (no DB)
pytest backtest_be_fast/tests/unit -v

# FE
cd backtest_fe && npm run dev | npm run build | npm test

# Docker (full stack)
docker compose -f compose.dev.yaml up -d --build
docker compose -f compose.dev.yaml exec backtest-be-fast pytest tests/unit -v
docker compose -f compose.dev.yaml exec backtest-fe npm test
```

**URLs:** FE http://localhost:5173 | BE Docs http://localhost:8000/docs

## Architecture

**BE flow:** `FastAPI Endpoint → PortfolioManagerService → BacktestEngine / StrategyService / StockRepository → UnifiedDataService`

**FE (Feature-Sliced Design):** `shared` ← `features` ← `pages` (no reverse imports). State: Zustand (global) + `useReducer` (forms). UI: shadcn/ui + Tailwind + Recharts.

**DB:** `stocks`, `daily_prices`, `stock_news` (see `database/schema.sql`)
**DB schema:** see `database/schema.sql`

**API:** POST `/api/v1/backtest` — main endpoint. Errors: `@handle_portfolio_errors` decorator.

Expand All @@ -49,21 +39,16 @@ docker compose -f compose.dev.yaml exec backtest-fe npm test

## Sub-Agent Usage

When working on this codebase, **actively use specialized sub-agents** for better quality:
- **`frontend-developer`** for React/TypeScript component changes
- **`python-pro` / `fastapi-pro`** for BE service/API changes
- **`test-automator`** for writing tests
- **`code-reviewer` / `architect-review`** for reviewing changes before finalizing
- **`debugger`** when encountering errors
- **`Explore`** agent for broad codebase research
- **`Explore`** for broad codebase research (where does X live, how is Y wired)
- **`Plan`** for designing multi-step changes before writing code
- **`general-purpose`** for multi-step research/edit tasks that need their own context

Always verify changes in Docker containers (`docker compose exec`) before declaring work complete.

## Testing

- **BE markers:** `@pytest.mark.unit` (no DB), `@pytest.mark.integration` (DB), `@pytest.mark.external` (real API)
- **FE:** Vitest + React Testing Library; Playwright for E2E
- 141 BE unit tests, 94+ FE tests

## Commit Convention

Expand Down
2 changes: 1 addition & 1 deletion backtest_fe/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"config": "",
"css": "src/index.css",
"baseColor": "slate",
"cssVariables": true,
Expand Down
Loading