Skip to content

Service

Deploy long-running services.

A service is a long-running process — your API server, web app, or worker.

import { service } from "vyft";
export const api = service("api", {
image: "node:22",
port: 3000,
domain: "api.example.com",
env: {
NODE_ENV: "production",
},
});
FieldTypeDefaultDescription
imagestringDocker image
pathstringPath to build from source
portnumberPort the service listens on
domainstringDomain to expose the service on
envRecord<string, string>Environment variables
commandstring[]Override the container command
mountsArray<{ source, target }>Volume mounts
healthobjectHealth check configuration
restartstringRestart policy: always, on-failure, unless-stopped, no
exposebooleanExpose the service externally
linkLinkable[]Link to other services or resources

Link services together to inject connection details as environment variables:

const worker = service("worker", { image: "node:22", port: 8080 });
export const api = service("api", {
port: 3000,
link: [worker],
});

Linked resources inject {NAME}_HOST, {NAME}_PORT, and {NAME}_URL into the service’s environment.

export const api = service("api", {
port: 3000,
health: {
path: "/health",
interval: "30s",
timeout: "5s",
retries: 3,
},
});