Convex.Projects reference
DefaultEnvironmentVariables
Section titled “DefaultEnvironmentVariables”Source:
packages/convex/src/DefaultEnvironmentVariables.ts
Default environment variables for a Convex project. New deployments start with them, which makes them the way to configure preview deployments that something other than Alchemy creates.
DefaultEnvironmentVariables: Setting Defaults
Section titled “DefaultEnvironmentVariables: Setting Defaults”yield* Convex.DefaultEnvironmentVariables("Defaults", { project, deploymentTypes: ["preview"], env: { API_URL: "https://staging.example.com" },});Project
Section titled “Project”Source:
packages/convex/src/Project.ts
A Convex project. It holds deployments, which hold the data.
Project: Creating a Project
Section titled “Project: Creating a Project”Project with a generated name
const project = yield* Convex.Project("App");Named project with tags
const project = yield* Convex.Project("App", { name: "my-app", tags: ["web"],});Project: Keeping or Removing a Project
Section titled “Project: Keeping or Removing a Project”Remove the project on destroy
const project = yield* Convex.Project("App").pipe(RemovalPolicy.destroy());Remove it in every stage but prod
const stack = yield* Stack;const project = yield* Convex.Project("App").pipe( RemovalPolicy.retain(stack.stage === "prod"),);Project: Renaming a Project
Section titled “Project: Renaming a Project”Changing name renames the project in place. The slug stays unless you set
slug, so URLs that use it keep working.
const project = yield* Convex.Project("App", { name: "My App", slug: "my-app",});Project: Adding Deployments
Section titled “Project: Adding Deployments”const project = yield* Convex.Project("App");const preview = yield* Convex.Deployment("Preview", { project, type: "preview" });Project: Adoption and Deletion
Section titled “Project: Adoption and Deletion”Convex allows two projects with one name, so a deploy looks for the name
first. A project of that name without Alchemy’s tag fails with
OwnedBySomeoneElse unless you deploy with --adopt.
Deleting a project deletes its deployments and their data, so a project with a prod deployment refuses until that deployment is gone.