SaaS & data, an interactive architecture walkthrough

Real-time data ingestion system design: how the architecture works

How a real-time data ingestion pipeline streams database changes and app events through Kafka, processes them in event time, and serves fresh analytics.

This is a learning explainer based on public engineering writing and general design practice. It is simplified, it is not the actual architecture of any company, and it may be inaccurate.

22 components, 17 connections, 12 steps. Updated 30 November 2026.

Interactive diagram

Overview

A real-time data ingestion pipeline moves data from where it is created to where it is queried within seconds, instead of in a nightly batch. In this design three kinds of source feed one event stream: database changes read from the database's log by change data capture, events sent by web and mobile apps through a gateway that checks each one against a schema, and partner webhooks that are acknowledged quickly and queued.

A stream processor reads the stream in event time, the time each event actually happened, and uses watermarks to decide when a window of events is complete even though some arrive out of order. It removes duplicates, enriches events and writes them to a second topic. A real-time analytics store ingests that topic directly so dashboards see new data within seconds, and a lake writer keeps the full history for batch analysis and replays. This is a simplified learning design, not any company's data platform.

Trade-offs and what changes at scale

Streaming gives fresh data but costs more to run and operate than a batch job, so many teams stream only what must be fresh and batch the rest. Late and duplicate events are normal, not exceptional: the design has to say how long to wait for late data and how to recognize a repeat. Keeping the raw stream replayable makes bugs fixable after the fact, at the cost of storage. At larger scale the hard parts are partitioning keys that stay balanced, consumer lag during spikes, and schema changes made by teams who own the sources.

How it works, step by step

The walkthrough above, as text. Each step lights up the components named under it.

  1. The CDC Connector reads the Application DB's log (for example the MySQL binlog or a PostgreSQL logical replication stream) and publishes each committed change to the Raw Event Stream. Other systems learn about a change within seconds, and nobody runs heavy queries against the production database.

    Components CDC Connector, Raw Event StreamVia read change log

  2. Web and mobile apps send events in small HTTPS batches to the Event Gateway, which authenticates them and records when each one arrived. The event's own time, set on the device, is kept as well, because the two can differ by minutes when a phone was offline.

    Components Event GatewayVia HTTPS batches

  3. Each event is checked against its versioned schema in the Schema Registry. An event that does not match goes to the Dead-letter Topic with the reason, so one broken app release cannot block or pollute the stream, and the bad events can be fixed and replayed.

    Components Schema Registry, Dead-letter TopicVia check schema

  4. Partner Systems post webhooks to the Webhook Receiver, which answers only after the event is safely written to the stream. Partners retry when they get no answer, so the same event can arrive twice; the pipeline expects that and removes repeats later by event ID.

    Components Webhook Receiver, Raw Event StreamVia webhook POST

  5. Everything lands in the Raw Event Stream: Kafka topics split into partitions, keyed so that all events for one customer stay in order in one partition. Topics keep events for a configured period, so any consumer can read them again after a bug fix.

    Components Raw Event StreamVia valid events

  6. The Stream Processor works in event time, the time each event happened, not when it arrived. Watermarks tell it how far event time has progressed, so a one-minute window can be closed and counted even though some of its events arrived out of order.

    Components Stream ProcessorVia consume

  7. Events that arrive after their window has closed, beyond the lateness the design allows, are not dropped silently. They go to the Dead-letter Topic, where they can be counted, inspected and, if needed, used to correct the totals later.

    Components Dead-letter TopicVia too late

  8. The processor regularly saves its state (open windows, the event IDs it has seen recently) to Checkpoint Storage, together with how far it has read in each partition. After a crash it restarts from the last checkpoint and re-reads from there, so no event is lost and deduplication still holds.

    Components Checkpoint StorageVia checkpoint state

  9. Deduplicated and enriched events, for example joined with the customer's plan, go to the Clean Event Stream. The raw topic is kept unchanged, so the processing logic can be corrected and re-run over history.

    Components Clean Event StreamVia clean events

  10. A real-time analytics store such as Apache Pinot ingests the clean topic directly and makes new rows queryable within seconds. Live Dashboards query it with SQL for metrics and alerts that need to be fresh, such as orders per minute or failed payments.

    Components Real-time Analytics Store, Live DashboardsVia stream ingestion

  11. The Lake Writer reads the same clean topic and writes the full history to the Data Lake in larger files every few minutes, rather than one tiny file per event. Batch analysis, model training and backfills read from here instead of from the stream.

    Components Lake Writer, Data LakeVia consume

  12. Observability watches consumer lag (how far each reader is behind the newest event), the number of late events and the size of the dead-letter topic. Growing lag is the first sign that ingestion cannot keep up with a traffic spike.

    Components ObservabilityVia consumer lag

Sequence diagram

The same walkthrough as a UML sequence diagram, one lane per layer or group (17 components in all), left to right in the order a request reaches them, numbered by step. A loop on a lane is a step that stays inside that group. Solid arrows are synchronous calls, dashed are asynchronous.

Real-time data ingestion: sequence diagram of the walkthroughIngestSourcesEvent StreamsStreamProcessingServeObservabilityread change log1row changes1HTTPS batches2check schema3invalid events3webhook POST4partner events4valid events5consume6too late7checkpoint state8clean events9stream ingestion10SQL queries10consume11write files11consumer lag12

Key components

Real-time data ingestion architecture diagram: Event Streams, Ingest, Stream Processing, Serve, Observability, Sources

Event Streamsdomain

  • Clean Event Stream: deduplicated, enriched events (kafka)
  • Dead-letter Topic: invalid or too-late events (kafka)
  • Raw Event Stream: partitioned, replayable topics (kafka)

Ingestdomain

  • CDC Connector: reads the database log (debezium)
  • Event Gateway: authenticates, validates, batches
  • Schema Registry: versioned event schemas
  • Webhook Receiver: acknowledges, then enqueues

Stream Processingdomain

  • Checkpoint Storage: snapshots of processor state (s3)
  • Stream Processor: event-time windows, dedupe, joins (flink)

Servelayer

  • Data Lake: full history for batch and backfills (s3)
  • Lake Writer: commits larger files every few minutes
  • Live Dashboards: metrics and alerts on fresh data
  • Real-time Analytics Store: fresh rows queryable in seconds (pinot)

Observability

  • Observability: consumer lag, late events, dead letters

Sourceslayer

  • Application DB: orders, payments, accounts (postgresql)
  • Partner Systems: send events by webhook
  • Web and Mobile Apps: emit product events

Sources

Public writing this explainer draws on. Read these for what the real systems actually do.

Make it yours

Copy this diagram and its walkthrough into your own workspace, then change anything: swap Postgres for DynamoDB, add a cache, rewrite the narration. Free, and it uses no AI credits.

This is a learning explainer based on public engineering writing and general design practice. It is simplified, it is not the actual architecture of any company, and it may be inaccurate. Real systems differ in the details. Browse the library.