Skip to content
STACK IT FIRST
Install the skills
03 · Backend · Scale · Data & AI

ClickHouse + a typed ingestion layer + Postgres

Analytical storage separated from transactional, with typed ingestion and a query layer the product reads through one client.
Agent fit3/5 Scale · Run it for many Reviewed

The stack

Framework
Ingestion in TypeScript or Python, query API in Next.js route handlers or FastAPI
Runtime
Workers or containers for ingestion, an API for reads
Data
ClickHouse for events and analytics, Postgres for entities, object storage for raw
Hosting
ClickHouse Cloud or self-hosted, Kafka or a managed stream in front
Also
  • Schema registry for events
  • dbt or SQL models for derived tables
  • Data quality checks in CI
AGENTS.md + real projects on STACK IT FAST (opens in a new tab)

Why agents do well here

3/5
  • Typed event schemas in a registry give the agent one place to learn what flows through the system.
  • SQL models in the repo are explicit and testable, so the agent can change a derived table and run its checks.
  • Separating analytical from transactional storage keeps each query path simple enough to reason about.

Avoid at this tier

  • Analytical queries on the transactional Postgres.
  • Untyped event payloads; every event has a versioned schema.
  • A new pipeline framework per team; one ingestion layer, many models.

How it fits together

At scale, data work splits into ingestion, storage and modelling. Events get a versioned schema, land in ClickHouse, and are shaped by SQL models the agent can read and test. The product reads through one query API.

Folder layout

ingest/           typed event handlers, schema registry client
models/           SQL models (dbt or plain), tests/
api/              query endpoints with typed responses
schemas/          versioned event definitions

First five decisions

Lock these in before the agent writes the second feature. Each one removes a choice it would otherwise make differently every time.

  1. 01 A schema registry
  2. 02 ClickHouse for events only
  3. 03 SQL models under test
  4. 04 One read API
  5. 05 Data-quality checks in CI

When to move on

This is the top tier. From here the work is keeping the boundaries explicit, not changing the stack. The Backend Scale page lists what stays the same.

Same tier, other profiles