# WithDatabase

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

Adds database support to the Zitadel resource.

## Definition

```go
func (ZitadelResource) 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()`.

## Applies to

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