---
title: Host lifecycle
description: Compose connection, plan review, apply, receipt-bound cleanup, and disconnect actions into a host-owned domain row and product lifecycle.
---

This integration level keeps DomainKit’s controllers and dialogs while your application owns the
outer lifecycle row and decides when each action is available.

<ReactExample story="host-lifecycle" />

## Installation

```package-install
@domainkit/react domainkit effect @effect/atom-react react react-dom
```

## Lifecycle ownership

Provisioning and cleanup are separate reviewed operations:

1. `Provisioning.Flow` requests an exact `create` / `noop` / `conflict` plan.
2. The user authorizes that plan’s digest before the host applies it.
3. The host persists the returned receipt, including partial results.
4. `Cleanup.Flow` plans deletion from that receipt and requests separate authorization.

Do not treat disconnecting a provider as cleanup. Your product decides whether cleanup is required,
whether a receipt remains valid, and whether a user may remove records.

## Product readiness

A completed provider write is not proof that public DNS has propagated. Use
[Verification](/components/verification) and combine its provider/public-DNS observations with your
own product readiness policy.

## Accessibility

Keep destructive cleanup and disconnect actions distinguishable in text, not color alone. Preserve
the confirmation dialogs, loading states, and failure outcomes supplied by the semantic parts.

## API reference

### `Provisioning.Flow`

| Prop | Type | Default | Description |
| - | - | - | - |
| `connection` | `Transport.Connected` | - | Connected domain attachment used to plan and apply records. |
| `onApplied?` | `(result: Applied \| Partial) => void` | - | Called after the host returns a complete or partial apply result. |
| `records` | `ReadonlyArray<Transport.DnsRecord>` | - | Product-owned DNS requirements included in the immutable plan. |
| `showRecords?` | `boolean` | `true` | Whether the flow renders the records table alongside its review action. |
| `trigger?` | `ReactElement` | - | Optional element rendered as the review trigger. |

### `Cleanup.Flow`

| Prop | Type | Default | Description |
| - | - | - | - |
| `connection` | `Transport.Connected` | - | Connected domain attachment whose applied records may be cleaned up. |
| `onCleaned?` | `(result: Cleanup.Completion) => void` | - | Called after the host returns a complete or partial cleanup result. |
| `receiptId` | `string` | - | Apply receipt that bounds the records eligible for cleanup. |
| `trigger?` | `ReactElement` | - | Optional element rendered as the cleanup review trigger. |

### `Connection.DisconnectDialog`

| Prop | Type | Default | Description |
| - | - | - | - |
| `connection` | `Transport.Connected` | - | Connected domain attachment to disconnect. |
| `controller` | `Connection.Controller` | - | Controller that performs the detach operation. |
| `onOpenChange?` | `(open: boolean) => void` | - | Called when the dialog's open state changes. |
| `open?` | `boolean` | - | Controlled open state. Omit it to use the dialog's internal state. |
| `trigger?` | `ReactElement \| null` | - | Optional trigger element. Pass null to render no trigger. |

Read [Plans, authorization, and receipts](/docs/core/plans) for the lifecycle invariants behind
these controls.
