Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Railway 9 min read Case study mediumAdept

How We’re Building Git for Infrastructure

Railway's Changesets let teams fork an infrastructure environment like a Git branch, record each config or service change as a changeset, and merge it back into the parent environment. Instead of storing Git-style parent pointers (too many sequential queries) or rebuilding the tree in memory (too memory-heavy), each changeset has a single original environment and an ordering id from a PostgreSQL serial column, and each environment records its parent and fork point, so a diff is one simple query. The scope was deliberately limited to fork-and-merge-into-parent, with no arbitrary environment merges or merge requests. Tests use a Mermaid gitGraph-like DSL helper that can also print a Mermaid diagram of the test state for visual debugging.

Assumes: Git branching and mergingrelational database basics

Related posts

  • Postgres for Ephemeral Environments: A Method to Keep Data Persistent

    Neon easyNovice

    Neon branches, which are copy-on-write clones of a Postgres database, can provide pre-seeded databases for ephemeral PR environments. Because a branch references the parent's data pages instead of copying them, it is created in seconds whatever the dataset size. Persistent dev and test environments suffer from configuration drift, seed-data maintenance, shared-environment conflicts and idle cost. Ephemeral environments fix most of this but still stall on loading seed data into each database. The proposed workflow keeps sanitized seed data in one main branch and has GitHub Actions create a child branch per pull request, reset it from the parent when needed and delete it on merge, with scale-to-zero limiting cost.

  • Building Git infrastructure for agent-scale development

    GitHub Engineering easyNovice

    GitHub is rebuilding its Git storage layer because agent-driven workloads are colliding with the design of Spokes. Spokes keeps five full repository replicas on local disks and coordinates every ref update with a three-phase commit quorum, so adding read replicas slows writes. The new design keeps coordination only for the reference update itself and moves compaction and garbage collection to separate workers. It also puts authoritative data in Azure Blob Storage, with stateless caching compute workers serving reads and scaling independently. Internal benchmarks show up to 35x higher write throughput, driven by 4.9x year-over-year push growth and 7.38 billion commits in a month.

  • How To Maintain Seed Files (And Why You May Not Want To Do It)

    Neon mediumAdept

    Seed files should be versioned alongside schema changes, executed automatically in pipelines, split by environment, made incremental like migrations, and written to be idempotent, with Ruby/Rails and Docker Compose examples showing each practice. As data grows, seeds bring maintenance overhead, drift between environments and foreign-key ordering complexity. FactoryBot factories address much of this for tests but don't suit curated demo or production initialization. Copy-on-write database branching is pitched as the alternative: full data-and-schema branches for realistic debugging and performance testing, or schema-only branches populated with seeds, synthetic or sanitized data.

  • Supabase Branching

    Supabase mediumAdept

    Supabase Branching gives each Git branch an isolated hosted Preview environment with its own Postgres database, Auth, Storage, Realtime, Edge Functions and APIs, plus separate credentials. A GitHub app runs migrations from ./supabase/migrations when a PR opens, applies new migration files incrementally on push, seeds from seed.sql, and runs the migrations against production on merge. It integrates with Vercel Preview deployments by auto-populating branch connection secrets. Early access is rolling out in batches to paid orgs, with copy-on-write snapshots, declarative config and automatic dashboard commits planned.

  • Inside GitHub’s new Git storage architecture

    GitHub Engineering hardMaster

    GitHub's new Git storage architecture, Rubicon, rests on one observation: only reference updates need ordering. Git objects go to Azure Blob Storage, and refs plus the pack manifest go to a small quorum-replicated compare-and-swap log called Ref-CAS. Disposable virtual replicas serve reads and writes from a rebuildable cache, while separate lease-based compaction nodes merge packs in the background, so storage, serving and maintenance scale independently. Ref-CAS replaced blob-based ref logs, which topped out at the mid-hundreds of writes per second or traded away read latency. It reaches tens of thousands of ref operations per second, and internal tests sustained 7,200 pushes per second from 5,000 concurrent agents on one repository.

The quest for software engineering knowledge.

Look:
Layout: