# marathon.todo A React + TypeScript app with a local Node + SQLite backend for planning what to loot (or do) in raids in Bungie's Marathon. ## Features - Search for Marathon items by name. - Show up to 5 relevant results with item icons. - Search also includes faction upgrades with salvage requirements. - Add an item to a to-do list by clicking a search result. - Clicking an upgrade search result adds all mapped salvage materials to the to-do list. - Set quantity per to-do entry. - Mark entries completed. - Delete entries. - Persist to-do entries in browser `localStorage`. - Track anonymous visit statistics in backend SQLite (country, last hour, and 5-day trends). ## Data Source - Frontend fetches a local proxy endpoint: `/api/catalog` - Proxy source data: - Items: `https://items.marathondb.gg/api/items` - Faction upgrades: `https://marathondb.gg/js/data/faction-upgrades.js` - Proxy stores processed catalog in SQLite (`backend/data/catalog.db`) and refreshes every 24h. ## Stats Endpoint - `GET /stats` (backend) returns JSON with: - Visits grouped by country - Last hour totals (`visits`, `uniqueVisitors`) - Last 5 calendar days (`visits`, `uniqueVisitors` per day) - `/stats` is restricted at backend level to localhost and LAN/private IP ranges only (public requests receive `403`). ## Project Structure - `frontend/`: Vite + React app (`frontend/src`, `frontend/index.html`) - `backend/`: local proxy API (`backend/server.js`) and SQLite data (`backend/data/`) - `backend/references/`: downloaded reference source files used during development ## Tech Stack - React - TypeScript - Vite ## Run Locally 1. Install dependencies: ```bash npm install ``` 2. Start backend + frontend together: ```bash npm run dev:all ``` 3. Or run separately if preferred: ```bash npm run dev:backend npm run dev:frontend ``` 4. Build production assets: ```bash npm run build ``` ## Gitea Auto Deploy (Docker Compose) When `main` is updated, Gitea Actions can redeploy your Docker Compose stack using: - Workflow file: `.gitea/workflows/redeploy-compose.yml` - Trigger: push to `main` - Commands run locally on the Gitea runner host: - `git fetch` - `git checkout main` - `git pull --ff-only` - `docker compose pull` - `docker compose up -d --build --remove-orphans` Set these repository secrets in Gitea: - `DEPLOY_PATH`: absolute path to this repo on the server For this workflow to work, your runner must have Docker socket access (for example `-v /var/run/docker.sock:/var/run/docker.sock`).