> ## 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**.

## 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`.

**description** `string`

Optional. Shown next to the name in the microservices list. Omitted from the script entirely when blank.

**kind** `string` (default: builtin)

`"helm"` for a bring-your-own-chart microservice. Omitted for the built-in type, which is the default.

**tenant\_deploy** `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](https://docs.xano.com/enterprise/enterprise-features/microservices/workspace-microservices/releases-and-tenants.md).

### 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.

**image** `string` *required*

The container image, as you would pass it to `docker pull`.

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

```text Example theme={null}
ealen/echo-server:latest
```

**pull\_secret** `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](https://docs.xano.com/enterprise/enterprise-features/microservices/workspace-microservices/private-registries.md).

**ports** `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"}]
```

**resources** `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).

### chart

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

**ref** `string` *required*

The chart reference, in any of the four supported forms.

```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
```

**version** `string`

The chart version. Omitted for a direct `.tgz` URL, where the version is already in the filename.

**values** `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` is readable by anyone with access to the workspace: it is part of the microservice's XanoScript, so it comes back when you read the microservice and you can edit it in place. Do not put a secret here directly. Reference a workspace environment variable as `${env.NAME}` instead, inside single quotes in the YAML (`apiKey: '${env.STRIPE_KEY}'`), with a value on one line (see [Creating a microservice](https://docs.xano.com/enterprise/enterprise-features/microservices/workspace-microservices/creating-a-microservice.md#values)). It is resolved only when the microservice deploys.


## Related topics

- [XanoScript Filter Reference](https://docs.xano.com/xanoscript/filter-reference.md)
- [Intro to XanoScript](https://docs.xano.com/xanoscript/introduction.md)
- [XanoScript for Addons](https://docs.xano.com/xanoscript/addons.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.