A Web3 analytics stack at a small startup: from cron scripts to Dagster to a lakehouse plan
From 2022 into 2023 I worked on the data platform at WeMeta, a small startup building analytics for virtual worlds: Decentraland, The Sandbox, Somnium Space, Cryptovoxels and others. The product answered questions such as "what is land selling for in this world", "who are the largest holders", and "how many people visited this scene last week".
I want to be precise about my part, because this post is about a team's platform. Other engineers built the core: the event SDK, the Kafka service, the ETL and the Dagster deployment. I joined that platform and owned two things on top of it: the design and prototype of a move from Postgres to a Databricks lakehouse, and an expansion of the sources into social and market data. The migration never reached production. I will say where it stopped.
The stack is a good case study anyway, because every early-stage data platform I have seen since has hit the same walls, in roughly the same order.
The platform as it stood
in-world SDK (Decentraland, Space, Unity scenes)
│ HTTP
▼
Flask producer ──► Kafka (topic per world) ──► consumer per world ──► Postgres (events)
│
OpenSea events, CoinGecko prices, Decentraland APIs ──► Dagster + ETL ◄──┘
│
▼
Postgres (per-world tables, leaderboards, metrics)
│
Flask APIs + Redis cache
│
Next.js dashboard (charts)
Three kinds of source fed it:
- Market data from the OpenSea API: sales, transfers, listings and cancellations for each world's land contracts, plus token prices from CoinGecko.
- World data from Decentraland's public endpoints: which scenes were busy, which parcels existed and who owned them.
- In-world events from WeMeta's own SDK. Scene builders added a tag to their scene, and visits and interactions flowed back through an HTTP endpoint into Kafka.
Everything landed in Postgres. Dagster ran the ETL on a schedule. A set of Flask APIs served the dashboard.
For a team of a few engineers this was a reasonable design. Postgres is the right first database for almost everyone. Kafka between a public endpoint and the database means a traffic spike fills a queue, not a connection pool. Dagster gave the team schedules, retries and a UI for free. What follows is not a criticism of those choices. It is what happens to sensible choices as a product grows.
Wall 1: every job wanted the top of the hour
The schedules started as cron expressions, and most of them were the obvious ones: every hour, every few hours, on the hour. Dagster launched each run in its own container. At the top of every hour a pile of jobs started together, and the infrastructure sent CPU alerts.
The team's fix was two-part, and both parts are worth copying:
- Spread the schedules. Run at minute 11 or minute 58, not minute 0. It is free and it works.
- Skip a run if the previous one is still going. Each schedule asked Dagster for in-progress runs of the same job before it launched a new one.
The skip logic was written by hand, in each schedule. Today I would set limits on the run queue first: Dagster's run queue can cap concurrent runs globally and per tag. Hand-written skip logic works, but it lives in every schedule and someone forgets it in the next one.
The lesson: concurrency is a platform setting, not a per-job habit. Set the limit before you have twenty schedules, not after the alerts.
Wall 2: rate limits are the real SLA
Most ETL failures were not bugs in our code. They were the outside world: OpenSea rate limits, CoinGecko timeouts, pagination that returned duplicates when a large page shifted under you. The commit history from that period is a list of retries, smaller pagination windows, then pagination windows that adapted to how busy a time range was, then deduplication.
The README carried a warning I still think about. Point a load at the wrong world by mistake and its events land in the wrong world's table, and the only fix is a full rebuild.
The lessons:
- Treat every third-party API as unreliable and rate-limited, by design and not as a surprise. Retries with backoff, small pages and idempotent writes are the baseline.
- Make loads idempotent by key, so a repeated page cannot double-count a sale.
- Make the destination part of the record's identity. If a world's ID is a column checked on write, the wrong-table accident cannot happen.
Wall 3: dashboards stored as JSON
Early on, the dashboard's numbers were computed by a job and stored as one JSON document per dashboard. That is fast to build and fast to serve. Then two needs arrived that it could not meet: reading a single metric without loading the whole document, and keeping history to draw a line over time. The team's own issue tracker said it plainly: the JSON approach "won't scale".
The fix was the usual one: a narrow metrics table, one row per metric per world per time, with indexes and batched inserts.
The lesson: store facts, not views. A dashboard is a query over facts. If you store the dashboard, you have thrown away the facts.
Wall 4: Postgres was doing two jobs
As history grew, Postgres was both serving the dashboard APIs and holding the history any deeper analysis needed. Those two jobs want different things. Serving wants small, indexed, recent tables. Analysis wants years of raw events, scanned in bulk, in a format cheap to store.
That is the point where a team usually reaches for a lakehouse, and it is the part I owned.
The migration I prototyped: Postgres to Delta with change data capture
The tempting plan is a rewrite: build new pipelines that write to the lake, then switch the APIs over. Rewrites stall, because the old system keeps changing while you build the new one.
The plan I prototyped instead copies Postgres into Delta Lake and keeps the copy current, without touching the existing pipelines:
Postgres ──► AWS DMS ──► S3 (full load files + change files) ──► Databricks
│
1. full load → Delta table (once)
2. change files → MERGE (on a schedule)
AWS Database Migration Service (DMS) does two things here. First it writes a full copy of each table to S3. Then it keeps reading the database's change log and writes every insert, update and delete as a small file, with a column that says which operation it was.
On the Databricks side there are two steps. The full load becomes a Delta table once. After that, a scheduled job reads the new change files and applies them with a MERGE. The one subtle part is that a batch can hold several changes to the same row, so you keep only the latest change per key before merging, and you treat a delete as a delete:
MERGE INTO lake.market_events AS t
USING (
SELECT * FROM (
SELECT *, row_number() OVER (PARTITION BY event_id ORDER BY change_ts DESC) AS rn
FROM staged_changes
) WHERE rn = 1
) AS s
ON t.event_id = s.event_id
WHEN MATCHED AND s.op = 'D' THEN DELETE
WHEN MATCHED THEN UPDATE SET *
WHEN NOT MATCHED AND s.op != 'D' THEN INSERT *
That is the whole pattern. It is not new: AWS and Databricks publish the same approach, and my prototype started from their example. What it buys you is a migration in stages:
- Mirror. The lake follows Postgres. Nothing else changes, so nothing breaks.
- Read from the lake. Analysis and new jobs read Delta. The old jobs keep running.
- Write to the lake. Move ETL jobs one at a time to write Delta directly.
- Serve from the lake. Move the APIs last, or put a small serving database in front of the lake.
Where it stopped
We finished the design and a prototype notebook for the full load and the change merge, and the lake epic was closed in the team's tracker. Stages 2 to 4 were planned as separate tickets and never finished. The prototype still ran against the example's sample table, not our production tables.
I am not going to dress that up: the remaining tickets stayed open. What I would tell a team in the same position now:
- Do stage 1 early. Mirroring a database into a lake with change data capture is cheap, reversible and immediately useful for analysis. It does not need a decision about the rest.
- Prove the merge on a real table first, with a check that the row counts and a checksum per day match Postgres. A sample table proves the syntax, not the data.
- Write the cut-over as a sequence of switches, each with a rollback, so a change of priorities leaves you at a stable stage rather than halfway through a rewrite.
Widening the sources
My other piece of work was adding sources the product did not have: community activity from Twitter, Reddit and Discord, a news feed from crypto and NFT publications, market and on-chain data from a streaming provider, and a mapping from social accounts to on-chain names, so a community's chatter could sit next to its trades. These were collectors and a first Delta table, built as branches and prototypes. They did not reach the production dashboard.
The lesson from that work is the same one as from Wall 2, and stronger. Social APIs change terms, prices and rate limits more often than market APIs do. A collector is cheap to write and expensive to keep alive. Before adding a source, decide who owns it when it breaks, and what the product does when it is missing.
What I took from it
- Postgres plus a queue plus a scheduler is a good first platform. Keep it until it hurts.
- Set orchestration concurrency limits before the schedule count grows.
- Design every load to survive rate limits, retries and duplicate pages.
- Store metrics as rows with time, not dashboards as documents.
- Move to a lakehouse by mirroring with change data capture, then switch readers, writers and serving in stages.
- Prove a migration on real tables with reconciliation checks, not on a sample.
- Every new source needs an owner and a plan for the day it disappears.
If your platform is at Wall 3 or Wall 4, that is the kind of work I take on. Book a call and tell me where it hurts.