AI Studio

August 14, 2026 · View on GitHub

⚠️ Reference implementation, local development only. No real authentication. The bundled AllowAllAuthPort permits every caller and every action (see src/auth/), and the constructor refuses to start without the explicit WB_AUTH_PORT=allow-all opt-in so a forgotten env var fails loudly. No tenant isolation. The HTTP server and the docker-compose services bind to 127.0.0.1 by default. Do not expose to the internet or shared networks without first plugging in a real AuthPort, see auth-port.decision-log.md for the seam, default, and a JWT adapter sketch.

Seams for consumers to plug in: AuthPort for authn/authz, TenantContextPort for multi-tenant identity propagation (wiring guide: multi-tenancy.md).

Note: setup is in root README "Path C. Run the full stack demo". This file documents the backend's internals, not how to start it.

Backend execution layer for Workflow Builder AI Studio plugin. Runs AI workflows defined on the canvas via Temporal + OpenRouter.

Architecture

Hexagonal — the backend depends on ports, not on Temporal. The Temporal-backed adapter is swappable.

Frontend (React)
     │                                                  ┌── execute node (AI agent, decision, …)
     ▼                                                  │
 Backend (Hono) ──▶ WorkflowEnginePort ──▶ Temporal ──▶ Worker ──┼── emit event → Postgres
     ▲                 │                                  │      │
     │                 └─ impl: TemporalEngine            │      └── update status → Postgres
     └── SSE stream (Postgres LISTEN/NOTIFY) ◀────────────┘
  • Backend (apps/backend) — Hono HTTP server, workflow CRUD, SSE streaming via Postgres LISTEN/NOTIFY. Submits executions through WorkflowEnginePort.
  • Engine adapter (apps/backend/src/engine/temporal-engine.ts) — implements WorkflowEnginePort against Temporal. Swap this file to switch engines.
  • Worker (apps/execution-worker) — Temporal worker. Activities delegate node execution to execution-core. See the worker README.
  • Domain (packages/execution-core) — pure graph runner + ports + node executors. No Temporal, no HTTP. See the execution-core README.
  • Frontend (apps/ai-studio) — full AI workflow product. Composes @workflowbuilder/sdk directly via JSX, with a slim plugin only for per-node execution markers. Owns Play/Stop controls, log panel, node detail, and execution highlighting.

Running individual processes

For debugging, the parts that pnpm dev:ai-studio orchestrates can also be run separately:

pnpm infra:up                                              # Postgres + Temporal
pnpm dev:backend                                           # Hono on port 3001
pnpm dev:worker                                            # Temporal worker
pnpm --filter @workflow-builder/ai-studio dev              # Frontend on port 4201
ServiceURL
AI Studio frontendhttp://localhost:4201
Demo frontendhttp://localhost:4200
Backend APIhttp://localhost:3001
Temporal UIhttp://localhost:8233

Environment

apps/backend/.env and apps/execution-worker/.env both consume:

DATABASE_URL=postgresql://wb:wb@127.0.0.1:5432/workflow_builder
TEMPORAL_ADDRESS=127.0.0.1:7233

Worker additionally needs OPENROUTER_API_KEY and optionally AI_MODEL. See apps/execution-worker/README.md.

Scripts

All scripts run from the monorepo root. Grouped by purpose:

Bootstrap

ScriptWhat it does
preflightVerify Node / pnpm / Docker / ports / .env files. --json for tooling.
setup:envCopy .env.example.env for backend and worker (won't overwrite).

Dev (running apps)

ScriptWhat it does
devDefault — runs dev:demo (lightweight, no backend)
dev:demoDemo frontend only (Vite + typecheck watch); no backend dependency
dev:ai-studioOrchestrator — starts infra, waits for Temporal, then backend + worker + AI Studio frontend concurrently
dev:backendBackend only (Hono server with tsx watch)
dev:workerExecution worker only (Temporal worker with tsx watch)
dev:docsDocs site (Astro)

Infra (Docker lifecycle)

ScriptWhat it does
infra:upStarts Postgres + Temporal + Temporal UI via docker compose
infra:downStops and removes the containers
infra:waitPolls Temporal UI until it responds (used internally by dev:ai-studio)

Database (Drizzle)

ScriptWhat it does
db:generateGenerate a new migration from schema changes
db:migrateApply pending migrations to the database

Builds

ScriptWhat it does
buildBuild the demo frontend
build:ai-studioBuild the AI Studio frontend
build:libBuild the SDK as a library
build:docsBuild the docs site
preview-buildBuild + run a preview server for the demo frontend

Quality

ScriptWhat it does
lintESLint across all workspaces
lint:fixESLint with --fix
formatPrettier write across the repo
typechecktsc --noEmit across workspaces
testFrontend tests (Vitest)
checkLint + typecheck + format + knip (full quality gate)

Git hooks (invoked by Husky, not meant to run manually)

ScriptWhat it does
pre-commitRuns lint-staged on staged files
pre-pushRuns format + knip before allowing push
prepareInstalls husky hooks (auto-run on pnpm install)