Skip to content

Setup

Terminal window
mkdir my-app && cd my-app && pnpm init
Terminal window
pnpm add https://pkg.alchemy.run/alchemy/pr:3743:56b4873 https://pkg.alchemy.run/@alchemy.run/convex/pr:3743:56b4873 convex effect @effect/platform-bun @effect/platform-node

convex is Convex’s own package. Convex.Functions pushes with its CLI, and your functions import it.

Add Convex.providers() to your Stack:

alchemy.run.ts
import * as Convex from "@alchemy.run/convex";
import * as Alchemy from "alchemy";
import * as Effect from "effect/Effect";
export default Alchemy.Stack(
"MyApp",
{ providers: Convex.providers(), state: Alchemy.localState() },
Effect.gen(function* () {
yield* Convex.Project("App");
}),
);

Create a team access token in your team’s settings. A token belongs to the person who created it, so use a service account for anything shared. Then store it in your default profile:

Terminal window
pnpm alchemy profile edit --add Convex

Paste the token when asked, and leave the team ID blank: Alchemy reads it from the token.

See Teams and tokens.

Set CONVEX_ACCESS_TOKEN, and Alchemy uses it instead of your profile:

Terminal window
CONVEX_ACCESS_TOKEN=... pnpm alchemy deploy

CONVEX_TEAM_ID is optional, and only checks that the token is for the team you expect. See CI.

Merge the providers:

providers: Layer.mergeAll(Cloudflare.providers(), Convex.providers()),

Convex has no emulator in Alchemy, so alchemy dev creates and uses real Convex deployments. Each stage gets its own.

Custom domains, log streams and data sync need the Convex Professional plan. Audit logs need a plan that keeps them.