Svelte's official meta-framework — file-based routing, server-side data loading, form actions, and adapters that target every host on earth. Small, fast, and a joy to deploy.
← Back to Client Sidesrc/routes/)src/routes/; +page.svelte is the UI.+page.server.ts / +page.ts) fetch data on server, client, or both.+server.ts) handle JSON / API requests.// src/routes/products/+page.server.ts — runs on the server export const load = async () => { const products = await db.products.findMany(); return { products }; }; export const actions = { create: async ({ request }) => { const data = await request.formData(); await db.products.create({ name: data.get('name') }); return { success: true }; }, };
<!-- src/routes/products/+page.svelte --> <script> let { data } = $props(); </script> <ul> {#each data.products as p} <li>{p.name} — \${p.price}</li> {/each} </ul> <form method="POST" action="?/create"> <input name="name" /> <button>Add</button> </form>
+page.server.ts — server-only; never ships to client.+page.ts — universal; runs on server (SSR) and client (navigation).+layout.server.ts / +layout.ts — shared data for nested routes.Forms work without JavaScript. Add SvelteKit's use:enhance action to upgrade them with optimistic updates and client-side navigation. The same code path covers both worlds.
One app, many hosts. Pick an adapter in svelte.config.js and build:
| Adapter | Target |
|---|---|
| adapter-node | Long-running Node server. |
| adapter-static | Pure static files. |
| adapter-vercel / -netlify | Serverless functions on those platforms. |
| adapter-cloudflare | Cloudflare Workers / Pages. |
| adapter-auto | Detects the host automatically. |
src/hooks.server.ts intercepts every request — perfect for auth, logging, redirects, or attaching data to event.locals.
News, marketing, e-commerce — small bundles win.
Cloudflare adapter + small bundles fit the edge perfectly.
Form Actions + progressive enhancement = no JS required.
Less code, simpler model, faster ship.