---
title: "Building a Medallion architecture for Bluesky data with ClickHouse"
description: "A Medallion pipeline (Bronze, Silver, Gold) in ClickHouse ingests and cleans the high-volume Bluesky Jetstream feed, which arrives with malformed JSON, inconsistent and invalid timestamps, recursive structures and frequent duplicates."
url: "https://swe.quest/articles/building-a-medallion-architecture-for-bluesky-data-with-clickhouse-37b9d3fcf0db6cec"
canonical: "https://clickhouse.com/blog/building-a-medallion-architecture-for-bluesky-json-data-with-clickhouse"
source: "ClickHouse"
published: "2025-01-08"
difficulty: "medium"
kind: "Case study"
reading_minutes: 26
tags: ["analytics","data-pipelines","databases","sql"]
---

# Building a Medallion architecture for Bluesky data with ClickHouse

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2025-01-08, 26 min read, Case study. Original: [https://clickhouse.com/blog/building-a-medallion-architecture-for-bluesky-json-data-with-clickhouse](https://clickhouse.com/blog/building-a-medallion-architecture-for-bluesky-json-data-with-clickhouse)

## Summary

A Medallion pipeline (Bronze, Silver, Gold) in ClickHouse ingests and cleans the high-volume Bluesky Jetstream feed, which arrives with malformed JSON, inconsistent and invalid timestamps, recursive structures and frequent duplicates. Events are pulled with websocat into gzipped CSV files on GCS, then loaded into a Bronze ReplacingMergeTree table through S3Queue in ordered mode. The Bronze table uses the new JSON type with SKIP clauses to drop recursive paths. Materialized columns derive a consistent event timestamp per event kind and a cityHash64 dedup hash that excludes the crawl time. The design also accounts for most duplicates arriving within a 20-minute window, and the resulting tiers are publicly queryable at sql.clickhouse.com.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Data pipelines](https://swe.quest/tags/data-pipelines.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- ClickHouse MergeTree basics ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))
- SQL ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- JSON data

## Keywords

ClickHouse, Bluesky, Jetstream, Medallion architecture, ReplacingMergeTree, S3Queue, AT Protocol, JSON type

## Related posts

- [Building a Medallion architecture with ClickHouse](https://swe.quest/articles/building-a-medallion-architecture-with-clickhouse-9488d8022c239606.md): ClickHouse · 2024-12-12 · Medium · 11 min read · Analytics & OLAP, Data pipelines, System design
  The Medallion architecture's bronze, silver and gold tiers can be built entirely from native ClickHouse features instead of Spark and Delta Lake.
- [Data Hive: The story of beehiiv’s journey from Postgres to ClickHouse](https://swe.quest/articles/data-hive-the-story-of-beehiiv-s-journey-from-postgres-to-clickhouse-467867cb2bebb87b.md): ClickHouse · 2024-08-21 · Easy · 6 min read · Analytics & OLAP, Databases, PostgreSQL, Stream processing, Queues & messaging
  beehiiv replaced its Postgres-and-Ruby-queue analytics system, which struggled with billions of email events and had multi-hour reporting delays, with a Kafka-fed ClickHouse Cloud pipeline.
- [Accelerating ClickHouse queries on JSON data for faster Bluesky insights](https://swe.quest/articles/accelerating-clickhouse-queries-on-json-data-for-faster-bluesky-insights-cce6ed7a467f6449.md): ClickHouse · 2025-03-19 · Medium · 29 min read · Analytics & OLAP, Performance engineering, SQL, Databases
  Incremental materialized views feeding AggregatingMergeTree tables cut ClickHouse dashboard queries over 4+ billion Bluesky JSON documents (1.6 TiB) from 44–56 seconds to 3–7 ms. Partial aggregation states are computed only for newly inserted rows and merged in the background, so the pre-aggregated tables stay tiny (e.g. 892 rows, 11 KiB) and constant-size regardless of source growth.
- [Building a product analytics solution with ClickHouse](https://swe.quest/articles/building-a-product-analytics-solution-with-clickhouse-786424348993d92f.md): ClickHouse · 2024-12-05 · Medium · 24 min read · Analytics & OLAP, SQL, Databases, Product engineering
  ClickHouse's in-house product analytics platform, Galaxy, stores over 20 billion events (14 TB, roughly 14x compression) in a single denormalized MergeTree table keyed on created\_at.
- [Goldsky - A Gold Standard Architecture with ClickHouse and Redpanda](https://swe.quest/articles/goldsky-a-gold-standard-architecture-with-clickhouse-and-redpanda-347e225c0fe7c7a7.md): ClickHouse · 2023-12-20 · Medium · 9 min read · Analytics & OLAP, Stream processing, Queues & messaging, Multi-tenancy, Data pipelines
  Goldsky streams blockchain data to potentially thousands of customer ClickHouse clusters by indexing chains into per-data-type Redpanda topics (Avro, infinite retention via tiered storage), applying per-customer FlinkSQL filters, joins and aggregations in stream at up to 500k events/sec, and delivering results to ClickHouse.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
