1

Create a Sequin account

If you haven’t already, create a Sequin cloud account and login.

If you’re looking to self-host Sequin, start with our self-hosting guide.
2

Connect your database

In the Sequin console, click on the Connect Database button. Enter the connection details for your Postgres database (i.e. host, port, database name, username, and password).

With your database connected, create a replication slot. This allows Sequin to efficiently capture changes from your database using the WAL (Write-Ahead Log)

In your database, run the following SQL command to create a replication slot:

Create Replication Slot
select pg_create_logical_replication_slot('sequin_slot', 'pgoutput');

To finish setting up your replication slot, you’ll also create a publication to indicate which tables will publish changes to the replication slot.

In your database, run the following SQL command to create a publication:

Back in the Sequin Console, enter the name of the replication slot (e.g. sequin_slot) and publication (e.g. sequin_pub) you just created. Then, name your database and click Create Database.

Your database is now connected to Sequin!

3

Create a consumer

On the database page, click the Add a consumer button. Alternatively, you can navigate to the Consumers page and click Create Consumer.

As a first step, select the database and the table that contains the data you want to process in the consumer:

Click Continue. On the next screen, you’ll define any filters for the changes you want to capture:

Here, we’ve selected the public.orders table and applied a filter to only capture orders where the value is greater than 100. Click Continue.

With your table and filters selected, you’ll now select whether you want your consumer to process rows or changes:

  • Rows: Process rows to capture the latest state of records. Sequin delivers messages to the consumer whenever a row is inserted or updated.
  • Changes: Process changes to capture every insert, update, and delete. This includes OLD values for updates and deletes.

Next, select whether you want to recieve changes via HTTP Push (i.e. Webhooks) or HTTP Pull (i.e. SQS). For this quickstart, we’ll select HTTP Push:

On the next screen, you’ll enter the final details for your consumer. To get up and running, give the consumer a simple name (i.e. sequin-quickstart). No need to adjust the default timeout or add an endpoint path.

Under “HTTP Endpoint”, you can click the link Create and use a new Webhook.site endpoint. This will generate a new HTTP endpoint on Webhook.site that you can use for test purposes:

You can use encrypted headers to authenticate messages deliverd by your consumer.

Finally, click on Create Consumer to finish creating your consumer:

If you created a changes consumer, Sequin will now verify that the replica identity for the table is properly configured. If its not, you’ll see a message prompting you to run a SQL command to set the replica identity to full.
4

Capture changes

You’ve now connected your database to Sequin, setup a consumer to capture changes, and defined where to send the changes. The last step is to trigger a message to see this in action.

To trigger a message, insert a new row on your table. You’ll see a new message arrive at your endpoint:

After the record is inserted, it appears as a JSON object in the message payload sent to your endpoint.

Keep in mind, that Sequin will automatically retry sending messages on failure to provide an exactly-once processing guarantee.

Next steps

You’ve now walked through the basics of connecting your database, creating a consumer, and capturing changes. Now you can write the business logic in your application to react to the changes.

From here, you might want to:

  • Learn more about how Sequin works.
  • Explore the advanced configurations for push consumers and pull consumers.
  • Star the repository to stay on top of the latest updates.