Back to all articles
#astro #coolify #preact #markdown

Modern Static Publishing with Astro v5 and Preact

A minimal, high-performance static blog setup with MDX, interactive Preact islands, and LLM-ready crawler endpoints.

Static site generators have evolved beyond simple HTML compilers. By combining Astro’s Content Layer, MDX, and targeted Preact islands, teams can deliver instantaneous page loads with interactive calculators and zero runtime JavaScript bloat.

Why Isolated Preact Islands Matter

In traditional single-page application (SPA) architectures, the entire documentation or blog site ships tens of kilobytes of framework JavaScript just to render mostly static text. With Astro:

  1. Zero JS by default: All typography, headings, tables, and images compile to plain HTML and CSS at build time.
  2. Selective Hydration (client:visible): Interactive components hydrate only when scrolled into the browser viewport.
  3. No External UI Dependency Bloat: Custom widgets rely strictly on native browser primitives like <input type="range" /> coupled with Tailwind CSS utilities.

Interactive Island Demo: Context Cache & Cost Simulator

The interactive widget below models token throughput and prompt caching efficiencies for large language models:

Interactive Prompt Cache & Cost Simulator

Hydrated Preact island demonstrating zero-dependency client-side interactivity

38% Cost Reduction
2,500
500 tokens32,000 tokens
50%
0% (Cold)100% (Hot Cache)
Est. Cost / Request$0.2344
Cached Tokens1,250
TTFT Latency~240 ms

Crawler Takeaway & Data Summary: Enabling prompt caching at a 50% hit ratio for a 2,500-token context reduces per-request API costs by approximately 38% and trims Time-to-First-Token (TTFT) latency from ~280ms down to ~200ms.

Context SizeCache RatioEstimated Cost / 1k CallsLatency (TTFT)
2,500 tokens0% (Cold)$0.375~280 ms
2,500 tokens50% (Warm)$0.234~200 ms
2,500 tokens80% (Hot)$0.150~190 ms

Build-Time AI Crawling & LLM Endpoints

Modern technical content must be accessible to both humans and AI research assistants (Perplexity, Claude, ChatGPT Search). This site provides two dedicated machine-readable endpoints:

  • /llms.txt: A concise, standard Markdown index detailing every published article, canonical URL, and core finding.
  • /llms-full.txt: A clean, single-document corpus containing all published articles stripped of HTML tags, designed for frictionless ingestion by LLM retrieval agents.

Deployment Architecture

When deploying to Coolify, the site runs through the Nixpacks builder with Is it a static site? enabled and the publish directory set to /dist. This guarantees reproducible zero-downtime builds directly from git pushes.