summaryrefslogtreecommitdiff
path: root/CLAUDE.md
diff options
context:
space:
mode:
authorTyler Hoang <tyler@tylerhoang.xyz>2026-06-10 00:28:09 -0700
committerTyler Hoang <tyler@tylerhoang.xyz>2026-06-10 00:28:09 -0700
commita85dc0f4b9148d945fba6b8ef751ed2139e887ab (patch)
tree1f435f79286f86374e28c1a1c3353c62484f6595 /CLAUDE.md
parentd5e321089b6b82f5425c2b3fae142db5223ce599 (diff)
Simplify deploy script and docs
Diffstat (limited to 'CLAUDE.md')
-rw-r--r--CLAUDE.md26
1 files changed, 10 insertions, 16 deletions
diff --git a/CLAUDE.md b/CLAUDE.md
index 39040f7..cbe74f6 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -10,15 +10,15 @@ Prism v2: FastAPI backend (yfinance + SQLite watchlist) + Next.js frontend (Plot
```bash
# Backend (port 8001 to avoid conflicts with other local services)
-backend/.venv/bin/uvicorn app.main:app --reload --host 127.0.0.1 --port 8001
-pytest # all backend tests
-pytest backend/tests/test_api.py # single file
+backend/.venv/bin/uvicorn app.main:app --reload --host 127.0.0.1 --port 8001 --app-dir backend
+backend/.venv/bin/pytest # all backend tests
+backend/.venv/bin/pytest backend/tests/test_api.py # single file
backend/.venv/bin/python -m py_compile backend/app/main.py backend/app/schemas.py
# Frontend (port 3001)
-NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8001 npm run dev -- --hostname 127.0.0.1 --port 3001
-npm run lint
-npm run build
+npm --prefix frontend run lint
+npm --prefix frontend run build
+NEXT_PUBLIC_API_BASE_URL=http://127.0.0.1:8001 npm --prefix frontend run dev -- --hostname 127.0.0.1 --port 3001
```
`./scripts/stack.sh {start|stop|restart|status}` runs both locally; logs in `.run/logs/`.
@@ -39,20 +39,14 @@ Key files:
## Production
-Topology: uvicorn on `127.0.0.1:8001`, `next start` on `127.0.0.1:3001`, nginx TLS reverse-proxy at `prism.tylerhoang.xyz` (`/api/` → backend, `/` → frontend). Service user `www-data`, code at `/var/www/prism-v2/`. Full deploy instructions in `README.md`.
+Topology: uvicorn on `127.0.0.1:8001`, `next start` on `127.0.0.1:3001`, optionally behind a reverse proxy of the user's choosing. Full run instructions live in `README.md`.
-**Deploy flow:** bare repo at `/srv/git/prism-v2.git`; pushing master triggers a post-receive hook that `git checkout -f`s into `/var/www/prism-v2/` and runs `scripts/deploy.sh`. `/var/www/prism-v2/` has NO `.git/` — never try to `git pull` there. Manual server-side deploy: `sudo ./scripts/deploy.sh` (`--install` also refreshes systemd units + nginx site). Sample hook lives at `scripts/post-receive.sample`.
-
-**Logs / status:**
-```bash
-sudo systemctl status prismv2-backend.service prismv2-frontend.service --no-pager
-sudo journalctl -u prismv2-backend.service -f
-```
+**Deploy flow:** `scripts/deploy.sh` is only a build/setup helper. It installs backend dependencies, runs `npm ci`, and builds the frontend so the user can start the stack themselves. It does not manage git hooks, install `systemd`, configure `nginx`, or restart services.
**Rules:**
- Browser code must NOT hardcode a localhost API base. `frontend/lib/api.ts` defaults to empty so production hits same-origin `/api/*` via nginx.
- Frontend runs `next start` in production — never `next dev`.
-- nginx config and systemd units are in-tree at `nginx/` and `systemd/`; redeploying those requires sudo cp + reload.
+- `nginx/` and `systemd/` are in-tree as optional reference templates only.
## Design System (`design-system/`)
@@ -81,5 +75,5 @@ v1 cache TTLs to mirror: financials 1 h, indices 5 min, search 60 s. Data hierar
`.env.example` → `.env`. Current feature set works without keys.
-- `NEXT_PUBLIC_API_BASE_URL` — empty in production (same-origin via nginx); `http://127.0.0.1:8001` locally
+- `NEXT_PUBLIC_API_BASE_URL` — empty behind a same-origin proxy; `http://127.0.0.1:8001` locally
- `FMP_API_KEY`, `FINNHUB_API_KEY` — reserved for future enrichment