Skip to content

Monorepo

A monorepo is a workspace with a backend package and a frontend that calls it. The one decision Alchemy adds: where do the Stacks live?

Terminal window
.
├── package.json # workspaces: ["frontend", "backend"]
├── alchemy.run.ts # the one Stack — deploys both packages
├── backend/ # Worker + API schema + typed client
└── frontend/ # React app, built by the Stack

One alchemy.run.ts at the workspace root deploys everything in one plan. The frontend reads the Worker’s URL directly off the in-memory Output — no references, no deploy ordering.

Walkthrough: Single Stack.

Terminal window
.
├── package.json # workspaces: ["frontend", "backend"]
├── backend/
├── alchemy.run.ts # Backend Stack
└── src/Stack.ts # typed handle the frontend imports
└── frontend/
└── alchemy.run.ts # Frontend Stack — yield* Backend

Each package owns its own Stack. The frontend reads the backend’s deployed outputs through a typed cross-stack reference, so each package deploys and destroys independently.

Walkthrough: Multiple Stacks.

  • Start with a Single Stack — one plan, one state file, no ordering constraints.
  • Go Multiple Stacks when packages deploy on different cadences (different teams, different CI), or the backend has consumers beyond this frontend.
  • Go Multiple Stacks when you need to destroy one package without touching the other.
  • File layout — the single-package layout both options build on.
  • Single Stack — the full two-package walkthrough.
  • Multiple Stacks — typed Stack handles and cross-stack references.
  • References — when to split Stacks and how to pin stages.