# Aspire.Hosting.PostgreSQL

- Module: `Aspire.Hosting.PostgreSQL`
- Version: `17.0.0`
- Import path: `apphost/modules/aspire`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/bcfa151cdca6d0a573f22d5d9c23f9c727cb3b2f)
- Functions: `15`
- Types: `5`

## Handles

- [PgAdminContainerResource](/reference/api/go/aspire.hosting.postgresql/pgadmincontainerresource.md) -- `handle` - 1 members
- [PgWebContainerResource](/reference/api/go/aspire.hosting.postgresql/pgwebcontainerresource.md) -- `handle` - 1 members
- [PostgresDatabaseResource](/reference/api/go/aspire.hosting.postgresql/postgresdatabaseresource.md) -- `handle` - 8 members -- A resource that represents a PostgreSQL database. This is a child resource of a `PostgresServerResource`.
- [PostgresMcpContainerResource](/reference/api/go/aspire.hosting.postgresql/postgresmcpcontainerresource.md) -- `handle` - 0 members
- [PostgresServerResource](/reference/api/go/aspire.hosting.postgresql/postgresserverresource.md) -- `handle` - 21 members -- A resource that represents a PostgreSQL container.

## Functions

- [AddPostgres](/reference/api/go/aspire.hosting.postgresql/addpostgres.md) -- `method` - on `DistributedApplicationBuilder` -- Adds a PostgreSQL resource to the application model. A container is used for local development.
- [WithHostPort](/reference/api/go/aspire.hosting.postgresql/withhostport-pgadmincontainerresource-float64.md) -- `method` - on `PgAdminContainerResource` -- Configures the host port that the PGAdmin resource is exposed on instead of using randomly assigned port.
- [WithHostPort](/reference/api/go/aspire.hosting.postgresql/withhostport-pgwebcontainerresource-float64.md) -- `method` - on `PgWebContainerResource` -- Configures the host port that the pgweb resource is exposed on instead of using randomly assigned port.
- [WithCreationScript](/reference/api/go/aspire.hosting.postgresql/withcreationscript.md) -- `method` - on `PostgresDatabaseResource` -- Defines the SQL script used to create the database.
- [WithPostgresMcp](/reference/api/go/aspire.hosting.postgresql/withpostgresmcp.md) -- `method` - on `PostgresDatabaseResource` -- Adds a Postgres MCP server container and configures it to connect to the database represented by `builder`.
- [AddDatabase](/reference/api/go/aspire.hosting.postgresql/adddatabase.md) -- `method` - on `PostgresServerResource` -- Adds a PostgreSQL database to the application model.
- [WithDataBindMount](/reference/api/go/aspire.hosting.postgresql/withdatabindmount.md) -- `method` - on `PostgresServerResource` -- Adds a bind mount for the data folder to a PostgreSQL container resource.
- [WithDataVolume](/reference/api/go/aspire.hosting.postgresql/withdatavolume.md) -- `method` - on `PostgresServerResource` -- Adds a named volume for the data folder to a PostgreSQL container resource.
- [WithHostPort](/reference/api/go/aspire.hosting.postgresql/withhostport-postgresserverresource-float64.md) -- `method` - on `PostgresServerResource` -- Configures the host port that the PostgreSQL resource is exposed on instead of using randomly assigned port.
- [WithInitFiles](/reference/api/go/aspire.hosting.postgresql/withinitfiles.md) -- `method` - on `PostgresServerResource` -- Copies init files to a PostgreSQL container resource.
- [WithPassword](/reference/api/go/aspire.hosting.postgresql/withpassword.md) -- `method` - on `PostgresServerResource` -- Configures the password that the PostgreSQL resource is used.
- [WithPgAdmin](/reference/api/go/aspire.hosting.postgresql/withpgadmin.md) -- `method` - on `PostgresServerResource` -- Adds a pgAdmin 4 administration and development platform for PostgreSQL to the application model.
- [WithPgWeb](/reference/api/go/aspire.hosting.postgresql/withpgweb.md) -- `method` - on `PostgresServerResource` -- Adds an administration and development platform for PostgreSQL to the application model using pgweb.
- [WithRepl](/reference/api/go/aspire.hosting.postgresql/withrepl.md) -- `method` - on `PostgresServerResource` -- Adds a REPL command that opens an authenticated PostgreSQL shell in the dashboard terminal dock.
- [WithUserName](/reference/api/go/aspire.hosting.postgresql/withusername.md) -- `method` - on `PostgresServerResource` -- Configures the user name that the PostgreSQL resource is used.
