Guides

Blueprint (bytstack.yaml)

Declare services, data, and env groups in git, validate, diff, and apply to a Bytstack project.

Blueprint (bytstack.yaml)

Commit a Blueprint at the repo root to keep deploy settings (Dockerfile path, releaseCommand, health checks, path filters, build mode) reviewable in PRs.

Stack-neutral services use build.strategy: dockerfile when you maintain your own image. Generated builds use nixless with explicit commands. Set defaults.runtime to match your primary language; nodejs is the Node example, other runtimes are first-class in the schema and dashboard.

Example

Save this as bytstack.yaml (or bytstack.yml) at the repository root. Secret values never belong in the file, only key names.

apiVersion: bytstack.dev/v1alpha1
kind: Blueprint
metadata:
  name: my-app
spec:
  defaults:
    runtime: python
    branch: main
    autoDeploy: true
  services:
    - logicalKey: api
      name: api
      type: web
      rootDir: backend
      pathFilters:
        - backend/**
      build:
        strategy: dockerfile
        dockerfilePath: backend/Dockerfile
      port: 8000
      healthCheckPath: /health
      env:
        keys:
          - DATABASE_URL
        fromGroups:
          - backend
    - logicalKey: web
      name: web
      type: web
      rootDir: frontend
      pathFilters:
        - frontend/**
      build:
        strategy: nixless
        buildCommand: npm run build
        startCommand: npm start
      port: 3000
    - logicalKey: worker
      name: worker
      type: worker
      rootDir: worker
      build:
        strategy: nixless
        startCommand: python -m worker
      env:
        keys:
          - DATABASE_URL
        fromGroups:
          - backend
  databases:
    - logicalKey: primary
      name: primary
      engine: postgres
  redis:
    - logicalKey: cache
      name: cache
      preset: cache
  buckets:
    - logicalKey: assets
      name: assets
  envGroups:
    - name: backend
      keys:
        - APP_URL
  environments:
    - slug: production
      name: Production
    - slug: staging
      name: Staging
      duplicateFrom: production

For field-by-field detail, see the bytstack.yaml reference.

Quick start

  1. Export live config (or start from the example above):
bytstack blueprint export -o bytstack.yaml
  1. Edit the YAML (never put secret values: key names only).

  2. Validate and diff:

bytstack blueprint validate
bytstack blueprint diff --exit-dirty
  1. Apply to one environment (default production):
bytstack blueprint apply --yes
bytstack blueprint apply --environment staging --yes

Optional env overlay: put overrides in bytstack.<slug>.yaml next to the base file (for example bytstack.staging.yaml). The CLI merges that overlay when you pass --environment <slug>.

Identity

Services, databases, Redis, and buckets are matched by logicalKey, not display name. Changing logicalKey creates a new resource; the old one is kept unless you pass --prune (owner/admin).

Apply target

Each apply updates one environment. Pass --environment (or use a bytstack.<slug>.yaml overlay) for staging vs production.

What apply changes

Apply only creates or updates. Nothing is deleted unless you pass --prune, and prune only removes services.

  • Services: created or updated by logicalKey. Plan changes are reported as warnings; change plans in the dashboard.
  • Databases, Redis, and Buckets: created only with --provision-data (provisionData: true), and only when no instance with the same name exists in the target environment. Redis presets map to cache, queue, or sessions. Buckets are private S3-compatible object stores (spec.buckets).
  • Env groups: groups are created when missing, and attached to services listed in env.fromGroups. Keys from envGroups[].keys and services[].env.keys are created blank when missing. Existing values are never overwritten. Set values in the dashboard.
  • Environments: an entry with a new slug and duplicateFrom is created by duplicating that environment. Existing environments are renamed when name differs. Protection is never changed by YAML.
  • Domains: manage custom domains in the dashboard (not applied from YAML yet).

Build machine

Image builds run on the Standard build machine (8 GB) by default. If a heavy Docker build runs out of memory, set buildMachineTier: performance on that service for 16 GB:

spec:
  services:
    - logicalKey: api
      name: api
      type: web
      buildMachineTier: performance
      build:
        strategy: dockerfile
        dockerfilePath: backend/Dockerfile
  • Performance builds bill at 4× the build-minute rate. Slimming the image so it builds on Standard keeps the included rate.
  • The setting applies from the next deploy. Applying the Blueprint does not redeploy unless you pass --deploy.
  • Performance needs both the workspace and the service on Starter or Pro. Otherwise apply reports an error for that service and leaves it unchanged; other services still apply.
  • Static sites always build on Standard. Apply reports an error for a static service that sets performance.
  • Omit the field to keep the service's current setting (Standard for a new service). blueprint export always writes it.
  • To use a different machine per environment, set the field in a bytstack.<slug>.yaml overlay.

Performance may not be enabled for your workspace yet. Until it is, keep standard or omit the field.

Native dependencies

Turn this on when a Node service needs native npm packages (image processing, SQLite addons, and similar) and generated image builds should run install scripts:

spec:
  services:
    - logicalKey: web
      name: web
      type: web
      runtime: nodejs
      nativeDependencies: true
  • Applies from the next deploy. Applying the Blueprint does not redeploy unless you pass --deploy.
  • Not allowed on static services or when build.dockerfilePath is set, use your Dockerfile for install behavior instead.
  • May remain unavailable until Native dependencies is enabled for the workspace; apply reports an error for that service and leaves it unchanged.
  • Omit the field to keep the current setting (false for a new service). blueprint export writes the field when it is on.
  • There is no separate billing SKU; longer native compiles can increase tier-weighted build minutes. See Native dependencies and Build minutes.

Availability

Export and validate work for every project. Diff and apply in the dashboard/CLI require Blueprint to be enabled for your workspace, ask your workspace admin or Bytstack support if those actions are unavailable.

See also

Blueprint (bytstack.yaml) | Bytstack Docs