Apps & Stages
Deploy isolates copies of your application's infrastructure with 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 stageBy 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 prodRecommended 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 deployoralchemy devand uses the default$USERstage - Pull Request Stage - each Pull Request deploys its own stage,
pr-${pull-request-number} - Production Stage - deploy the
mainbranch is deployed to theprodstage