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

# Packages

> Versioned install definitions that power products, offers, and direct installs

A Package is the reusable install definition behind an Akua Install. It owns the source, the version history, and the input schema that the dashboard, the API, and the Offer wizard use.

Products and Offers build on Packages. A Product is the sellable wrapper customers discover or buy. An Offer is the shareable sales path for a Product. The Package is the technical contract both of them point at.

You

Package
versions and an input form

To sell it

Product and Offer
a link you send

Your customer

Their own Install
after they redeem it

To run it yourself

Direct Install
no Product, no Offer

## Package first, deployment second

Akua starts from an explicit Package, not from automatic framework detection. Prefer the [Akua Package format](https://docs.akua.dev/akua/package-format.md): an `akua.toml` manifest and a `package.k` program. `akua pkg publish` hosts the Package privately in your Workspace, with no registry of your own. Helm charts work too, hosted the same way or imported from an external OCI repository. Akua does not infer production settings from `package.json`, a Dockerfile, or a Git branch.

If your application is not a Helm chart yet, the [Compose converter](https://docs.akua.dev/tools/compose-converter.md) turns a Docker Compose file into Kubernetes manifests and a Helm chart you can publish to an OCI repository.

Container images are separate from the Package archive. For private images, connect your image registry as an Upstream and write the resolved Akua image path into your Package. Customer workloads pull through Akua without receiving your upstream credential. Follow [Private images](https://docs.akua.dev/private-images.md) for the complete publish-and-install example. Akua does not rewrite image references or host image layers.

## What a Package owns

| Surface | Owned by Package |
| - | - |
| **Source** | Where versions come from: private hosting at Akua (`hosted`) or an external OCI repository (`oci`) |
| **Versions** | Immutable Package versions, each `publishing`, `published`, or `failed` |
| **Format** | Each version's format, `akua-package` or `helm-chart`, kept as published |
| **Input schema** | The customer-facing fields: a native Package's `schema Input`, or a chart's values and values schema |
| **Defaults** | The chart's default values, used by Products, Offers, and direct Installs |

Packages do not own pricing, customer targeting, or payment collection. Those belong to Products and Offers.

## Package, Product, Offer

* Create a **Package** when you need a reusable install definition.
* Create a **Product** when that Package version should become a sellable catalog item.
* Create an **Offer** when you want to send a customer a short URL with selected inputs and commercial terms.
* Use a **direct Install** when the Package should run without a Product or Offer.

## Publish a Package privately

Sign in with `akua auth login`, or set `AKUA_API_TOKEN` in CI. Select the owning Workspace, then publish from your Package directory:

```bash
akua workspaces use my-team
akua pkg publish
```

The CLI creates the Package on first use, uploads the archive with its signature and attestation when signing is configured, publishes the version and waits until it is `published` or `failed`. Archives are limited to 4 MiB compressed; remove build output and unneeded vendored files if you exceed it. A hosted version tag is immutable: change the version in `akua.toml` to publish different bytes.

Hosted Package reads and writes require the owning Workspace's permissions. Installing a Package does not give the customer permission to download its source archive.

### Image checks

Before a version is published, Akua renders it with its default inputs and checks the image of every container in standard Kubernetes Pod specs, including init containers and the Pod templates of Deployments, StatefulSets, DaemonSets, Jobs and CronJobs. Each private `pkg.akua.dev` image path must resolve through an Upstream of your Workspace. Public images are not checked. Akua does not guess images from Helm values and does not rewrite rendered images; images that an operator creates from a custom resource are not checked.

If a private image does not resolve, the version becomes `failed` with the reason `image-unresolvable`, and the publish Operation lists each image with the registry's reason. `akua pkg publish` prints them together with the command that checks each image against its Upstream:

```bash
akua registry resolve-image ghcr-acme --image ghcr.io/acme/web:1.2.3
```

Fix the image path or the Upstream, then publish the version again.

### Push a Helm chart from CI

Create a hosted Package once, then push the chart with Helm and publish its version. Use the Package ID the first command returns:

```bash
akua packages create --name web --source '{"kind":"hosted","chart":"web"}' --json
printf '%s' "$AKUA_API_TOKEN" | docker login pkg.akua.dev --username akua --password-stdin
helm push web-1.2.3.tgz oci://pkg.akua.dev/WORKSPACE_ID/packages/PACKAGE_ID
akua packages create-version PACKAGE_ID --body-version 1.2.3
akua operations wait OPERATION_ID
```

Replace `WORKSPACE_ID` with the owning Workspace ID, `PACKAGE_ID` with the created Package's `data.id`, and `OPERATION_ID` with the publication Operation ID. Start with a packaged chart named `web-1.2.3.tgz`. Repeat the wait if `done` is `false`; require `state: SUCCEEDED` before installing.

The registry password is your Akua API token or login; the username is ignored. Helm appends the chart name to the repository, so it must match the Package's `chart`. `pkg.akua.dev` accepts blobs up to 4 MiB. `helm push` uses chunked upload requests; `akua pkg publish` uses single-request uploads.

### Publish to an external registry

`akua pkg publish --ref oci://ghcr.io/acme/web` keeps publishing to a registry you run. Authenticate to it through Akua's `auth.toml` or the inline `auths` of Docker's `config.json`; Docker credential helpers are not read.

When you point the CLI at another API environment with `AKUA_API_URL`, also set `AKUA_REGISTRY_URL` to that environment's registry origin. Hosted publication never saves your credential to Docker's configuration.

External publication credentials need write access to that repository. They are separate from the read-only image credential you store for an Upstream. Publishing with `--ref` does not create or publish a hosted platform Package.

## Import a Helm chart from an external OCI repository

A Package needs a Helm chart that is already pushed to a public OCI repository, and each version needs that chart tag. Building and pushing the chart is work for your coding agent: in the dashboard, open **Packages** and copy the prompt there into your agent. It turns your app into a chart if needed, pushes it and creates the Package or publishes the version with the Akua CLI. If your agent is not set up yet, start with [Agent setup](https://docs.akua.dev/agent-setup.md).

If the chart is already in a public OCI repository, enter its repository, chart name and version tag yourself under **Or enter it yourself** in the dashboard, or use the API:

| Goal | Endpoint | Result |
| - | - | - |
| Create a Package from a Helm chart | `POST /packages` | Returns the Package with no versions yet |
| Publish a version | `POST /packages/{id}/versions` | Returns an Operation to poll |
| Read a Package and its versions | `GET /packages/{id}` | The Package with every version and its status |
| Read a version's input schema | `GET /packages/{id}/versions/{version_id}/inputs` | The schema the install wizard renders |

```bash
curl https://api.akua.dev/v1/packages \
  -H "Authorization: Bearer $AKUA_API_TOKEN" \
  -H "Akua-Context: ws_xxx" \
  -H "Idempotency-Key: create-web-package" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "web",
    "source": {
      "kind": "oci",
      "repository": "oci://ghcr.io/acme/charts",
      "chart": "web"
    }
  }'
```

Publishing a version names a chart version tag such as `1.2.3`. For an `oci` source, Akua pulls the chart at that tag from the repository anonymously, verifies its digest and keeps it, then reads its values schema and defaults. A version number is published once. Poll the returned Operation until it is done.

Retry either call with the same `Idempotency-Key` to receive the same result.

## Input schemas

Akua records each Package version's input schema when the version is published and uses it to drive the generated form. For an Akua Package it is the `schema Input` in `package.k`, exported as JSON Schema the way `akua pkg export` prints it; for a Helm chart it comes from the chart's values and values schema. A field's `title` becomes its label and its `description` the help text. `x-ui` annotations control grouping, ordering, placeholders, and sensitive fields. For the annotation keys the wizard reads, see [Package format](https://docs.akua.dev/akua/package-format#@ui-annotations). For the customer-facing form, see [Offers](https://docs.akua.dev/marketplace/offers.md).

### Install-provided inputs

Declare any of these reserved string fields in the Package's `Input` schema to bind a platform-provided value:

| Input | Value |
| - | - |
| `namespace` | The Install's Kubernetes namespace |
| `release_name` | A Helm release name unique to the Install |
| `primary_url` | The Install's primary managed URL from its persisted Route, or `""` without a Route |

```kcl
import akua.ctx

schema Input:
    namespace: str = "default"
    release_name: str = "web"
    primary_url: str = ""

input: Input = ctx.input()

resources = [{
    apiVersion = "v1"
    kind = "ConfigMap"
    metadata = {name = input.release_name, namespace = input.namespace}
    data = {APP_URL = input.primary_url}
}]
```

These values override Package defaults, customer inputs and Offer values. The generated form and YAML editor exclude them. A Package that does not declare them receives its inputs unchanged.

`primary_url` includes the application's served path, such as `https://app.example.com/app`, not just its origin. Before applying resources, Install renders in isolation to discover the HTTP output. If its path changes the reserved or previously published URL, Install evaluates the Package once more with the full URL. Only the final output is applied. This also handles updates that change the served path; a Package whose output path changes again during binding is rejected rather than deploying mismatched callback settings. Keep the HTTP output path independent of `primary_url`.

The value is available to the first applied workload; it does not require an already running application. It is not a readiness signal: the address starts serving only after publication and health checks succeed. The Package receives the primary URL, not a list of custom-domain aliases. Use it for application callback or webhook settings; an application that needs an origin allowlist must extract the origin in its own Package configuration. Do not reconstruct hostnames from Install IDs or hardcode a deployment domain.

`release_name` keeps two Installs of the same Package apart: a chart labels its pods `app.kubernetes.io/instance: {{ .Release.Name }}` and selects on that label from its Service, so two Installs sharing a release name would share those selectors.

This uses ordinary KCL inputs, not a CLI-specific annotation. For standalone `akua pkg render`, provide local values with `--inputs`; `akua pkg export` exports the declared fields normally. See the [Package input contract](https://github.com/akua-dev/akua/blob/main/docs/package-format.md#renderer-provided-inputs).

## Expose an HTTP service on managed KaaS

Render an HTTPRoute with a hostname, a Service backend, and the `routing.akua.dev/output-name` annotation so Akua can route traffic to it:

```yaml
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: web
  annotations:
    routing.akua.dev/output-name: web
spec:
  hostnames:
    - web-acme.akua.run
  rules:
    - backendRefs:
        - name: web
          port: 80
```

The annotation identifies the Package output. `spec.hostnames` defines its public hostname, and `backendRefs` selects the Service and numeric port that receive traffic.

The example uses an Akua-managed preview hostname. [App addresses](https://docs.akua.dev/networking.md) provide flat `*.akua.run` hostnames with managed DNS and TLS.

## API

> [card] [Create a Package](https://docs.akua.dev/api-reference/packages/create-package.md)
>
> Create a private hosted Package or import a Helm chart from a public OCI repository.

> [card] [Create a Package version](https://docs.akua.dev/api-reference/packages/create-package-version.md)
>
> Publish one version as an immutable Package version.

> [card] [Products API](https://docs.akua.dev/api-reference/products/list-products-in-workspace.md)
>
> Wrap a Package version into a sellable product.

> [card] [Installs API](https://docs.akua.dev/api-reference/installs/create-install.md)
>
> Run a Package version as a direct Install.

## Related topics

> [card] [Products](https://docs.akua.dev/products.md)
>
> Turn a Package into a sellable catalog item.

> [card] [Package format](https://docs.akua.dev/akua/package-format.md)
>
> The open-source package format and its `@ui` annotations.
