# 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()
```
