# Chat SDK adds PostgreSQL state adapter

**Published:** March 10, 2026 | **Authors:** Hayden Bleasel, Ben Sabic

---

Chat SDK now supports PostgreSQL as a state backend, joining Redis and ioredis as a production-ready option with the new [PostgreSQL adapter](https://chat-sdk.dev/adapters/official/postgres).

Teams that already run PostgreSQL can persist subscriptions, distributed locks, and key-value cache state without adding Redis to their infrastructure.

**Try the PostgreSQL state adapter today:**

```typescript
import { Chat } from "chat";
import { createPostgresState } from "@chat-adapter/state-pg";

const bot = new Chat({
  userName: "mybot",
  adapters: {
    /* ... */
  },
  state: createPostgresState(),
});
```

The adapter uses [pg](https://www.npmjs.com/package/pg) (node-postgres) with raw SQL queries and automatically creates the required tables on first connect. It supports TTL-based caching, distributed locking across multiple instances, and namespaced state via a configurable key prefix.

Read the [documentation](https://chat-sdk.dev/adapters/official/postgres) to get started, browse the [directory](https://chat-sdk.dev/adapters), or build your own [adapter](https://chat-sdk.dev/docs/contributing/building).

*Special thanks to *[*@bai*](https://github.com/bai)*, whose community contribution in *[*PR #154*](https://github.com/vercel/chat/pull/154)* laid the groundwork for this adapter.*

**The Complete Guide to Chat SDK**
Learn how Chat SDK works end-to-end: from core concepts to building your first chatbot to deploying it across platforms.
[Read the guide](https://vercel.com/kb/guide/the-complete-guide-to-chat-sdk)

---

📚 **More updates:** [View all changelog entries](/changelog/sitemap.md) | [Blog](/blog/sitemap.md)