Apps & Stages
An Alchemy App is a collection of Stages where each deployed Stage is an isolated copy of your Resources including Workers, Databases, Queues, etc.
You can create an app with the alchemy
function, typically in your alchemy.run.ts
file.
import alchemy from "alchemy";
const app = await alchemy("my-app");
// create your resources here...await Worker("api", { entrypoint: "./src/worker.ts",});
// clean up any unused resources from the applicationawait app.finalize();
Inside each App are 1 or more Stages containing the actual Resources. When you run alchemy deploy
, you are actually deploying a specific stage of your application.
alchemy deploy # deploys the default $USER stage
By default (when running locally) the stage will be your username ($USER
, or $USERNAME
on Windows). You can also specify a stage with the --stage
flag:
alchemy deploy --stage prod
Recommended Setup
Section titled “Recommended Setup”A typical setup for a team is to have a single app with multiple stages:
- Personal Stage - each developer runs
alchemy deploy
oralchemy dev
and uses the default$USER
stage - Pull Request Stage - each Pull Request deploys its own stage,
pr-${pull-request-number}
- Production Stage - deploy the
main
branch is deployed to theprod
stage