# ZitadelResource.WithDatabase

- Module: [CommunityToolkit.Aspire.Hosting.Zitadel](/reference/api/go/communitytoolkit.aspire.hosting.zitadel.md)
- Defined on: [ZitadelResource](/reference/api/go/communitytoolkit.aspire.hosting.zitadel/zitadelresource.md)
- Version: `13.6.1`
- Kind: `method`

Adds database support to the Zitadel resource.

## Definition

```go
type ZitadelResource interface {
    // ... omitted for brevity
    WithDatabase(
        server PostgresServerResource,
        options ...*WithDatabaseOptions,
    ) ZitadelResource
}
```

## Signature

```go
WithDatabase(
    server PostgresServerResource,
    options ...*WithDatabaseOptions,
) ZitadelResource
```

## Parameters

- `server` ([`PostgresServerResource`](/reference/api/go/communitytoolkit.aspire.hosting.zitadel/postgresserverresource.md)) -- The Postgres server resource to use for the database.
- `options` (`...*WithDatabaseOptions`) -- optional settings, see [Options](#options)

## Options

Optional parameters are passed in a trailing `options ...*WithDatabaseOptions` argument.

- `DatabaseName` (`*string`) -- An optional name for the database Zitadel will use, if left empty will default to `"zitadel-db"`.

## Returns

[`ZitadelResource`](/reference/api/go/communitytoolkit.aspire.hosting.zitadel/zitadelresource.md)

Returns a handle; failures surface later via `Err()`.

## Defined on

- [ZitadelResource](/reference/api/go/communitytoolkit.aspire.hosting.zitadel/zitadelresource.md) -- `handle`
