SvelteKit Routing Cheat Sheet

File-system routes, layouts, and endpoints for full-stack apps

Last Updated: November 21, 2025

Route Types

File Purpose
+page.svelte Render the UI for that URL
+layout.svelte Wrap nested pages
+page.server.ts Server-only `load` for secrets
+server.ts Define HTTP endpoints

Key APIs

export const load = async ({ params }) => { ... }
Fetch route data before render
fetch('/api/data')
Call internal endpoints
export const prerender = true
Statically prerender the page
export const csr = false
Disable client-side rendering when only server-rendered

Layout Tips

Use nested layouts for shared navigation, expose minimal props, and keep `slot` placements predictable.

💡 Pro Tip: Think in terms of parent/child layouts and share `load` data via `props`.
← Back to Web Frameworks | Browse all categories | View all cheat sheets