A modern e-commerce demo built with SvelteKit, showcasing SSR, server-side data fetching, and URL-driven state management.
+page.server.ts)Pages are defined by the file system structure (src/routes/). No need to manually configure a router — the folder hierarchy is the routing. This keeps the project organized and self-documenting.
+page.server.ts)Data is fetched on the server before the page is rendered. This means:
Pages are rendered on the server and sent as HTML to the browser. This provides:
Filter state (category, search, price) is stored in URL search params. This means:
data-sveltekit-preload-data="hover")When a user hovers over a link, SvelteKit starts fetching the data for that page in the background. By the time they click, the page loads almost instantly.
redirect())Redirects are handled on the server with proper HTTP status codes (302), ensuring correct behavior for both browsers and crawlers.
error())SvelteKit provides built-in error throwing from server load functions with proper HTTP status codes, making error handling clean and consistent.
$props() — Replaces export let with a more explicit, type-safe way to declare component props$bindable() — Clearly marks which props support two-way binding{@render children()} — Replaces slots with a more flexible snippet-based composition modelSvelteKit comes with Vite under the hood, providing HMR (Hot Module Replacement), TypeScript support, and optimized builds out of the box — no webpack config needed.
npm install
npm run dev
npm run build
Preview the production build:
npm run preview