Architecture Maps

Shopify Platform Architecture

Interactive architecture map of Shopify's commerce platform — the modular monolith, pods, storefront rendering, checkout extensibility, and global edge infrastructure.

Public Sources Only 2.8M Lines of Ruby 1,000+ Engineers Updated: Mar 2026
01

Platform Overview

Shopify powers 4M+ storefronts worldwide, processing hundreds of billions of requests during peak events. Rather than decomposing into microservices, the platform embraces a modular monolith backed by pod-based isolation, edge rendering, and WebAssembly extensibility.

2.8M
Lines of Ruby
37
Components
500K+
Commits
284M
Req/min Peak
100+
MySQL Shards
Shopify Platform Layers
graph TD
    EDGE["Global Edge CDN
Fastly · 300+ PoPs"] STORE["Storefront Renderer
Ruby · Liquid · K8s"] CHECKOUT["Checkout
Extensions · Functions"] CORE["Modular Monolith
37 Rails Engine Components"] DATA["Data Layer
MySQL · Redis · Kafka"] APPS["App Platform
OAuth · GraphQL · Webhooks"] HYDROGEN["Hydrogen & Oxygen
React · Cloudflare Workers"] EDGE --> STORE EDGE --> HYDROGEN STORE --> CORE CHECKOUT --> CORE HYDROGEN --> CORE APPS --> CORE CORE --> DATA style EDGE fill:#e8a735,stroke:#a67c42,color:#2c2418 style STORE fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style CHECKOUT fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style CORE fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style DATA fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style APPS fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style HYDROGEN fill:#5c6b77,stroke:#3d4a55,color:#faf9f5
02

The Modular Monolith

Shopify Core is one of the largest Ruby on Rails applications in existence. Rather than decomposing into microservices, the team chose componentization — splitting the monolith into 37 Rails Engines organized by business domain, all deployed as a single unit.

Component Layer Architecture
graph TD
    subgraph FE["Frontend Components"]
        ADMIN["Admin UI"]
        STOREFRONT["Storefront"]
        CHECKOUTFE["Checkout UI"]
    end
    subgraph SUP["Supporting Components"]
        BILLING["Billing"]
        SHIPPING["Shipping"]
        INVENTORY["Inventory"]
        PAYMENTS["Payments"]
    end
    subgraph PLAT["Platform Components"]
        AUTH["Authentication"]
        EVENTS["Event Bus"]
        JOBS["Job Queue"]
        STORAGE["Data Access"]
    end

    FE --> SUP
    SUP --> PLAT

    style ADMIN fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5
    style STOREFRONT fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5
    style CHECKOUTFE fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5
    style BILLING fill:#e8a735,stroke:#a67c42,color:#2c2418
    style SHIPPING fill:#e8a735,stroke:#a67c42,color:#2c2418
    style INVENTORY fill:#e8a735,stroke:#a67c42,color:#2c2418
    style PAYMENTS fill:#e8a735,stroke:#a67c42,color:#2c2418
    style AUTH fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5
    style EVENTS fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5
    style JOBS fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5
    style STORAGE fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5
    style FE fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c
    style SUP fill:#fff9b0,stroke:#c49a5c,color:#2c2418
    style PLAT fill:#d4edda,stroke:#388e3c,color:#2c2418
                

Boundary Enforcement Tooling

Three tools keep the monolith's internal boundaries clean:

Packwerk

Static analysis tool that detects unwanted cross-component constant references at PR time. Runs in minutes across the entire codebase.

Core

Sorbet

Stripe's Ruby type checker, enforcing input/output contracts on component boundaries with minimal runtime overhead.

Core

ActiveSupport Notifications

Pub/sub event system enabling dependency inversion between components — components publish events rather than calling each other directly.

Core
Ruby Performance Investments

YJIT — a JIT compiler for Ruby built in Rust, developed at Shopify. Bootsnap accelerates boot times. Tapioca automates Sorbet RBI file generation. Every component is explicitly owned by a team; whole-codebase chores like Rails upgrades are distributed across owning teams.

03

Pods Architecture

Introduced in 2016, pods are Shopify's unit of fault isolation and horizontal scaling. A pod is a set of merchant shops living on a fully isolated set of datastores — not to be confused with Kubernetes pods.

Pod Composition & Routing
graph LR
    REQ["Incoming
Request"] SH["Sorting Hat
Load Balancer"] subgraph POD["Pod N"] APP["App Servers"] MYSQL["MySQL
Instance"] REDIS["Redis
Node"] MEMCACHE["Memcached
Cluster"] end subgraph DR["Disaster Recovery"] PAIR["Paired
Data Center"] PM["Pod Mover
< 1 min failover"] end REQ --> SH SH -->|pod header| APP APP --> MYSQL APP --> REDIS APP --> MEMCACHE POD -.->|replication| PAIR PM -.-> PAIR style REQ fill:#e8a735,stroke:#a67c42,color:#2c2418 style SH fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style APP fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style MYSQL fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style REDIS fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style MEMCACHE fill:#e8a735,stroke:#a67c42,color:#2c2418 style PAIR fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style PM fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style POD fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c style DR fill:#d4edda,stroke:#388e3c,color:#2c2418

Resilience Tooling

Semian

Circuit breaker library protecting Redis and MySQL connections from cascading failures across pods.

Infra

Toxiproxy

Simulates network failures in pre-production testing. Used alongside Pod Mover failover drills, which can be triggered via Slack.

Infra
Sorting Hat

Every incoming request is matched to a pod by the Sorting Hat load balancer, which adds a pod-identifying header. App servers then query only that pod's datastores, ensuring complete isolation between merchant groups.

04

Data Infrastructure

Shopify's data layer centers on MySQL sharded across 100+ instances, with Kafka handling change data capture at 66 million messages per second peak throughput.

Change Data Capture Pipeline
graph LR
    subgraph SHARDS["MySQL Shards"]
        S1["Shard 1"]
        S2["Shard 2"]
        SN["Shard N"]
    end
    DBZ["Debezium
~150 Connectors"] KAFKA["Apache Kafka
Intermediate Topics"] KS["Kafka Streams
Consolidation"] subgraph CONSUMERS["Downstream"] SEARCH["Search
Indexing"] ML["ML
Pipelines"] ANALYTICS["Analytics"] EMBED["Real-time
Embeddings"] end S1 --> DBZ S2 --> DBZ SN --> DBZ DBZ --> KAFKA KAFKA --> KS KS --> SEARCH KS --> ML KS --> ANALYTICS KS --> EMBED style S1 fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style S2 fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style SN fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style DBZ fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style KAFKA fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style KS fill:#e8a735,stroke:#a67c42,color:#2c2418 style SEARCH fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style ML fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style ANALYTICS fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style EMBED fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style SHARDS fill:#fad4e0,stroke:#d32f2f,color:#2c2418 style CONSUMERS fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c
66M
Kafka Msg/sec Peak
<10s
CDC p99 Latency
100K/s
BFCM Peak Records

Vitess & Internal APIs

For the Shop app backend, Shopify adopted Vitess (YouTube's MySQL sharding middleware) with VTGate for query routing, VSchema for shard mapping, and VTTablet as per-shard proxy.

Protocol Usage Status
GraphQL Public APIs (Storefront API, Admin API) Standard
gRPC New internal service-to-service communication Growing
REST Legacy internal communication Legacy
05

Storefront Renderer

The Storefront Renderer (SFR) is a dedicated Ruby application extracted from the monolith for rendering merchant storefronts with Liquid templates, achieving 4-6x faster response times.

SFR Caching Layers
graph TD
    REQ["Storefront
Request"] OPENRESTY["OpenResty
nginx + Lua"] subgraph SFR["Storefront Renderer"] LRU["L1: In-Memory
LRU Cache"] LOCAL["L2: Node-Local
Redis"] QUERY["L3: Query Result
Cache"] PAGE["L4: Full-Page
Cache"] end REPLICA["MySQL
Read Replicas"] LIQUID["Liquid
Template Engine"] REQ --> OPENRESTY OPENRESTY --> PAGE PAGE -->|miss| LRU LRU -->|miss| LOCAL LOCAL -->|miss| QUERY QUERY -->|miss| REPLICA REPLICA --> LIQUID style REQ fill:#e8a735,stroke:#a67c42,color:#2c2418 style OPENRESTY fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style LRU fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style LOCAL fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style QUERY fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style PAGE fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style REPLICA fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style LIQUID fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style SFR fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c
Simplify-Batch-Cache Pattern

Simplify — plain Ruby objects from raw SQL rows, no ORM overhead. Batch — MySQL multi-statement queries load all needed data in a single round trip. Cache — Liquid object memoizer prevents 16-20 datastore calls per request (up to 4,000 in extreme cases).

Traffic Routing

OpenResty (nginx + Lua) routes storefront traffic. A JSON-based rule system controls render_rate (% of traffic to SFR) and verify_rate (% compared against legacy). Rules are managed via a "spy" chatbot. Verification runs out-of-band using nginx timers to avoid latency impact.

Liquid Templating Engine

Open-source template language created by Shopify in 2006. Security-first design: non-evaling, separate compile/render phases, stateless execution. Used by all 4M+ storefronts and also adopted by Jekyll, Zendesk, and other platforms.

Objects {{ }}

Output dynamic content — product names, prices, collection data.

Tags {% %}

Control flow: if, for, assign, capture, and other logic tags.

Filters |

Transform output: date formatting, string manipulation, math operations.

06

Checkout Architecture

Checkout is Shopify's most performance-critical and security-sensitive path. The extensibility platform allows third-party apps to customize checkout without accessing raw HTML or payment data, delivering up to 1% higher conversion.

Remote DOM Architecture
graph LR
    subgraph SANDBOX["Sandboxed Web Worker"]
        EXT["Extension
Code"] DOMAPI["DOM-like
API"] end MC["MessageChannel
JSON Serialization"] subgraph HOST["Host Page"] RR["RemoteReceiver"] RENDER["Native HTML
Rendering"] end EXT --> DOMAPI DOMAPI --> MC MC --> RR RR --> RENDER style EXT fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style DOMAPI fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style MC fill:#e8a735,stroke:#a67c42,color:#2c2418 style RR fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style RENDER fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style SANDBOX fill:#d4edda,stroke:#388e3c,color:#2c2418 style HOST fill:#fad4e0,stroke:#d32f2f,color:#2c2418

Extension Types

Checkout UI Extensions

Custom UI elements (offers, fields, loyalty) rendered via Remote DOM in Web Workers. Visible in both guest checkout and Shop Pay.

Checkout

Shopify Functions

Server-side logic (discounts, shipping, order routing) executed as WebAssembly modules on Shopify infrastructure.

Checkout

Branding API

Advanced visual customization — colors, fonts, layout — beyond basic theming. Includes Pixels for event tracking.

Checkout
Security Model

All custom code runs in Web Workers — no custom code executes on the parent page. Communication is sanitized by a managed bridge. Extensions never touch the real DOM, payment fields, or other extensions. PCI DSS v4 compliant by design. Hosts exist in JavaScript (web), Kotlin (Android), and Swift (iOS).

07

Shopify Functions & WebAssembly

Shopify Functions execute third-party backend logic on Shopify's own infrastructure using WebAssembly sandboxing. Functions are pure — no network calls, no database access, no side effects.

Function Execution Model
graph TD
    GQL["GraphQL
Input Query"] SHOPIFY["Shopify
Data Provider"] subgraph WASM["Wasm Runtime"] MODULE["Wasm Module
< 256KB"] EXEC["Execute
~100us Lucet / ~4ms p99"] end OUTPUT["JSON Output
via stdout"] GQL --> SHOPIFY SHOPIFY -->|JSON via stdin| MODULE MODULE --> EXEC EXEC --> OUTPUT style GQL fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style SHOPIFY fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style MODULE fill:#e8a735,stroke:#a67c42,color:#2c2418 style EXEC fill:#e8a735,stroke:#a67c42,color:#2c2418 style OUTPUT fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style WASM fill:#fff9b0,stroke:#c49a5c,color:#2c2418

Language Support

Language Toolchain Performance
Rust Native Wasm compilation Smallest, fastest modules (recommended)
JavaScript Javy (QuickJS to Wasm, ES2020) ~3x slower than Rust, ~220 bytes user module
Others Zig, TinyGo, AssemblyScript, C++ Any Wasm target works
Javy Architecture

Two-stage compilation: QuickJS engine compiled to Wasm separately, user code compiled to bytecode only. Connected via javy_quickjs_provider_v1 interface with just two functions: realloc and eval_bytecode. Shopify contracted with Igalia to port SpiderMonkey to Wasm for significant JS performance gains.

08

Hydrogen & Oxygen

Hydrogen is Shopify's React-based framework for building custom headless storefronts (built on React Router / formerly Remix). Oxygen is the edge hosting platform, built on Cloudflare Workers.

Oxygen Worker Chain Architecture
graph LR
    CLIENT["Client
Browser"] subgraph OXYGEN["Oxygen (Cloudflare Workers)"] GW["Gateway Worker
Auth & Routing"] SW["Storefront Worker
Hydrogen App"] TW["Trace Worker
Telemetry"] end subgraph BACKEND["Shopify Backend"] SFAPI["Storefront API
GraphQL"] ADMINAPI["Admin API
GraphQL"] CDN["Shopify CDN
Assets"] end CLIENT --> GW GW --> SW SW --> TW SW --> SFAPI SW --> ADMINAPI SW --> CDN style CLIENT fill:#e8a735,stroke:#a67c42,color:#2c2418 style GW fill:#5c6b77,stroke:#3d4a55,color:#faf9f5 style SW fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style TW fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style SFAPI fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style ADMINAPI fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style CDN fill:#e8a735,stroke:#a67c42,color:#2c2418 style OXYGEN fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c style BACKEND fill:#d4edda,stroke:#388e3c,color:#2c2418

Observability Stack

Grafana

Dashboards and alerting for Oxygen-hosted storefronts.

Cortex

Metrics collection at scale for all edge workers.

Loki + Tempo

Log aggregation (Loki) and distributed tracing (Tempo) across the worker chain.

09

Global Edge & Flash Sale Scaling

Shopify's CDN is powered by Fastly with 300+ edge locations worldwide. The flash sale infrastructure can handle 10x+ normal traffic surges within seconds.

173B
Requests (BFCM 24h)
284M
Req/min Peak
12 TB
Egress/min Peak
45M
DB Reads/sec
7.6M
DB Writes/sec
Flash Sale Infrastructure
graph TD
    TRAFFIC["Traffic Surge
10x+ Normal"] FASTLY["Fastly CDN
300+ Edge PoPs"] AUTOSCALE["Auto-Scale
Compute Provisioning"] subgraph CHECKOUT_CLUSTER["Checkout Clusters"] CC1["Dedicated
Checkout Servers"] CC2["10,000+
Concurrent Checkouts"] end CORONOMA["Coronoma
Load Testing Tool"] DPOD["Dedicated Pod
Temporary Allocation"] TRAFFIC --> FASTLY FASTLY --> AUTOSCALE AUTOSCALE --> CHECKOUT_CLUSTER CORONOMA -.->|pre-test| CHECKOUT_CLUSTER CORONOMA -.->|may allocate| DPOD style TRAFFIC fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style FASTLY fill:#e8a735,stroke:#a67c42,color:#2c2418 style AUTOSCALE fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style CC1 fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style CC2 fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style CORONOMA fill:#8e44ad,stroke:#5b2d8e,color:#faf9f5 style DPOD fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style CHECKOUT_CLUSTER fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c
BFCM 2024 Scale Records

173 billion requests in 24 hours. 284 million requests per minute at peak. 12 TB egress per minute. 45 million database reads/second. 7.6 million database writes/second. 216 million embeddings processed daily.

10

App Platform

Third-party apps extend Shopify through multiple extension surfaces. Apps are external web services that authenticate via OAuth and communicate through GraphQL Admin API.

Extension Surfaces
graph TD
    subgraph EXTENSIONS["Extension Types"]
        UIEXT["Checkout UI
Extensions"] FUNC["Shopify
Functions"] THEME["Theme App
Extensions"] ADMINEXT["Admin
Extensions"] POST["Post-Purchase
Extensions"] end subgraph RUNTIME["Runtime Environment"] WORKER["Web Workers
Remote DOM"] WASM["Wasm
Sandbox"] LIQUID["Liquid
Blocks"] IFRAME["Admin
Iframe + App Bridge"] end UIEXT --> WORKER FUNC --> WASM THEME --> LIQUID ADMINEXT --> IFRAME POST --> WORKER style UIEXT fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style FUNC fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style THEME fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style ADMINEXT fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style POST fill:#1a8a93,stroke:#0d5f66,color:#faf9f5 style WORKER fill:#d94a4a,stroke:#8b1a1a,color:#faf9f5 style WASM fill:#e8a735,stroke:#a67c42,color:#2c2418 style LIQUID fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style IFRAME fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style EXTENSIONS fill:#d4edda,stroke:#388e3c,color:#2c2418 style RUNTIME fill:#fff9b0,stroke:#c49a5c,color:#2c2418

App Communication

GraphQL Admin API

Primary interface for merchant management — products, orders, customers, inventory, and configuration.

Apps

App Bridge

JavaScript library for embedding app UIs in the Shopify Admin iframe with native-feeling integration.

Apps

Webhooks

Event delivery via HTTP POST or Amazon EventBridge. Backed by Redis job queues for reliable delivery.

Apps
11

Developer Experience & CI/CD

Shopify's developer tooling supports 1,000+ engineers working on the monolith with 400,000+ unit tests, no staging environments, and canary deployments with fast rollback.

CI/CD & Frontend Stack
graph LR
    subgraph DEV["Development"]
        CODE["Code
Push"] GRAPHITE["Graphite
PR Stacking"] end subgraph CI["CI Pipeline"] BUILDKITE["Buildkite
Parallel Workers"] TESTS["400K+
Unit Tests"] end subgraph DEPLOY["Deployment"] CANARY["Canary
Deploy"] FLAGS["Feature
Flags"] GKE["GKE
Kubernetes"] end CODE --> GRAPHITE GRAPHITE --> BUILDKITE BUILDKITE --> TESTS TESTS --> CANARY CANARY --> FLAGS FLAGS --> GKE style CODE fill:#5c6b77,stroke:#3d4a55,color:#faf9f5 style GRAPHITE fill:#5c6b77,stroke:#3d4a55,color:#faf9f5 style BUILDKITE fill:#e8a735,stroke:#a67c42,color:#2c2418 style TESTS fill:#e8a735,stroke:#a67c42,color:#2c2418 style CANARY fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style FLAGS fill:#4a9e4e,stroke:#2c6e2f,color:#faf9f5 style GKE fill:#4a90d9,stroke:#1a3a5c,color:#faf9f5 style DEV fill:#d4e8f7,stroke:#1976d2,color:#1a3a5c style CI fill:#fff9b0,stroke:#c49a5c,color:#2c2418 style DEPLOY fill:#d4edda,stroke:#388e3c,color:#2c2418

Frontend Stack

Web Admin

React + TypeScript with GraphQL-only data fetching. Stateless architecture with no shared cross-view state.

DevEx

Mobile

React Native for iOS/Android. Shopify contributes to FlashList, Skia, WebGPU, and Reanimated.

DevEx

Polaris

Open-source React component library and design system for building admin UIs with consistent Shopify experience.

DevEx
12

Acronym Reference

BFCMBlack Friday / Cyber Monday
CDCChange Data Capture
CDNContent Delivery Network
FKForeign Key
GKEGoogle Kubernetes Engine
gRPCGoogle Remote Procedure Call
IKInverse Kinematics
JITJust-In-Time (compilation)
K8sKubernetes
LRULeast Recently Used
ORMObject-Relational Mapping
PCI DSSPayment Card Industry Data Security Standard
PoPPoint of Presence
RBIRuby Interface (Sorbet type stubs)
SFRStorefront Renderer
WasmWebAssembly
YJITYet Another JIT (Ruby JIT compiler)
Diagram
100%
Scroll to zoom · Drag to pan · Esc to close