About PhoenixPrerender

Static prerendering and incremental regeneration for Phoenix applications

prerendered

This page was generated at build time by mix phoenix.prerender and served as a static HTML file.

What is PhoenixPrerender?

PhoenixPrerender brings static site generation to Phoenix applications. It renders your marked routes through the full endpoint pipeline at build time, producing static HTML files that can be served directly from disk — with zero runtime cost per request.

Unlike traditional SSG tools, PhoenixPrerender runs inside your Phoenix app. Your routes, controllers, LiveViews, layouts, components, and plugs all execute normally. The HTML output is identical to what a browser would receive.

For pages that need to stay fresh, incremental static regeneration (ISR) serves stale content immediately while regenerating in the background. ETS locks prevent duplicate work, and distributed locking via :global.trans coordinates across BEAM nodes.

How This Page Was Built

  1. 1 Route marked with prerender do in the router
  2. 2 Generator dispatched GET /about through the full endpoint
  3. 3 HTML written to priv/static/prerendered/about/index.html
  4. 4 Plug intercepted request and served the file with send_file

Key Benefits

  • Sub-millisecond response time from disk
  • SEO-friendly with full HTML and sitemap.xml
  • Works with controllers and LiveViews
  • Compatible with Phoenix verified routes (~p)
  • Manifest with checksums for cache busting
  • Telemetry events for full observability

Router Code for This Page

import PhoenixPrerender

scope "/", DemoWeb do
  pipe_through :browser

  prerender do
    get "/about", PageController, :about
  end
end