sveltekit-data-flow▌
spences10/svelte-skills-kit · updated Apr 8, 2026
Which file? Server-only (DB/secrets): +page.server.ts |
- ›Universal (runs both): +page.ts | API: +server.ts
SvelteKit Data Flow
Quick Start
Which file? Server-only (DB/secrets): +page.server.ts |
Universal (runs both): +page.ts | API: +server.ts
Load decision: Need server resources? → server load | Need client APIs? → universal load
Form actions: Always +page.server.ts. Return fail() for
errors, throw redirect() to navigate, throw error() for failures.
Example
// +page.server.ts
import { fail, redirect } from '@sveltejs/kit';
export const load = async ({ locals }) => {
const user = await db.users.get(locals.userId);
return { user }; // Must be JSON-serializable
};
export const actions = {
default: async ({ request }) => {
const data = await request.formData();
const email = data.get('email');
if (!email) return fail(400, { email, missing: true });
await updateEmail(email);
throw redirect(303, '/success');
},
};
Reference Files
- load-functions.md - Server vs universal
- form-actions.md - Form handling patterns
- serialization.md - What can/can't serialize
- error-redirect-handling.md - fail/redirect/error
- client-auth-invalidation.md - invalidateAll() after client-side auth
Notes
- Server load → universal load via
dataparam | ALWAYSthrow redirect()/error() - No class instances/functions from server load (not serializable)
- Last verified: 2025-01-11
Discussion
Product Hunt–style comments (not star reviews)- No comments yet — start the thread.
Ratings
4.5★★★★★60 reviews- ★★★★★Nia Bhatia· Dec 24, 2024
We added sveltekit-data-flow from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Pratham Ware· Dec 20, 2024
sveltekit-data-flow reduced setup friction for our internal harness; good balance of opinion and flexibility.
- ★★★★★Evelyn Bhatia· Dec 20, 2024
I recommend sveltekit-data-flow for anyone iterating fast on agent tooling; clear intent and a small, reviewable surface area.
- ★★★★★Fatima Martinez· Dec 12, 2024
Keeps context tight: sveltekit-data-flow is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Nia Harris· Nov 15, 2024
Keeps context tight: sveltekit-data-flow is the kind of skill you can hand to a new teammate without a long onboarding doc.
- ★★★★★Tariq Huang· Nov 11, 2024
Solid pick for teams standardizing on skills: sveltekit-data-flow is focused, and the summary matches what you get after install.
- ★★★★★Camila Nasser· Nov 3, 2024
We added sveltekit-data-flow from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
- ★★★★★Camila Wang· Oct 22, 2024
sveltekit-data-flow fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
- ★★★★★Sakura Sethi· Oct 6, 2024
sveltekit-data-flow is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
- ★★★★★Michael Anderson· Oct 2, 2024
sveltekit-data-flow has been reliable in day-to-day use. Documentation quality is above average for community skills.
showing 1-10 of 60