# Service

> A service defined once per project.

A service defined once per project. Each environment has an instance with optional overrides.

## Fields

| Field | Type | Description |
| --- | --- | --- |
| `id` * | string |  |
| `project_id` * | string |  |
| `name` * | string |  |
| `kind` | `web`, `private`, `worker`, `cron` | Derived; `worker` has no port, `cron` has a schedule. Read-only. |
| `managed_by_manifest` | boolean |  |
| `created_at` * | string (date-time) |  |
| `updated_at` | string (date-time) |  |
| `source` | [ServiceSource](/docs/api/objects/service-source/) |  |
| `build` | [BuildSettings](/docs/api/objects/build-settings/) |  |
| `start` | string or null | Start command. Detected when empty. |
| `pre_deploy` | string or null | Runs once per deployment in a separate VM before traffic moves; failure stops the rollout. |
| `port` | integer or null |  |
| `healthcheck` | [Healthcheck](/docs/api/objects/healthcheck/) or any or null |  |
| `resources` | [ServiceResources](/docs/api/objects/service-resources/) |  |
| `replicas` | [Replicas](/docs/api/objects/replicas/) |  |
| `sleep_when_idle` | boolean | Scale to zero after 10 idle minutes; the first request wakes it in 1–3 s. |
| `private` | boolean | No public domain; reachable only on the environment's private network. |
| `cron` | [CronSettings](/docs/api/objects/cron-settings/) or any or null |  |
| `restart_policy` | object |  |
| `deploy` | object |  |
| `volumes` | array of [VolumeMount](/docs/api/objects/volume-mount/) |  |

\* always present

## Example

```json
{
  "id": "svc_01jbx2m9k7q4r8t5v6w3y0z1sv",
  "project_id": "prj_01jbx2m9k7q4r8t5v6w3y0z1pr",
  "name": "web",
  "kind": "web",
  "managed_by_manifest": true,
  "source": {
    "kind": "git",
    "repo": "primecarers/platform",
    "root": "apps/web",
    "watch": [
      "apps/web/**",
      "packages/ui/**",
      "pnpm-lock.yaml"
    ]
  },
  "build": {
    "builder": "railpack"
  },
  "start": "pnpm --filter web start",
  "pre_deploy": "pnpm --filter db migrate deploy",
  "port": 3000,
  "healthcheck": {
    "type": "http",
    "path": "/healthz",
    "timeout_seconds": 10
  },
  "resources": {
    "cpu": 2,
    "memory_mb": 2048
  },
  "replicas": {
    "min": 2,
    "max": 6,
    "scale_on": {
      "cpu_percent": 70,
      "concurrency": 80
    }
  },
  "sleep_when_idle": false,
  "private": false,
  "cron": null,
  "created_at": "2026-10-22T09:30:00Z",
  "updated_at": "2026-10-23T10:00:00Z"
}
```

## Used by

- [Create a service](/docs/api/services/#create-a-service)
- [Get a service's base settings](/docs/api/services/#get-a-services-base-settings)
- [Update a service's base settings](/docs/api/services/#update-a-services-base-settings)
