DeployKit

Deploykit service

The Effect entry point, from @deploykit/core.

import { Effect } from "effect"
import { Deploykit } from "@deploykit/core"

const program = Effect.gen(function* () {
  const deploykit = yield* Deploykit.Deploykit
  // ...
})

Layers

LayerFromNotes
Vercel.layerConfig(limits?)@deploykit/vercelReads VERCEL_TOKEN, VERCEL_TEAM_ID
Vercel.layer(options)@deploykit/vercelClient options plus limits
Cloudflare.layerConfig(limits?)@deploykit/cloudflareReads CLOUDFLARE_API_TOKEN, CLOUDFLARE_ACCOUNT_ID
Cloudflare.layer(options)@deploykit/cloudflareClient options plus limits
Deploykit.layer(limits?)@deploykit/coreOver any Provider.DeploymentProvider in context

All of them need a FileSystem, for example NodeFileSystem.layer from @effect/platform-node. limits is { memoryBudgetBytes?, stagingBudgetBytes?, maxFileBytes? }; see Limits. The budgets are created once per layer and shared by every deploy through it.

layerConfig fails with a ConfigError when a required variable is missing.

Methods

Every method returns an Effect with no further requirements.

MethodSucceeds withFails with
createApp(name)AppProviderError
getApp(appId)AppProviderError
deleteApp(appId)voidProviderError
findAppByName(name)Option<App>ProviderError, UnsupportedError
setAccess(appId, access)voidProviderError, UnsupportedError
deploy(appId, artifact, options?)DeploymentDeploy errors
deployDirectory(appId, directory, options?)DeploymentDeploy errors, plus file system errors
deployManifest(appId, manifest, source, options?)DeploymentDeploy errors
getDeployment(appId, deploymentId)DeploymentProviderError
activateDeployment(appId, deploymentId)ActivationProviderError, UnsupportedError
getActivation(appId, deploymentId)ActivationProviderError, UnsupportedError
reconcileDeployment(appId, operationId)ReconciliationProviderError, UnsupportedError

capabilities is a plain Capabilities value, not an Effect.

deployManifest

manifest is unknown and is validated for you, so the result of JSON.parse works directly. source is a FileSource:

import { Source } from "@deploykit/core"

export const source = Source.fromReadableStream(async (reference, signal) => {
  const response = await fetch(
    `https://artifacts.example.test/objects/${encodeURIComponent(reference)}`,
    {
      signal,
      redirect: "error"
    }
  )
  if (!response.ok || response.body === null) {
    await response.body?.cancel()
    throw new Error(`Artifact read failed: ${response.status}`)
  }
  return response.body
})

Replace this illustrative origin with your authorized artifact store and resolve opaque references according to your storage mapping. Source.fromPromise accepts a reader returning Promise<Uint8Array> for small files; the streaming reader avoids that allocation.

Deploy options

Deploykit.DeployOptions is Provider.DeployOptions without the budgets, which the layer owns:

FieldType
target"production" | "preview"
activation"automatic" | "deferred"
operationIdstring
metaRecord<string, string>
onProgress(event: DeployProgress) => Effect<void>

For Vercel's upload options, see Uploads.

Cancelling

Interrupt the fiber. See Lifecycle.

Without Deploykit

Provider.DeploymentProvider is the raw contract underneath. It has the same apps and deployment methods, but optional ones are undefined when unsupported, and deploy takes budgets directly. Use it for Platform, tests, or writing a provider. Provide it with Vercel.vercelLayer, Vercel.layerWith(client), Cloudflare.cloudflareLayer or Cloudflare.layerWith(client).

Waiting and deployment management

The service also exposes waitUntilReady, deployAndWait, listDeployments, deleteDeployment and rollback. Their result semantics match the Promise reference; Effect calls use fiber interruption instead of AbortSignal. Effect wait options are { schedule?, tolerateFailures? }, not millisecond fields. Supply a bounded schedule and use Effect.timeout for a hard overall deadline.

waitUntilReady fails with ProviderError or DeploymentTimeoutError and returns a terminal failed deployment as data. deployAndWait additionally raises DeploymentFailedError for that failed status. The management operations can fail with UnsupportedError when unavailable. Exact signatures and requirements are in the generated core reference.

Last updated on

On this page