Easy-to-run demo of a CDC pipeline using Debezium (Kafka Connect), PostgreSQL, Redpanda, and ClickHouse.
- Docker + Docker Compose
- Node.js 20+ and pnpm
- Moose CLI: bash -i <(curl -fsSL https://fiveonefour.com/install.sh) moose
This starts the Moose dev server, which:
- Spins up local ClickHouse and Redpanda
- Starts all CDC services defined in docker-compose.dev.override.yaml (PostgreSQL, Debezium Kafka Connect, Apicurio Schema Registry)
- Manages lifecycle: when you stop the dev server, these containers are torn down automatically
On first start, Moose runs the script configured in moose.config.toml:
What setup-cdc.sh does:
- Pushes the Drizzle schema from app/oltp/schema.ts to the local PostgreSQL
- Seeds tables with random sample data
- Creates or updates the Debezium postgres connector, using the JSON config in postgres-connector.json
You’ll see the script’s output and subsequent CDC logs in the same terminal where you ran moose dev.
The startup script will seed 10 rows per table. You can seed more rows by running the following commands:
The Drizzle Studio GUI lets you easily view, edit, and delete rows in your PostgreSQL database tables. This is a great way to trigger CDC events and observe the data flowing into ClickHouse.
Numbered folders visualize flow: 1-sources → 2-transforms → 3-destinations.
Debezium connector (see postgres-connector.json) streams:
- public.customer_addresses → pg-cdc.public.customer_addresses
- public.another_table → pg-cdc.public.another_table
- topic.prefix — Prefix for all emitted Kafka topics. Final topics look like <topic.prefix>.public.<table>.
- table.include.list — Which tables to capture. Use schema-qualified names or patterns (e.g., public.* or public.customer_addresses,public.another_table).
Example:
See postgres-connector.jsonc for an annotated, human-friendly version. The actual file used by the setup script is postgres-connector.json (must be plain JSON, no comments).
-
If setup-cdc.sh fails: chmod +x setup-cdc.sh then moose dev
-
Check connector: curl http://localhost:8084/connectors/postgres-connector/status
-
Verify topics: cat app/cdc/1-sources/externalTopics.ts
-
If not all dev containers start with moose dev: stop the dev server, clear Docker volumes, and retry. This resets local data (PostgreSQL, ClickHouse, Redpanda).
# Stop Moose dev (Ctrl+C in the terminal running it) # Tear down containers and remove volumes created by the compose override docker compose -f docker-compose.dev.override.yaml down -v --remove-orphans # Optional cleanup of dangling volumes/networks docker volume prune -f docker network prune -f # Start again moose dev # Re-seed if needed pnpm db:seed
- Debezium: https://debezium.io/
- Moose: https://docs.moosejs.com/
- Drizzle ORM: https://orm.drizzle.team/
- Redpanda: https://docs.redpanda.com/
- ClickHouse: https://clickhouse.com/docs
.png)



