Outline updated November 2026
Svelte Pro Techniques
Class Duration
14 hours of live training delivered over 2 days.
Student Prerequisites
- Svelte, JavaScript, and HTML programming experience
- Working knowledge of runes, snippets, and SvelteKit routing
- Experience with CSS is helpful but not required
Target Audience
Developers who already build with Svelte and SvelteKit and want to write larger, faster, easier-to-maintain apps. This course assumes the fundamentals from Svelte Essentials; together the two courses form a five-day Svelte and SvelteKit program.
Description
This course covers the advanced parts of Svelte and SvelteKit for developers who already ship Svelte apps. It starts with fine-grained reactivity: reactive classes, writable deriveds, untrack, the reactive built-ins, and $inspect.trace. Students then build typed generic components, type-safe context, attachments, and motion with Tween and Spring. SvelteKit topics include hooks, error handling, invalidation, shallow routing, explicit environment variables, and observability. The course closes with the experimental async features and a testing strategy with Vitest, Storybook, and Playwright.
Learning Outcomes
- Design reactive state with classes,
.svelte.tsmodules, and writable deriveds. - Use the reactive built-ins in
svelte/reactivity. - Debug reactivity with
$inspect,$inspect.trace, and IDE breakpoints. - Use function, media, and dimension bindings.
- Build typed generic components with snippet props and
createContext. - Write reusable attachments and convert actions with
fromAction. - Build transitions and motion with
TweenandSpring. - Handle errors and pending states with
<svelte:boundary>. - Apply advanced SvelteKit routing, hooks, invalidation, shallow routing, and snapshots.
- Configure explicit, validated environment variables.
- Trace requests with OpenTelemetry and
instrumentation.server.ts. - Evaluate the experimental
awaitin components and remote functions. - Test components, load functions, and form actions with Vitest, Storybook, and Playwright.
Training Materials
Comprehensive courseware is distributed online at the start of class.
Software Requirements
Students will need a free, personal GitHub account to access the courseware. Students will need permission to install Node.js and Visual Studio Code on their computers. Also, students will need permission to install NPM Packages and Visual Studio Code extensions. If students are unable to configure a local environment, a cloud-based environment can be provided.
Software versions: Svelte 5 and SvelteKit 3 with Vite 8, TypeScript 6, and Node.js 22.17 or later.
Training Topics
Fine-Grained Reactivity in Depth
- How signals, effects, and push-pull updates work
- Reactive classes with
$stateand$derivedfields - Shared reactive modules in
.svelte.tsfiles - Writable deriveds for optimistic UI
untrackand$effect.tracking$effect.preand$effect.rootSvelteMap,SvelteSet, andSvelteURLMediaQueryfor responsive state- Window state from
svelte/reactivity/window - External sources with
createSubscriber
Debugging Svelte Apps
{@debug}and$inspect- Tracing effect dependencies with
$inspect.trace - Breakpoint debugging in VS Code and JetBrains
- Compiler warnings and runtime warnings
Advanced Bindings
- Function bindings with getters and setters
- Content-editable bindings
- Each block bindings
- Media element bindings
- Read-only dimension bindings
- Element references with
bind:this - Bindable props across component boundaries
Advanced Component Composition
- Snippet props, parameters, and fallbacks
- Typing snippets with
Snippet - Generic components with the
genericsattribute - Type-safe context with
createContext - Reactive context patterns
- Module scripts with
<script module> - Unique IDs with
$props.id() - Reading named slots in existing code
Attachments and Actions
- Attachment factories and inline attachments
- Re-running attachments when state changes
- Conditional attachments
- Passing attachments through wrapper components
- Spreading attachments with
createAttachmentKey - Converting actions with
fromAction - Wrapping third-party DOM libraries
UI Special Effects
- Motion with the
TweenandSpringclasses - Respecting
prefersReducedMotion - The
transition:directive and parameters in:andout:transitions- Custom CSS and JavaScript transitions
- Transition events
- Local vs. global transitions
- Key blocks
- The
animate:directive andflip
Special Elements
<svelte:boundary>withfailedandpendingsnippets<svelte:element>for dynamic tags<svelte:window>,<svelte:document>, and<svelte:body><svelte:head><svelte:options>- Replacing
<svelte:self>with self-imports - Replacing
<svelte:component>with dynamic components - Replacing
<svelte:fragment>with snippets
Advanced Routing
- Optional parameters
- Rest parameters
- Param matchers in
src/params.ts - Route groups and breaking out of layouts
- Route sorting and encoding
- Organizing layouts and routes
Hooks
- Server, client, and universal hooks files
handle,sequence, andevent.localshandleFetchfor server-side requestshandleErrorfor all error kindsrerouteandtransportinitfor startup work
Errors in Depth
- Error boundaries for load and render errors
- Typing
App.Error - Controlling status codes from
handleError
Pages and Layouts
ssr,csr, andprerenderpage optionstrailingSlash- Universal vs. server load functions
- Invalidation with
dependsandinvalidate - Reloading everything with
refreshAll - Snapshots for ephemeral state
- Shallow routing with
gotoandpage.state - View transitions with
onNavigate
Links
- Preloading data and code
data-sveltekit-*link options- Reloading and replacing state
Configuration and Operations
- Explicit environment variables in
src/env.ts - Public and private variables
- Static and dynamic values
- Validating variables with Standard Schema
- Server-only modules
instrumentation.server.tsand OpenTelemetry tracing
Async Svelte (Experimental)
- Enabling
awaitin components awaitin markup and$derived- Pending states with
<svelte:boundary> $effect.pending()settled()andfork()- Adoption guidance for experimental features
Remote Functions (Experimental)
- Type-safe calls from
.remote.tsfiles query,query.batch, andquery.liveformwith schema validation- Form fields with
field.as() commandand single-flight mutationsprerenderfor static data- Remote functions vs. load functions and form actions
Unit Testing
- Why unit test Svelte?
- Vitest setup with
sv add vitest - Testing runes in
.svelte.test.tsfiles flushSyncand$effect.rootin tests- Component tests with Testing Library
- Vitest browser mode
- Interaction tests with Storybook
- Testing load functions, form actions, and hooks
- End-to-end tests with Playwright