> For the complete documentation index, see [llms.txt](https://bus.node-ts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bus.node-ts.com/guide/persistence/postgres.md).

# Postgres

**@node-ts/bus-postgres** provides a persistence adapter based on Postgres that's used when storing workflow state.

### Installation

Install the **@node-ts/bus-postgres** package

```
npm install @node-ts/bus-postgres
```

Create a new **PostgresPersistence** instance and provide it to the bus configuration.

```typescript
import { Bus } from '@node-ts/bus-core'
import { PostgresPersistence, PostgresConfiguration } from '@node-ts/bus-postgres'

const postgresConfiguration: PostgresConfiguration = {
  connection: {
    connectionString: 'postgres://postgres:password@localhost:5432/postgres'
  },
  schemaName: 'workflows'
}
const postgresPersistence = new PostgresPersistence(postgresConfiguration)
await Bus
  .configure()
  .withPersistence(postgresPersistence)
  .initialize()
```
