# Tutorials

> Connect clients, roll back Redis writes with SQL, store binary data and build a transactional outbox.

---

LLMS index: [llms.txt](/llms.txt)

---

These tutorials use the `pgredis_demo` database and `pgredis_app` role created in [Quick start](/docs/redis/quickstart/), with PostgreSQL listening on `127.0.0.1:5432` and the `pgredis` gateway listening on `127.0.0.1:6379`.

Work through the examples in order:

1. [Connect a Redis client](/docs/redis/tutorial/redis-client/) — authenticate over RESP2 and RESP3, switch logical databases with `SELECT`, and write and read keys.
2. [Roll back SQL and Redis together](/docs/redis/tutorial/sql-rollback/) — modify a SQL table row and a Redis key in one PostgreSQL transaction and roll both back.
3. [Binary keys and values](/docs/redis/tutorial/binary-data/) — store and read raw byte sequences containing `NUL` (`\x00`) bytes through `redis.command_bin`.
4. [Transactional outbox](/docs/redis/tutorial/outbox/) — commit business rows and Redis Stream events in one transaction, then consume and acknowledge them idempotently with `XREADGROUP` and `XACK`.

---

Section pages:

- [Connect a Redis client](/docs/redis/tutorial/redis-client/): Authenticate with redis-cli or a driver, then write and read a key.
- [Roll back SQL and Redis together](/docs/redis/tutorial/sql-rollback/): Use one PostgreSQL transaction for a business row and a Redis key.
- [Binary keys and values](/docs/redis/tutorial/binary-data/): Store and read byte-exact keys and values through RESP and redis.command_bin.
- [Transactional outbox](/docs/redis/tutorial/outbox/): Commit business rows and Stream events together, then consume and acknowledge them.
