> ## Documentation Index
> Fetch the complete documentation index at: https://docs.xano.com/llms.txt
> Use this file to discover all available pages before exploring further.

# XanoScript Reference

> The microservice block, for both built-in and Helm deployment types.

A workspace microservice is stored as a XanoScript `microservice` block. The Add Microservice form writes it for you and keeps it in sync as you fill the form, so you never have to write it by hand — but the script is the stored definition, it is what appears in release diffs, and **Edit script directly** hands it to you.

<Note>
  The XanoScript language service does not yet know the `microservice` type, so editor validation is suppressed while the script is a form-driven mirror, and re-enabled once you take it over with **Edit script directly**.
</Note>

## Built-in deployment

```xs theme={null}
microservice echo_docker {
  description = "Echo server (Docker image)"
  tenant_deploy = "auto"

  deployment {
    container echo_docker {
      image = "ealen/echo-server:latest"
      ports = [{containerPort: "80", servicePort: "80"}]
      resources = {cpu: "250m", ram: "512Mi"}
    }
  }
}
```

With a private image, a `pull_secret` line is added naming the microservice-owned secret Xano provisions:

```xs theme={null}
microservice private_api {
  tenant_deploy = "auto"

  deployment {
    container private_api {
      image = "myorg/private-api:1.4.0"
      pull_secret = "private_api-pull"
      ports = [{containerPort: "8080", servicePort: "80"}]
      resources = {cpu: "500m", ram: "1024Mi"}
    }
  }
}
```

## Helm deployment

```xs theme={null}
microservice echo_helm_oci {
  description = "Echo server (Helm chart from an OCI registry)"
  kind = "helm"
  tenant_deploy = "auto"

  chart {
    ref = "oci://us-docker.pkg.dev/xano-registry/public/echo-server"
    version = "0.5.0"
  }
}
```

Multi-line chart values are rendered as a triple-quoted block:

```xs theme={null}
microservice echo_helm_repo {
  kind = "helm"
  tenant_deploy = "manual"

  chart {
    ref = "https://ealenn.github.io/charts echo-server"
    version = "0.5.0"
    values = """
      replicaCount: 2
      deploy: test
      """
  }
}
```

## Reference

### Top level

The block is opened with `microservice` followed by an identifier. The identifier is the microservice **name** sanitized: lowercased, with each run of non-alphanumeric characters collapsed to a single underscore, and leading and trailing underscores stripped. A microservice named `Echo Docker` yields the identifier `echo_docker`.

<ParamField path="description" type="string">
  Optional. Shown next to the name in the microservices list. Omitted from the script entirely when blank.
</ParamField>

<ParamField path="kind" type="string" default="builtin">
  `"helm"` for a bring-your-own-chart microservice. Omitted for the built-in type, which is the default.
</ParamField>

<ParamField path="tenant_deploy" type="string" default="auto">
  `"auto"` or `"manual"`. Both ship the microservice with a tenant release; `"manual"` does not deploy it in the tenant automatically. See [Releases and tenants](/enterprise/enterprise-features/microservices/workspace-microservices/releases-and-tenants).
</ParamField>

### deployment

Present for the built-in type. Holds one or more `container` blocks, each opened with `container` followed by an identifier — for a single-container microservice this matches the microservice identifier.

<ParamField path="image" type="string" required>
  The container image, as you would pass it to `docker pull`.

  <CodeGroup>
    ```text Shape theme={null}
    {repository}/{image}:{tag}
    ```

    ```text Example theme={null}
    ealen/echo-server:latest
    ```
  </CodeGroup>
</ParamField>

<ParamField path="pull_secret" type="string">
  The pull secret for a private image. Xano provisions a microservice-owned secret named `<identifier>-pull`; this line is emitted only when private-registry credentials are configured. See [Private registries](/enterprise/enterprise-features/microservices/workspace-microservices/private-registries).
</ParamField>

<ParamField path="ports" type="array" required>
  An array of port objects. `servicePort` is the port Xano exposes and the one you address from the function stack; `containerPort` is what the application listens on inside the container, defaulting to `servicePort`.

  ```xs theme={null}
  ports = [{containerPort: "8080", servicePort: "80"}, {containerPort: "9090", servicePort: "9090"}]
  ```
</ParamField>

<ParamField path="resources" type="object" required>
  CPU and RAM allocation as raw Kubernetes resource strings — CPU in millicores, RAM in mebibytes.

  ```xs theme={null}
  resources = {cpu: "500m", ram: "1024Mi"}
  ```

  The form's presets map to `100m`/`128Mi` (Tiny), `250m`/`512Mi` (Small), `500m`/`1024Mi` (Medium), `1000m`/`2048Mi` (Large), and `3500m`/`7168Mi` (X-Large).
</ParamField>

### chart

Present when `kind = "helm"`, in place of `deployment`.

<ParamField path="ref" type="string" required>
  The chart reference, in any of the four supported forms.

  <CodeGroup>
    ```text OCI registry theme={null}
    oci://us-docker.pkg.dev/xano-registry/public/echo-server
    ```

    ```text Direct .tgz URL theme={null}
    https://ealenn.github.io/charts/echo-server-0.5.0.tgz
    ```

    ```text Pre-added repo theme={null}
    my-repo/echo-server
    ```

    ```text Classic HTTP repo theme={null}
    https://ealenn.github.io/charts echo-server
    ```
  </CodeGroup>
</ParamField>

<ParamField path="version" type="string">
  The chart version. Omitted for a direct `.tgz` URL, where the version is already in the filename.
</ParamField>

<ParamField path="values" type="string">
  Chart values as YAML, equivalent to `helm install -f`. A single-line value is a plain quoted string; multi-line values use a triple-quoted block, with the content lines and the closing quotes indented one level deeper than the `values =` line.

  <Warning>
    Values may contain secrets, so they are masked server-side and never returned. A microservice read back from Xano will not include its `values`, and it cannot be edited from the UI after creation.
  </Warning>
</ParamField>


## Related topics

- [Microservices in the Workspace](/enterprise/enterprise-features/microservices/workspace-microservices.md)
- [Creating a Microservice](/enterprise/enterprise-features/microservices/workspace-microservices/creating-a-microservice.md)
- [XanoScript Filter Reference](/xanoscript/filter-reference.md)
