Setup
Connect deploykit to Vercel.
Install
Follow the installation guide to install the alpha packages, then configure the provider below.
Add credentials
Create a token at vercel.com/account/tokens, scoped to the team that will own the projects.
VERCEL_TOKEN=...
# Only if the token isn't already scoped to your team:
VERCEL_TEAM_ID=team_...VERCEL_API_KEY is also accepted in place of VERCEL_TOKEN.
Create the client
import { Layer } from "effect"
import { NodeFileSystem } from "@effect/platform-node"
import * as Vercel from "@deploykit/vercel"
// Reads VERCEL_TOKEN and VERCEL_TEAM_ID from the environment.
export const DeploykitLive = Vercel.layerConfig().pipe(Layer.provide(NodeFileSystem.layer))To pass options, use layer instead:
export const DeploykitLive = Vercel.layer({
token,
teamId,
uploadThrottle: "balanced",
memoryBudgetBytes: 512 * 1024 * 1024
}).pipe(Layer.provide(NodeFileSystem.layer))Client options
| Option | Default | What it does |
|---|---|---|
token | required | Vercel API token |
teamId | none | Team to act for |
uploadThrottle | none | Upload rate limit shared by every deploy. See Uploads |
retry | { attempts: 4 } | Retries for reads and uploads. See Errors |
timeoutMs | 30000 | Time limit per HTTP operation, including retries |
fetch | global fetch | Custom HTTP transport |
memoryBudgetBytes, stagingBudgetBytes, maxFileBytes | see Limits | Shared memory and disk caps |
onEvent | none | Telemetry callback (Promise API). See Telemetry |
What to deploy
A Build Output API tree. Paths in the artifact start
with .vercel/output/:
.vercel/output/config.json routes, headers, redirects
.vercel/output/static/index.html static files
.vercel/output/functions/api/hello.func/ serverless functionsVercel won't build anything for you. Run your framework's build first: Next.js, Astro, SvelteKit,
Nuxt and others can all output this format, often via vercel build. Then deploy the result:
await deploykit.deployDirectory(appId, "./my-app") // the folder that contains .vercel/outputGenerated files go under .vercel/output/static/. Either write them into the folder before
deploying, or add them in memory with Artifact.add
at a path like .vercel/output/static/config.json.
Only put deployment content in the directory. Everything in it is uploaded, including dotfiles and
anything like a .env file.
Deploy options
On top of the core options:
| Option | Default | What it does |
|---|---|---|
activation | "automatic" | "deferred" stages a production deploy without sending traffic to it. See Activation |
operationId | none | Your id for this attempt, to recover a lost response. Letters, digits, _, ., -; up to 128 |
meta | none | Key-value strings attached to the deployment |
uploadConcurrency | 8 | Files uploaded at once, 1 to 32. See Uploads |
uploadOrder | "manifest" | "largest-first" starts big files first |
uploadRounds | 3 | Times to re-upload files Vercel still reports missing, 0 to 10 |
activation: "deferred" with target: "preview" is rejected: only production deploys can be staged.
Separate coordinator and worker
If one service manages projects and another uploads files, the coordinator only needs the control
plane. @deploykit/vercel/control has no upload code and can be bundled for the browser or an edge
runtime:
import { makeVercelClient, makeVercelControl } from "@deploykit/vercel/control"
const control = makeVercelControl(makeVercelClient({ token }))
// control.createApp, getDeployment, activateDeployment, ... all return EffectsIt has every method except deploy. Keep @deploykit/vercel (or @deploykit/node) in the worker.
Last updated on