M18-1: Monorepo restructure (Bun + Turbo workspace) #162

Closed
opened 2026-04-20 16:02:53 +00:00 by code-lead · 0 comments
Collaborator

As an operator, I want the repo reshaped from a single src/ tree into a Bun + Turbo workspace (apps/server, apps/web, packages/shared), so that the server, the new web app, and shared types live side-by-side without tangled imports.

Acceptance criteria

Layout

  • Top-level becomes a Bun workspace (package.json with workspaces: ["apps/*", "packages/*"]) driven by Turbo (turbo.json with build, dev, qa, test pipelines)
  • apps/server/ — current src/*.ts moves here; main.ts still boots on port 4500
  • apps/web/ — empty Vite + React shell (populated by #M18-2+)
  • packages/shared/ — cross-app TypeScript types (TaskRecord, ResolvedAgent, SSE event envelopes, /queue response shape) consumed by both apps via workspace:*
  • Root justfile: just dev runs turbo run dev (server + web in parallel with hot reload); just qa still runs typecheck + lint + format across the workspace

Migration safety

  • Every import path in src/ that survives the move is rewritten — no lingering from "../src/…"
  • Existing *.test.ts files move alongside their modules; bun test continues to work from workspace root and from apps/server/
  • .forgejo/workflows/qa.yml + release.yml learn about the workspace: one QA job covers the whole monorepo; release still builds the server binary (web ships as static assets served by the server)
  • systemd unit path unchanged (service runs bun run apps/server/src/main.ts)

Docs

  • README top-level explains the workspace; each apps/* and packages/* has a short README (purpose + dev commands)
  • CLAUDE.md Modules table updates paths (apps/server/src/…)

Tests

  • Full bun test passes after the move
  • just qa passes (types + Biome)
  • just dev starts both apps cleanly; http://localhost:4500 still serves legacy dashboard.html (zero UX regression until #M18-3 parity ships)

Out of scope

  • Any UI work on apps/web (empty shell only — #M18-2)
  • npm / pnpm migration
  • Splitting apps/server into sub-packages (core, webhook, agents) — premature

Dependencies

  • Blocks every other story in M18. No prerequisites.

References

  • Spec: specs/m18-ui-rewrite-and-architect.md §Story M18-1
  • Milestone 17 close: #47 (tracker)
As an operator, I want the repo reshaped from a single `src/` tree into a Bun + Turbo workspace (`apps/server`, `apps/web`, `packages/shared`), so that the server, the new web app, and shared types live side-by-side without tangled imports. ## Acceptance criteria ### Layout - [ ] Top-level becomes a Bun workspace (`package.json` with `workspaces: ["apps/*", "packages/*"]`) driven by Turbo (`turbo.json` with `build`, `dev`, `qa`, `test` pipelines) - [ ] `apps/server/` — current `src/*.ts` moves here; `main.ts` still boots on port 4500 - [ ] `apps/web/` — empty Vite + React shell (populated by #M18-2+) - [ ] `packages/shared/` — cross-app TypeScript types (`TaskRecord`, `ResolvedAgent`, SSE event envelopes, `/queue` response shape) consumed by both apps via `workspace:*` - [ ] Root `justfile`: `just dev` runs `turbo run dev` (server + web in parallel with hot reload); `just qa` still runs typecheck + lint + format across the workspace ### Migration safety - [ ] Every import path in `src/` that survives the move is rewritten — no lingering `from "../src/…"` - [ ] Existing `*.test.ts` files move alongside their modules; `bun test` continues to work from workspace root and from `apps/server/` - [ ] `.forgejo/workflows/qa.yml` + `release.yml` learn about the workspace: one QA job covers the whole monorepo; release still builds the server binary (web ships as static assets served by the server) - [ ] systemd unit path unchanged (service runs `bun run apps/server/src/main.ts`) ### Docs - [ ] README top-level explains the workspace; each `apps/*` and `packages/*` has a short README (purpose + dev commands) - [ ] CLAUDE.md Modules table updates paths (`apps/server/src/…`) ### Tests - [ ] Full `bun test` passes after the move - [ ] `just qa` passes (types + Biome) - [ ] `just dev` starts both apps cleanly; `http://localhost:4500` still serves legacy `dashboard.html` (zero UX regression until #M18-3 parity ships) ## Out of scope - Any UI work on `apps/web` (empty shell only — #M18-2) - npm / pnpm migration - Splitting `apps/server` into sub-packages (`core`, `webhook`, `agents`) — premature ## Dependencies - **Blocks every other story in M18.** No prerequisites. ## References - Spec: `specs/m18-ui-rewrite-and-architect.md` §Story M18-1 - Milestone 17 close: #47 (tracker)
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#162
No description provided.