> Index of every page on this site: [llms.txt](https://docs.a-line.cloud/llms.txt)

# Use your own domain for generated names

> Add a hostname base so apps get generated names under your own domain, served with one wildcard certificate.

**Goal**: apps get their generated names under your own domain, such as
`api.apps.example.com` instead of a name under the A-Line content domain, without
adding a custom domain per app.

A **hostname base** is a name such as `apps.example.com`. Generated app names
become `<app>[--env].<base>`, all served with one wildcard certificate for
`*.apps.example.com`. Custom domains on apps are not affected.

## Before you start

- The organization **Admin** role.
- A dedicated cluster. Hostname bases need a dedicated cluster for now: a
  base's wildcard record points at one cluster's edge. Apps on the hosted
  platform keep their A-Line names.
- The parent domain (`example.com`) verified for the **whole domain** on the
  **Domains** page (see [organization domains](/concepts/domains#organization-domains)).
  The base must sit strictly under it.
- Access to the DNS records of that domain.

## Add a hostname base

<Steps>
<Step>

Open **Domains** and find **Hostname bases**.

</Step>
<Step>

Enter the **Base name**, such as `apps.example.com`, pick the **Cluster** that
serves it and select **Add hostname base**.

</Step>
<Step>

The base shows **Waiting for DNS** with two CNAME records. Create both at
your DNS provider:

- `*.apps.example.com` pointing at the cluster's edge.
- `_acme-challenge.apps.example.com`, which lets A-Line.cloud issue the
  wildcard certificate. Your other records stay yours.

</Step>
<Step>

Select **Check now**. Once both records resolve, the base moves to **Issuing
certificate** and then **Active**.

</Step>
</Steps>

A base serves `*.<base>` from its cluster, so only projects on that cluster
can use it.

## Use the base

Pick the base at the level you want. An environment's pick wins over a
project's, and a project's over the organization default.

| Level | Where | Choice |
| --- | --- | --- |
| Organization | **Domains** > **Hostname bases** > **Make default** | Every project and environment that inherits it. |
| Project | **Project settings** > **Network** > **Hostnames** > **Hostname base** | **Organization default**, **A-Line content domain** or one of the bases. |
| Environment | The environment's **General** settings > **Hostname base** | **Each project's setting**, **A-Line content domain** or one of the bases. |

Changing the base asks you to confirm **Move app names**: apps whose
generated name changes get the new one at once, and their old names keep
serving for 7 days, so links don't break mid-deploy. **Stop using as
default** moves apps that inherited the base back to the A-Line content domain, with
the same 7 days.

In a [project link](/guides/iac-project-link), set the project's base in
`project.yaml`; the console then shows the pick as set by `project.yaml`:

```yaml title="projects/shop/project.yaml" iac
# yaml-language-server: $schema=https://a-line.cloud/schemas/iac/v1.json
version: 1
name: shop
cluster: hetzner-fsn1
hostnames:
  base: apps.example.com
```

Use `platform` for the A-Line content domain, or leave `hostnames` out to inherit.
The bases themselves are listed under
[`hostname_bases`](/iac/reference/types#tenantsection-hostname_bases) in an
organization bundle.

[Pull request previews](/guides/pr-previews#domains) can also use a hostname
base for their names.

## Verify

The base shows **Active**. Open an app on a project that uses it: its
generated name ends in your base and serves a valid certificate.

## Troubleshooting

- **Stays on Waiting for DNS**: both CNAME records must resolve to the values
  shown. A CNAME can't share its name with other records. Then select **Check
  now** again.
- **Broken**: the records disappeared or the parent domain failed
  verification. The base keeps serving its last certificate; restore the
  records and check again.
- **Can't add the base**: it must be strictly under a whole domain your
  organization verified, and not under an A-Line domain.
- **Can't delete the base**: projects or environments still use it. Pick
  another base for them first. Deleting stops its wildcard route and
  certificate at once.

## Next steps

- [Add a custom domain](/guides/custom-domain) to a single app.
- [Preview pull requests](/guides/pr-previews).
