puppies.png

A full-featured content management system that runs entirely at the edge — no origin servers, no databases, no traditional infrastructure. Edge CMS is built on Fastly's global platform and demonstrates how Compute, KV Store, Object Storage, and other edge products compose into a real, production-grade application.

Live demo: https://serverless-cms.chrisbuckley.dev
GitHub: https://github.com/fastly/fastly-serverless-cms
License: MIT


Reader Features

Blog Interface

  • Post listing with pagination
  • Single post view with featured images and metadata
  • Tag-based filtering
  • RSS/Atom feed (/feed.xml)
  • Auto-generated sitemap (/sitemap.xml)
  • Share buttons (Twitter, LinkedIn, copy link)
  • Navigation breadcrumbs and related post links
  • Responsive design (mobile, tablet, desktop)
  • Localized geolocation badge — shows nearest Fastly POP and region to each visitor

Performance

  • All reader responses cached at the edge for 1 hour
  • Surrogate key–based purging — updates to a single post only invalidate that post's cache, not the entire blog
  • Image optimization on-the-fly — resize, crop, and convert to WebP via query params
  • Browser caching (1 minute) ensures quick reloads
  • Full-page preload + lazy loading images

Admin Features

Dashboard

  • Post management table — sort by title, date, status
  • Quick stats: total posts, published, drafts, uploaded images
  • Search and filter by status

Editor

  • Split-pane markdown editor with live preview
  • Drag-drop image upload → stored in Object Storage with automatic SigV4 signing
  • Post metadata: title, slug, excerpt, featured image, tags, publish status
  • Auto-save indicator
  • Save, publish, preview, and delete buttons

Sidebar Management

  • Create categories and nested post groups
  • Add external links (GitHub, docs, social)
  • Reorder items via drag-drop
  • Live preview

Authentication

  • Password-only login (no username)
  • Bcrypt password hashing
  • HMAC-signed session tokens with expiry
  • Rate limiting: 5 login attempts per minute per IP
  • HttpOnly, Secure, SameSite=Strict cookies

Technical Architecture

Compute

  • Rust application running on Fastly Compute
  • All request logic executes at the edge (no latency to origin)
  • Handles routing, authentication, markdown rendering, image signing, and cache purge logic

Data Storage

  • KV Store — Post content, post index, sidebar configuration
  • Object Storage — Image uploads stored in edge-local buckets

Secrets

  • Secret Store — Admin password hash, session signing key, Object Storage credentials, Fastly API token

CDN Layer

  • VCL Service — Caches reader responses, serves images directly from Object Storage, rate-limits login attempts
  • Routes non-image requests to Compute, images to Object Storage

Image Pipeline

  • Image Optimizer — Transforms images on-the-fly via query params (?width=800&format=webp)
  • Compute signs Object Storage requests with AWS SigV4, VCL relays signed requests to Object Storage
  • Browsers cache-bust via content hash

Cache Management

  • Surrogate Keys + Purge API — Compute purges the CDN on every post CRUD operation
  • Posts use key post-{slug}, index uses post-index, sidebar uses sidebar
  • Purge is instant — readers see updates within milliseconds

Observability

  • Real-time Log Streaming — Optional HTTPS drain to capture all requests
  • Debug headers in responses: X-Edge-CMS-Compute-Version, X-Edge-CMS-VCL-Version
  • fastly log-tail for live request debugging

Data Model

Posts (KV Store)

{
  "slug": "my-first-post",
  "title": "My First Post",
  "content": "# Hello\n\nMarkdown content...",
  "excerpt": "Short summary for listing",
  "status": "published",
  "created_at": "2026-05-20T14:30:00Z",
  "tags": ["fastly", "edge"],
  "featured_image": "/images/my-first-post/hero.jpg"
}

Post Index (KV Store)
Denormalized metadata for all posts — enables fast listing without reading individual posts.

Images (Object Storage)
Raw binary data with path images/{slug}/{filename}. Served with Image Optimizer query params.

Secrets (Secret Store)

  • Admin password (bcrypt hash)
  • Session HMAC key
  • Object Storage credentials
  • Fastly API token (for purging)

Multi-Language Support

Edge CMS ships with three complete language implementations — all share the same Handlebars templates and CSS, all produce identical behavior:

  • Rust (complete) — Primary implementation, production-ready and currently live
  • TypeScript (complete) — Uses @fastly/js-compute SDK with webpack bundling
  • Go (complete) — Uses compute-sdk-go with full feature parity

Pick the language that fits your team. The architecture and features are identical across all three.


Deployment Options

Fastly CLI Step-by-step deployment using the fastly CLI. Useful for understanding each resource (KV Store, Secret Store, VCL snippets, rate limiters).

Terraform Full infrastructure-as-code deployment. One command creates:

  • VCL CDN service with all snippets, rate limiter, and Image Optimizer
  • Compute service with KV and Secret Store resource links
  • Object Storage access keys and bucket

See the README for both paths.


Local Development

Run locally with Viceroy (Fastly's local Compute runtime):

cd edge-cms/rust/
fastly compute serve

Loads test fixtures from tests/ — no Fastly account required. Integration tests exercise all routes and cache headers.


Use Cases

Learning Fastly Products Each feature demonstrates a Fastly product in isolation and in combination. Understand KV Store by reading posts, Object Storage by uploading images, Compute by editing them, and Cache Purge by seeing instant updates.

Customer Demos Real, working CMS with familiar UI — no mock data or screenshots. Deploy your own instance to show customers what Fastly can do.

Architectural Reference Multi-language implementations. Patterns for authentication, image uploads, cache invalidation, and structured templating. Start here if building your own edge application.

Fastly Proof of Concept Fork the repo, customize the templates and styling, deploy to your domain. Integrate with your content pipeline (Markdown files, headless CMS API, etc.).


Key Architectural Decisions

  • No origin server — Everything runs at the edge. Slower networks can't bottleneck your CMS.
  • Split architecture — VCL layer (caching, rate limiting, image serving) + Compute layer (logic, auth, markdown rendering). Separation lets each layer scale independently.
  • Surrogate key purging — Targeted, instant cache invalidation without clearing the entire edge cache.
  • Denormalized index — Post listing queries the _index key instead of reading all posts. O(1) instead of O(n).
  • Image upload flow — Compute signs requests with AWS SigV4, Object Storage validates signatures. No credential leakage to the browser.
  • Session tokens over server-side state — HMAC-signed tokens, no session database to query on every request.

Getting Started

  1. Fork or clone the repo: https://github.com/fastly/fastly-code-examples
  2. Create a Fastly account (free tier available)
  3. Install Fastly CLI and authenticate
  4. Follow the README — Choose Fastly CLI or Terraform path
  5. Deploy and customize

Links