Skip to content

refactor(studio): split API and web workspaces - #5120

Merged
tlgimenes merged 2 commits into
mainfrom
codex/origin-main
Jul 24, 2026
Merged

tlgimenes merged 2 commits into
mainfrom
codex/origin-main

Conversation

@tlgimenes

@tlgimenes tlgimenes commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • split the former full-stack apps/mesh workspace into the Hono backend at apps/api and the Vite/React application at apps/web
  • consolidate internal contracts, SDK utilities, and async primitives into the private @decocms/shared package while keeping browser-only SDK code inside apps/web
  • update development, build, deployment, CI, test, and worktree tooling for the new workspace boundaries
  • standardize READMEs for all 14 direct app and package workspaces and enforce the format with check:readmes

Architectural boundaries

  • apps/web does not import server implementation from apps/api
  • apps/api does not import application code from apps/web
  • @decocms/shared remains private, isomorphic, and free of application/runtime ownership
  • web-only React hooks and transports remain local to apps/web/src/sdk

Validation

  • bun run check
  • bun run fmt:check
  • bun run lint
  • bun run knip
  • bun run --cwd=apps/docs build (322 pages)
  • bun run --cwd=packages/harness test (363 tests)
  • workspace README validator (14 workspaces)

Full Playwright E2E was not rerun because it requires the external Postgres, NATS, and browser service stack.


Summary by cubic

Split the former full‑stack apps/mesh into apps/api (Hono backend/CLI) and apps/web (Vite/React), introduced a private @decocms/shared package for isomorphic contracts and utils, and overhauled CI/release/tests/docs to enforce the new boundaries. One build (bun run build:studio) now stages the web bundle into the API dist; the release publishes decocms to npm and pushes separate API and web images from the same tarball.

  • Refactors

    • Moved server code to apps/api and web UI to apps/web; enforced boundaries with ban-cross-tree-imports and ban-web-server-imports.
    • Consolidated shared contracts, SDK utilities, and async primitives into packages/shared with imports via @decocms/shared/*; removed publish workflows for @decocms/mesh-sdk and @decocms/std.
    • Replaced the legacy release with “Release Studio”: build:studio produces one tarball used to publish npm (decocms from apps/api) and build/push GHCR images for API (apps/api/Dockerfile) and web (apps/web/Dockerfile); release notes/docs reference bunx decocms.
    • CI and guards now target apps/api/** and apps/web/**; release‑tagging watches apps/api/package.json, root package.json, and scripts/build-studio.ts, and computes deploy scope (web/server/both) from changed files.
    • Tests: unit tests run via the root bun run test; the Playwright E2E suite lives in packages/e2e and its config starts apps/api and apps/web as separate webServer entries; multi‑pod, storage‑integration, resilience, and sandbox workflows follow the new layout.
    • Docs/tooling: added apps/api/README.md; refreshed README.md, AGENTS.md, TESTING.md, CONTRIBUTING.md. Worktrees/hooks now copy .env, auth-config.json, and config.json under apps/api. .gitignore and Playwright artifact paths point to apps/web.
  • Migration

    • Local dev: bun run --cwd=apps/web dev (web) and bun run --cwd=apps/api dev:server (API). Build both with bun run build:studio. Run DB migrations with bun run --cwd=apps/api migrate.
    • Config moves: .env, auth-config.json, and config.json live under apps/api/.
    • Imports: replace @decocms/std and app‑local SDK paths with @decocms/shared/* (e.g. @decocms/shared/std).
    • E2E: run from packages/e2e; config starts API and web separately.
    • Deploy: API image builds from apps/api/Dockerfile; web image from apps/web/Dockerfile. The container’s SQLite path stays /app/data/mesh.db for seamless upgrades.

Written for commit 6dfb733. Summary will update on new commits.

Review in cubic

@tlgimenes
tlgimenes force-pushed the codex/origin-main branch 8 times, most recently from 791276d to 02cdd8b Compare July 24, 2026 12:17
@tlgimenes
tlgimenes enabled auto-merge (squash) July 24, 2026 12:19
@tlgimenes
tlgimenes force-pushed the codex/origin-main branch from 02cdd8b to 6dfb733 Compare July 24, 2026 12:52
@tlgimenes
tlgimenes merged commit 1898663 into main Jul 24, 2026
18 of 19 checks passed
@tlgimenes
tlgimenes deleted the codex/origin-main branch July 24, 2026 12:59
guitavano added a commit that referenced this pull request Jul 24, 2026
Resolve conflicts from #5120 (split apps/mesh → apps/api + apps/web),
which moved apps/mesh/src/web/* to apps/web/src/* and changed the path
alias from `@/web/*` to `@/*`:

- array-field.tsx / tile-board.tsx: import-block conflicts — keep the new
  `@/i18n/use-t.ts` alias plus our createPortal / SORTABLE_DROP_ANIMATION
  imports.
- Move new file to apps/web/src/lib/dnd-drop-animation.ts and update all
  five importers from `@/web/lib/...` to `@/lib/...`.

tsc (apps/web) and biome format clean.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
pedrofrxncx pushed a commit that referenced this pull request Jul 27, 2026
#5240)

Reverts #5112 (share agent sandboxes by branch), #5116 (always share
agent sandboxes) and #5132 (use shared staging branch), restoring the
pre-#5112 behaviour: hosted agent sandboxes are per-user again, and a
new GitHub-backed thread gets a generated branch instead of `staging`.

Reconstructed against current paths rather than reverted: #5120 split
apps/mesh into apps/api + apps/web and hoisted branch-name.ts,
runtime-defaults.ts and thread/schema.ts into packages/shared, and #5174
deleted vm-events.ts outright, so none of the three commits reverse-apply.

Core change: SandboxId goes back to a flat `{ userId, projectRef }` and
sandboxIdKey back to `userId:projectRef`, so every hosted claim handle
changes. Live shared claims must be drained BEFORE this deploys.

Also reverted, because they only exist inside the shared model:
- #5225 withoutLegacyAgentSandboxEntries — left in place it would strip
  the sandboxMap entries the reverted server writes back, leaving
  shouldAutoStart permanently true (silent, compiles fine)
- #5219 resolveSharedThreadVm and the shared-scope branch
- #5183 stale-provisioning reset (lived inside the deleted storage)

Deliberately preserved:
- migrations 137/138 and their index.ts entries — Kysely's
  #ensureNoMissingMigrations runs unconditionally, so deleting an applied
  migration crash-loops every pod. The tables are dropped by a follow-up
  forward migration after the drain, not by this commit.
- #5114/#5118 withClaimGitLock, #5126 org-context guard, #5143 analytics
  gate, #5171 owner-keyed thread graft, #5195/#5207/#5210/#5221 client
  auto-retry, the daemon status-code train and the settings-validation train
- #5112's org-fs least-privilege narrowing and the start dedup key fix
- #5116's squashed queue-tray pluralization (en + pt-br)
- the remote-branch-name validations #5132 deleted, since this restores
  the dynamic origin/HEAD lookup that made them load-bearing

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Co-authored-by: Pedro França <[email protected]>
viktormarinho added a commit that referenced this pull request Aug 3, 2026
001.md described the file-based auth-config.json design that #3048/#5120
replaced with AUTH_* env vars, plus a pre-split architecture; nothing links to
it except its README entry and one step of the add-mcp-tools skill, both
removed (the skill's 'Document in Spec' step told contributors to document new
tools in a file that described a system that no longer exists).
monitoring-share-plugin.md was referenced by nothing at all.
viktormarinho added a commit that referenced this pull request Aug 3, 2026
…5579)

* chore: delete the dead auth-config.json tail and the stray EFS RFC

Auth moved to AUTH_* environment variables (auth-env.ts) — core/config.ts even
warns that a config-file 'auth' key is ignored. Nothing reads auth-config.json
anymore, but its tail survived everywhere:

- auth-config.json at the repo root: snuck in via #5575 (a sandbox-daemon PR),
  tracked ever since, read by nothing. Deleted.
- apps/api/auth-config.example.json, tests/resilience/auth-config.test.json:
  referenced by nothing. Deleted.
- .github/workflows/e2e.yml wrote the file before every run — for nothing.
  Step deleted.
- .cursor/worktrees.json copied a file that does not exist. Line deleted.
- apps/api/src/auth/index.ts's header claimed the exact opposite of reality
  ('file-based, not environment variables'). Fixed, with the .gitignore entry,
  the AGENTS.md config line, and config.example.json's pointer.
- deploy/helm/studio/README.md documented a configmap-auth.yaml template that
  does not exist in templates/. Section removed, following ones renumbered.

efs-spec.md (an L2 golden-cache RFC draft) also landed at the root in #5575.
Deleted — it was never referenced by anything in the repo.

Not touched: decostudio-alias/ stays at the root on purpose — it is the
published npm alias (decostudio → decocms) with its own publish workflow, and
it must stay OUT of the workspaces globs so its 'decocms': '*' dependency
resolves against the registry instead of being workspace-linked. spec/001.md's
auth-config mentions are a historical design document and were left alone.

* docs(helm): stop documenting authConfig values the chart renders to nothing

The chart has had no template consuming .Values.configMap.authConfig or
secret.authConfigSecretName since configmap-auth.yaml was deleted (#3048,
env-var auth) — but the README and examples/secrets-example.yaml kept
documenting both, including a second Secret with camelCase keys
(googleClientId, resendApiKey) the server never reads. This is an active
trap: the real prod values in deco-apps-cd carry a full authConfig block
(google, resend, magic-link) that renders to nothing — auth there actually
works because the ExternalSecret feeds AUTH_* keys via envFrom.

README now shows the real mechanism (AUTH_* in meshConfig/Secret, schema in
apps/api/src/auth/auth-env.ts) and the example Secret carries AUTH_* keys.

* chore(api): delete apps/api/spec — a stale v1 design document

001.md described the file-based auth-config.json design that #3048/#5120
replaced with AUTH_* env vars, plus a pre-split architecture; nothing links to
it except its README entry and one step of the add-mcp-tools skill, both
removed (the skill's 'Document in Spec' step told contributors to document new
tools in a file that described a system that no longer exists).
monitoring-share-plugin.md was referenced by nothing at all.

* chore: delete .cursorindexingignore

Stale editor config from 2024 (last touched in #1218); the paths it excluded
no longer exist in the repo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant