{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.smallrun.app/manifest.schema.json",
  "title": "SmallRun app manifest",
  "description": "Draft. Describes one SmallRun app, in `smallrun.yaml`. Every field is optional; `name` defaults to the folder's name. A deploy with no manifest works for one HTTP port and no database. Every file the app writes is kept, so there is no volume field.",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "name": {
      "type": "string",
      "description": "App name. The app is served at https://<name>.smallrun.org. Optional; without it, the folder's name.",
      "pattern": "^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$"
    },
    "http": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "port": {
          "type": "integer",
          "minimum": 1,
          "maximum": 65535,
          "description": "Optional. The one HTTP port the app listens on. Without it, SmallRun sets PORT=8080 and finds the port the app opens. Plain HTTP; TLS ends at the edge."
        }
      }
    },
    "health": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "path": {
          "type": "string",
          "description": "Path of the health check, for example /healthz."
        }
      }
    },
    "runtime": {
      "type": "string",
      "pattern": "^(php|node|python|dotnet)@[0-9]+(\\.[0-9]+)?$",
      "description": "Optional language line, for example php@8.3, node@22, dotnet@9. Detected from the source when absent. The platform keeps the patch version current."
    },
    "build": {
      "type": "string",
      "description": "Optional build command. Overrides automatic detection."
    },
    "start": {
      "type": "string",
      "description": "Optional start command of the web process. Overrides automatic detection."
    },
    "workers": {
      "type": "object",
      "description": "Optional background processes by name, run in the app's microVM beside the web process. Added to the detected ones.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "database": {
      "type": "string",
      "pattern": "^(postgres|mysql)(@[0-9][0-9.]*)?$",
      "description": "Optional. One private database inside the app's microVM: `postgres` or `mysql`, optionally with a pinned version such as `postgres@17`. The connection string is injected as DATABASE_URL."
    },
    "env": {
      "type": "object",
      "description": "Environment variables. Literal values, or references: ${app.url}, ${database.url|host|port|name|user|password}, ${secrets.<NAME>}. Never write a password as a literal.",
      "additionalProperties": {
        "type": "string"
      }
    },
    "sleep": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "after_idle": {
          "type": "string",
          "description": "Idle time before the app sleeps, for example 30m."
        }
      }
    }
  }
}
