How preactjs/preact-www works
Project type and purpose
• This is a documentation website for Preact (preactjs.com).
• It’s essentially a static-site generator (SSG) with a Preact-based client, a Vite build pipeline, markdown pre-compilation plugins, and a few serverless lambdas for dynamic data (e.g. GitHub repo info, release notes).
• Its primary use case is to transform the multi-language markdown in content/ into a fully pre-rendered site, deploy it (Netlify), and hydrate it in the browser for search, routing, and interactivity.
File structure
• Top-level:
• content/ – multi-locale markdown source
• src/ – the Preact application (components, controllers, assets, lambdas)
• plugins/ – markdown and routing middleware
• build & config files (package.json, vite.config.js)
• deployment configs (netlify.js in plugins/, PWA headers, redirects)
• Patterns & architectural hints:
• SSG pipeline: markdown → precompile plugin → JSON/JSX → Vite rollup → static HTML + bundled JS
• Client-side hydration: Preact components in src/components + routers in src/routes.jsx
• Serverless functions in src/lambda for dynamic data
README for additional insights
• Confirms: repo auto-deploys master to preactjs.com, invites contributions, runtime is purely static with a few lambdas.
Essential details without over-splitting
• But separate build vs. deploy vs. runtime
• Two serverless functions as a distinct “Dynamic Data” tier
• Client hydration and SPA fallback logic