Overview
Configure Sequin resources like databases, sinks, and HTTP endpoints using YAML. You can provide YAML configuration to Sequin in three ways:- Via a configuration file using the
CONFIG_FILE_PATHenvironment variable - Directly as base64-encoded YAML using the
CONFIG_FILE_YAMLenvironment variable - Via the Sequin CLI using the
sequin config export|plan|applycommand group
Schema
Account configuration
Creating accounts is only supported on self-hosted Sequin.
User configuration
API token configuration
You can create API tokens for your account. This is intended for use in development or CI/CD workflows:Creating API tokens is only supported on self-hosted Sequin.
Database configuration
These database entries tell Sequin which Postgres instances to capture changes from. They are separate from the Postgres database that Sequin itself uses, which is configured via the
PG_* environment variables.Replica database configuration
When connecting a replica to Sequin, Sequin also needs to connect to the primary database.Replication slot and publication configuration
Sequin uses PostgreSQL’s logical replication to capture changes from your database. This requires a replication slot and a publication.Replication slot
After following the instructions in the Sequin console to create a replication slot, you can indicate the name of the slot in theslot block. Alternatively, you can choose to have Sequin create the slot for you by setting create_if_not_exists to true:
Publication
After following the instructions in the Sequin console to create a publication, you can indicate the name of the publication in thepublication block. Alternatively, you can choose to have Sequin create the publication for you by setting create_if_not_exists to true:
create_if_not_exists is true, Sequin will attempt to create the publication if it doesn’t exist. If you specify init_sql, Sequin will run that SQL to create the publication. Otherwise, Sequin will create a publication for the schema “public”.
Database connection retry
When creating a database, Sequin needs to be able to connect to the database in order to read the database’s schema. Theawait_database configuration allows you to control how Sequin attempts to connect to your database during startup. This option is most relevant in development environments, where you might be provisioning Sequin and your database at the same time.
By default, Sequin will wait up to 30 seconds for the database to be ready and will retry every 3 seconds. You can customize this behavior by setting the timeout_ms and interval_ms options.
Sink configuration
A sink streams data from one or more tables to a destination (sink). All sinks share these configuration options:Sink source
When no source configuration is specified, Sequin will capture changes from every table exposed by the publication. When new schemas or tables are added, they are automatically included. You can also specify schemas and tables to include or exclude from the stream.- Include only selected schemas or tables: Choose the schemas and tables you care about; changes from only those schemas and tables will be processed in your sink.
- Exclude specific schemas or tables: Start with everything in the publication, then list the schemas or tables you want to omit. Future schemas and tables will be included in your sink unless they appear on your exclusion list.
For Sequin to stream changes from a table, your publication must include that table.
Sink actions
Additionally, you can specifyactions to stream. By default, all actions (insert, update, delete) are included. read events are emitted during backfills and are always included.
Initial backfill
You can configure an initial backfill to run when a sink is created. This only applies when the sink is first created via YAML; updating an existing sink will not trigger a backfill. Simple syntax - full backfill of all tables in the source:sort_column (the column to order by) and start_position (where to start the backfill from).
To trigger a backfill on an existing sink, use the Management API or the web console.
Message grouping
Themessage_grouping field controls whether messages are grouped for ordering purposes. When enabled (default), messages are grouped by primary key or custom grouping columns, ensuring ordered delivery within each group. When disabled, messages are not grouped, which may allow for higher throughput for some sinks.
true(default): Enable message grouping. Messages are grouped by primary key unless overridden by table-levelgroup_column_namesfalse: Disable message grouping. Cannot be used with table-levelgroup_column_names
Sink functions
Theenrichment, transform, filter, and routing fields allow you to attach functions to your sink. Each field can be set to either:
- The name of a function defined in the
functionssection "none"to explicitly disable that type of function
Sink destinations
Thedestination configuration varies by sink type. Below are the configurations for each sink type:
Webhook sink
For sending changes to HTTP endpoints:Typesense sink
For indexing documents into a Typesense collection:Meilisearch sink
For indexing documents into a Meilisearch index:Elasticsearch sink
For indexing documents into an Elasticsearch index:Sequin Stream sink
Sequin Stream is a durable, scalable, and fault-tolerant message stream that you can use with Sequin in place of additional infrastructure like Kafka or SQS. For pulling changes via the Sequin Stream API:Kafka sink
For publishing changes to Kafka topics:SQS sink
For sending changes to Amazon SQS queues: Using access keys:SNS sink
For publishing changes to AWS SNS topics: Using access keys:Redis sink
For publishing changes to Redis streams:RabbitMQ sink
For publishing changes to RabbitMQ exchanges:GCP PubSub sink
For publishing changes to Google Cloud Pub/Sub topics:credentials field should contain the JSON key file contents for a service account with the roles/pubsub.publisher role.
Project ID must be between 6 and 30 characters, start with a letter, and contain only lowercase letters, numbers, and hyphens. Topic ID must be between 3 and 255 characters and match the pattern: [a-zA-Z][a-zA-Z0-9-_.~+%]*.
Azure Event Hub sink
For publishing changes to Azure Event Hubs:NATS sink
For publishing changes to NATS:S2 sink
For publishing changes to S2:Redis String sink
For storing changes as Redis strings:Kinesis sink
For publishing changes to AWS Kinesis streams: Using access keys:Function configuration
Functions allow you to filter, transform, and route your data as it flows through Sequin. You can define functions at the top level of your configuration and then attach them to your sinks.Function types
Sequin supports five types of functions:- Enrichment functions - Enrich your messages with additional data
- Path functions - Extract data from a specific path in your message
- Transform functions - Modify the structure of your messages
- Filter functions - Filter which messages to process
- Routing functions - Dynamically direct messages to different destinations
Functions via files
You can also define functions in separate files and reference them in your configuration..yaml file.
Using functions in sinks
You can attach functions to your sinks using thetransform, filter, and routing fields:
- The name of a function defined in the
functionssection "none"to explicitly disable that type of function
HTTP endpoint configuration
You can configure HTTP endpoints in three ways:1. External URL
2. Local development endpoint
For local development, you can configure Sequin to connect to endpoints running on your local machine.3. Webhook.site testing endpoint
Change retention configuration
Environment variable substitution
Sequin supports environment variable substitution in your YAML configuration files using the following syntax:- Reference environment variables in your configuration
- Provide default values when the environment variable is not set
Best practices for environment variables in YAML
YAML has special characters that can affect parsing if they appear unquoted in your configuration. When using environment variables that might contain special characters (like:, -, {, }, [, ], etc.), it’s recommended to quote the entire reference:
Using with dotenv
You can use tools likedotenv to load environment variables from a .env file before running Sequin commands:
- Managing environment-specific configurations
- Keeping sensitive values out of your YAML files
- Simplifying deployment across different environments
Previewing interpolated YAML
You can preview how your environment variables will be interpolated into your configuration before applying it:Example configuration
Here’s a complete example combining multiple resources:YAML Anchors
YAML anchors allow you to reuse YAML configuration across multiple resources. A common pattern is to send the same data stream to multiple destinations for different purposes - for example, audit logging and microservice communication.public schema to both Kafka (for audit logging) and SQS (for microservice communication), using YAML anchors to avoid duplicating the common sink configuration.
