From 725901623b5899bbcf25407f369a730cfbbeeaf4 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Tue, 24 Mar 2026 09:16:18 +0100 Subject: [PATCH] chore: unify dev setup with concurrently Adds concurrently to start both the Vite frontend and Hono backend simultaneously in one terminal via the `bun run dev` command. Also updates documentation in README.md and CLAUDE.md to reflect the new development workflow. --- CLAUDE.md | 5 +-- README.md | 41 ++++++++++++++++++++++- package.json | 94 +++++++++++++++++++++++++++------------------------- 3 files changed, 91 insertions(+), 49 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8373622..07de72a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -9,7 +9,8 @@ GearBox is a single-user web app for managing gear collections (bikepacking, sim ## Commands ```bash -# Development (run both in separate terminals) +# Development +bun run dev # Starts both Vite client (:5173) and Hono server (:3000) concurrently bun run dev:client # Vite dev server on :5173 (proxies /api to :3000) bun run dev:server # Hono server on :3000 with hot reload @@ -67,4 +68,4 @@ bun run build # Vite build → dist/client/ - **Thread resolution**: Resolving a thread copies the winning candidate's data into a new item in the collection, sets `resolvedCandidateId`, and changes status to "resolved". - **Setup item sync**: `PUT /api/setups/:id/items` replaces all setup_items atomically (delete all, re-insert). - **Image uploads**: `POST /api/images` saves to `./uploads/` with UUID filename, returned as `imageFilename` on item/candidate records. -- **Aggregates** (weight/cost totals): Computed via SQL on read, not stored on records. +- **Aggregates** (weight/cost totals): Computed via SQL on read, not stored on records. \ No newline at end of file diff --git a/README.md b/README.md index 7ae8f51..6352ee2 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ A single-user web app for managing gear collections (bikepacking, sim racing, et - Research threads for comparing candidates before buying - Image uploads for items and candidates -## Quick Start +## Quick Start (Docker) ### Docker Compose (recommended) @@ -81,3 +81,42 @@ docker compose up -d ``` Database migrations run automatically on startup. + +## Tech Stack + +- **Runtime & Package Manager:** [Bun](https://bun.sh) +- **Frontend:** React 19, Vite, TanStack Router, TanStack Query, Tailwind CSS v4, Zustand +- **Backend:** Hono, Drizzle ORM, SQLite (`bun:sqlite`) + +## Local Development Setup + +### Prerequisites + +You must have [Bun](https://bun.sh/) installed on your machine. Docker is not required for local development. + +### Installation + +1. Install all dependencies: + ```bash + bun install + ``` + +2. Initialize the local SQLite database (`gearbox.db`): + ```bash + bun run db:push + ``` + +3. Start the development servers: + ```bash + bun run dev + ``` + This single command will start both the Vite frontend server (port `5173`) and the Hono backend server (port `3000`) concurrently. + +Open [http://localhost:5173](http://localhost:5173) in your browser to view the app. + +## Additional Commands + +- `bun run build` — Build the production assets into `dist/client/` +- `bun test` — Run the test suite +- `bun run lint` — Check formatting and lint rules using Biome +- `bun run db:generate` — Generate Drizzle migrations after making schema changes \ No newline at end of file diff --git a/package.json b/package.json index 2cb8ccc..55898c5 100644 --- a/package.json +++ b/package.json @@ -1,48 +1,50 @@ { - "name": "gearbox", - "module": "index.ts", - "type": "module", - "private": true, - "scripts": { - "dev:client": "vite", - "dev:server": "bun --hot src/server/index.ts", - "build": "vite build", - "db:generate": "bunx drizzle-kit generate", - "db:push": "bunx drizzle-kit push", - "test": "bun test", - "lint": "bunx @biomejs/biome check ." - }, - "devDependencies": { - "@biomejs/biome": "^2.4.7", - "@tanstack/react-query-devtools": "^5.91.3", - "@tanstack/react-router-devtools": "^1.166.7", - "@tanstack/router-plugin": "^1.166.9", - "@types/better-sqlite3": "^7.6.13", - "@types/bun": "latest", - "@types/react": "^19.2.14", - "@types/react-dom": "^19.2.3", - "@vitejs/plugin-react": "^6.0.1", - "better-sqlite3": "^12.8.0", - "drizzle-kit": "^0.31.9", - "vite": "^8.0.0" - }, - "peerDependencies": { - "typescript": "^5.9.3" - }, - "dependencies": { - "@hono/zod-validator": "^0.7.6", - "@tailwindcss/vite": "^4.2.1", - "@tanstack/react-query": "^5.90.21", - "@tanstack/react-router": "^1.167.0", - "clsx": "^2.1.1", - "drizzle-orm": "^0.45.1", - "hono": "^4.12.8", - "lucide-react": "^0.577.0", - "react": "^19.2.4", - "react-dom": "^19.2.4", - "recharts": "^3.8.0", - "tailwindcss": "^4.2.1", - "zod": "^4.3.6", - "zustand": "^5.0.11" - } + "name": "gearbox", + "module": "index.ts", + "type": "module", + "private": true, + "scripts": { + "dev": "concurrently -k -c \"blue,green\" -n \"server,client\" \"bun run dev:server\" \"bun run dev:client\"", + "dev:client": "vite", + "dev:server": "bun --hot src/server/index.ts", + "build": "vite build", + "db:generate": "bunx drizzle-kit generate", + "db:push": "bunx drizzle-kit push", + "test": "bun test", + "lint": "bunx @biomejs/biome check ." + }, + "devDependencies": { + "@biomejs/biome": "^2.4.7", + "@tanstack/react-query-devtools": "^5.91.3", + "@tanstack/react-router-devtools": "^1.166.7", + "@tanstack/router-plugin": "^1.166.9", + "@types/better-sqlite3": "^7.6.13", + "@types/bun": "latest", + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3", + "@vitejs/plugin-react": "^6.0.1", + "better-sqlite3": "^12.8.0", + "concurrently": "^9.1.2", + "drizzle-kit": "^0.31.9", + "vite": "^8.0.0" + }, + "peerDependencies": { + "typescript": "^5.9.3" + }, + "dependencies": { + "@hono/zod-validator": "^0.7.6", + "@tailwindcss/vite": "^4.2.1", + "@tanstack/react-query": "^5.90.21", + "@tanstack/react-router": "^1.167.0", + "clsx": "^2.1.1", + "drizzle-orm": "^0.45.1", + "hono": "^4.12.8", + "lucide-react": "^0.577.0", + "react": "^19.2.4", + "react-dom": "^19.2.4", + "recharts": "^3.8.0", + "tailwindcss": "^4.2.1", + "zod": "^4.3.6", + "zustand": "^5.0.11" + } }