# skopik.json Reference

Complete schema reference for single-bundle and multi-service skopik.json configuration files.

`skopik.json` is the single configuration file Skopik Platform reads at deploy time (maximum **64 KiB**). It supports two mutually exclusive forms: a **single-bundle** file for one Worker or static site, or a **multi-service** root file for repositories with multiple services and crons.

## Single-Bundle Configuration

Place `skopik.json` at the root of a Worker or static site directory. Unknown keys are rejected with `400 invalid_request`.

### Code Worker (`node`, `python`, `binary`)

```json
{
  "bindings": {
    "DB": { "database": "notes" },
    "TASKS": { "database": "tasks", "access": "read" },
    "FILES": { "bucket": "uploads" },
    "JOBS": { "queue": "jobs" },
    "EVENTS": { "topic": "chat/**" },
    "EMAIL": { "email": "no-reply@example.com" }
  },
  "mounts": {
    "/mnt/files": { "binding": "FILES" }
  }
}
```

### Static Site (`static`)

Static deployments accept only the `static` object (no `bindings` or `mounts`):

```json
{
  "static": {
    "spa": true,
    "clean_urls": true,
    "not_found": "404.html",
    "cache_control": [
      { "path": "/assets/*", "value": "public, max-age=31536000, immutable" },
      { "path": "/fonts/*", "value": "public, max-age=31536000, immutable" }
    ]
  }
}
```

| Field | Default | Description |
| --- | --- | --- |
| `spa` | `false` | Serves root `index.html` with `200` for extensionless or `.html` routes that do not match a file. |
| `clean_urls` | `false` | Serves `about.html` at `/about` directly from S3/CloudFront. |
| `not_found` | `"404.html"` | Custom file served with HTTP `404` when no route matches. |
| `cache_control` | `[]` | Up to 32 path rules (`*` matches one segment, `**` crosses segments). First match wins. |

## Multi-Service Repository (`services`)

For monorepos or repositories connected via [Git Integration](/docs/git-integration/) (or deployed with `skopik deploy --service <name>` / `--all`), define top-level `services` (up to 20):

```json
{
  "services": {
    "api": {
      "path": "apps/api",
      "runtime": "node",
      "build": "npm ci && npm run build",
      "output": ".",
      "env": { "LOG_LEVEL": "info" },
      "bindings": {
        "DB": { "database": "notes" },
        "FILES": { "bucket": "uploads" }
      },
      "preview": {
        "env": { "LOG_LEVEL": "debug" },
        "bindings": { "FILES": { "bucket": "uploads-preview" } }
      },
      "crons": {
        "nightly-report": { "schedule": "0 3 * * *", "path": "/cron/report" }
      }
    },
    "web": {
      "path": "apps/web",
      "runtime": "static",
      "build": "npm ci && npm run build",
      "output": "dist",
      "watch": ["packages/ui"],
      "static": { "spa": true }
    }
  }
}
```

| Service field | Description |
| --- | --- |
| `path` | Directory relative to repo root where `build` runs (defaults to `.`). |
| `runtime` | `node` (default), `python`, `binary`, or `static`. |
| `build` | Optional shell command run inside the build Sandbox (or locally with `skopik deploy --service`). |
| `output` | Directory relative to `path` packed as the deployment bundle (defaults to `.`). |
| `env` / `preview.env` | Up to 100 non-secret build-time variables. Stripped from the deployed bundle. |
| `watch` | Up to 20 extra repo paths whose changes trigger a rebuild of this service. |
| `bindings`, `mounts`, `static`, `preview` | Written into the service's bundle as its `skopik.json`. |
| `crons` | Up to 10 UTC cron jobs (`schedule`, `path` starting with `/` and not `/_mh`), reconciled on production pushes. |

> [!WARNING]
> When using `services`, do not place a second `skopik.json` inside a service's `output` directory — builds fail with `conflicting_settings`.
