Single Component

Full-featured single component with services, env vars, and lifecycle commands.

What this demonstrates

  • `provides` declares what your app exposes (ports, protocols)
  • `requires` with `set_env` wires resource properties into your environment
  • `supports` declares optional resources (skipped if unavailable)
  • Environment variables with `generator: secret` are auto-created
  • Lifecycle commands: build, release, start, seed, test

When to use this: Full-featured single-component app — covers most production deployments.

Provides Requires Environment Commands Health
single-component.yaml View on GitHub
# yaml-language-server: $schema=../schema/launchfile.schema.json
version: launch/v1
name: simple-api

runtime: node
provides:
  - protocol: http
    port: 8080
    exposed: true
requires:
  - type: postgres
    set_env:
      DATABASE_URL: $url
supports:
  - type: redis
    set_env:
      CACHE_URL: $url
      USE_CACHE: "1"
env:
  PORT:
    default: "8080"
  API_KEY:
    required: true
    description: "Third-party API key"
  SESSION_SECRET:
    generator: secret
    sensitive: true
commands:
  start: "node server.js"
  build: "npm install"
  release: "npx prisma migrate deploy"
  test: "npm test"
health: /health

Key lines explained

set_env:
Maps resource properties ($host, $port, etc.) into your app's env vars.
generator: secret
Auto-generates a cryptographic secret at deploy time.
esc
Type to search the docs