0Pricing
Sveltejs Academy · Lesson

adapter-static for Static Sites

Prerender your entire site to static files with adapter-static.

adapter-static for Static Sites is a free Sveltejs Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Sveltejs Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What adapter-static Does

It prerenders your app to static HTML/CSS/JS files that any static host can serve.

Install

Replace adapter-auto in svelte.config.js.

npm install -D @sveltejs/adapter-static

Configure

Use it in your svelte.config.js.

import adapter from "@sveltejs/adapter-static";
export default { kit: { adapter: adapter() } };

Prerender All Pages

Add a root layout that enables prerendering everywhere.

// +layout.js
export const prerender = true;

Dynamic Routes

Static sites cannot serve dynamic params at request time. Use the entries export to enumerate them.

export function entries() { return [{ slug: "hello" }, { slug: "world" }]; }

No Server

You cannot use form actions or server endpoints with adapter-static.

Hosting

Deploy to Netlify, Vercel, Cloudflare Pages, GitHub Pages, or any S3-like host.

SPA Mode

Use fallback option for client-routed SPA mode without prerender.

adapter({ fallback: "index.html" })

Performance

Static sites are blazing fast and cheap to host at scale.

Limitations

No SSR per request, no form actions. Use client-side fetches to dynamic APIs.

Use Cases

Marketing sites, docs, blogs, portfolios.

Quick Check

What does adapter-static produce?

Recap

Use adapter-static to prerender SvelteKit apps as static sites for cheap, fast hosting.

Frequently asked questions

Is the “adapter-static for Static Sites” lesson free?

Yes — the full text of “adapter-static for Static Sites” is free to read here on the web, and the Sveltejs Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Sveltejs Academy course, upgrade to CoddyKit PRO.

What will I learn in “adapter-static for Static Sites”?

Prerender your entire site to static files with adapter-static. You practise Sveltejs Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Sveltejs Academy?

No prior experience is required. Sveltejs Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “adapter-static for Static Sites” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Sveltejs Academy lesson?

Yes. Every Sveltejs Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. adapter-static for Static Sites
  2. adapter-node for Node.js Server
  3. adapter-vercel and adapter-cloudflare
  4. Building and Previewing
← Back to Sveltejs Academy