A comprehensive, interactive Svelte 5 tutorial application showcasing modern web development practices with beautiful UI and hands-on examples.
See the live demo: https://thor-3770-app.vercel.app/
This project is a fully-featured tutorial platform built with SvelteKit 5, TailwindCSS 4, and the Skeleton UI library. It demonstrates core Svelte concepts through interactive examples and visually stunning interfaces.
| Feature | Description |
|---|---|
| β‘ Reactivity | Master Svelte's reactive magic with $state, $derived, and $effect |
| π Props | Learn component communication patterns |
| π§ Logic | Conditional rendering, loops, and async patterns |
| π― Events | Handle user interactions and DOM events |
| π Bindings | Two-way data binding mastery |
- Framework: SvelteKit 5 with Svelte 5 runes
- Styling: TailwindCSS 4 + Skeleton UI
- Language: TypeScript
- Syntax Highlighting: Shiki
- Deployment: Vercel via
adapter-vercel - Build Tool: Vite
thor-3770-app/
βββ src/
β βββ routes/ # SvelteKit routes
β β βββ +layout.svelte # Root layout
β β βββ +page.svelte # Landing page
β β βββ tutorial/ # Tutorial section
β β βββ +layout.svelte # Tutorial navigation
β β βββ +page.svelte # Tutorial home
β β βββ reactivity/ # Reactivity tutorial
β β βββ props/ # Props tutorial
β β βββ logic/ # Logic blocks tutorial
β β βββ events/ # Events tutorial
β β βββ bindings/ # Bindings tutorial
β βββ lib/
β β βββ components/ # Reusable components
β β β βββ Counter.svelte
β β β βββ Child.svelte
β β β βββ CodeBlock/ # Syntax highlighting
β β β βββ ...
β β βββ global/ # Global state
β β β βββ globalState.svelte.ts
β β βββ utils/ # Utility functions
β βββ app.css # Global styles
β βββ app.html # HTML template
βββ static/ # Static assets
βββ package.json
βββ svelte.config.js
βββ vite.config.ts
βββ tsconfig.json
Learn Svelte's reactive state management:
$state: Reactive variables that trigger UI updates$derived: Automatically computed values$effect: Side effects and cleanupCounter: Demonstrates independent reactive state
Key Components:
Counter.svelte- Independent counter with shared global stateglobalState.svelte.ts- Shared reactive state
Master component communication:
- Passing data from parent to child
- Default prop values with destructuring
- Type-safe props with TypeScript
Child: Example component receiving props
Key Components:
Child.svelte- Acceptsnameprop with default valueCodeBlock- Syntax-highlighted code examples
π§ Logic
Control flow and rendering patterns:
#if/#else: Conditional rendering#each: Loop through arrays#await: Handle async operations with loading states- Live examples with avatars using
@faker-js/faker
Key Features:
getRandomNumber()- Async promise example- Dynamic avatar generation with faker
Handle user interactions:
- DOM event handlers (
onclick,onpointermove, etc.) - Event bubbling and propagation
- Passing event handlers as props
Stepper: Increment/decrement callbacksBigGreenButton: Custom click handlers
Key Components:
Stepper.svelte- AcceptsincrementanddecrementfunctionsBigGreenButton.svelte- Forwards all props
Two-way data binding:
bind:value: Text inputs, numbers, textareasbind:group: Radio buttons and checkboxesbind:checked: Single checkbox state- Markdown rendering with
marked - Form validation examples
Key Components:
InsecureQuestion.svelte- Complex form with multiple binding types
- Node.js (version specified in package.json)
- npm, pnpm, yarn, or bun
# Clone the repository
git clone <your-repo-url>
cd thor-3770-app
# Install dependencies
npm install
# Start development server
npm run dev
# Open browser
npm run dev -- --open| Command | Description |
|---|---|
npm run dev |
Start development server |
npm run build |
Build for production |
npm run preview |
Preview production build |
npm run check |
Type-check Svelte files |
npm run lint |
Run ESLint |
npm run format |
Format code with Prettier |
The app uses Skeleton UI themes with the "mint" theme as default. Change the theme in app.html:
<html lang="en" data-theme="mint">Available themes: cerberus, mint, modern
- svelte.config.js - SvelteKit configuration with Vercel adapter
- vite.config.ts - Vite build configuration
- tsconfig.json - TypeScript configuration
- eslint.config.js - ESLint rules
- .prettierrc - Code formatting rules
@faker-js/faker- Generate fake data for examplesmarked- Markdown to HTML converter
@skeletonlabs/skeleton- UI component library@sveltejs/kit- SvelteKit framework@sveltejs/adapter-vercel- Vercel deployment adapter@tailwindcss/vite- TailwindCSS integrationshiki- Syntax highlightingtypescript- Type safety
This project is configured for Vercel deployment using @sveltejs/adapter-vercel.
# Build for production
npm run build
# Preview production build locally
npm run previewThe build output is optimized and ready for deployment to Vercel or any Node.js hosting platform.
// src/lib/global/globalState.svelte.ts
export const counter = $state({ count: 0 })<!-- src/routes/tutorial/reactivity/+page.svelte -->
let numbers = $state([1, 2, 3, 4]);
let total = $derived(numbers.reduce((acc, n) => acc + n, 0));<!-- src/lib/components/Child.svelte -->
<script lang="ts">
let { name = 'Thor' } = $props()
</script>
<p>Hello {name}!</p><!-- src/routes/tutorial/bindings/+page.svelte -->
<input type="text" bind:value={name} />By exploring this codebase, you'll learn:
β
Modern Svelte 5 runes ($state, $derived, $effect, $props)
β
SvelteKit routing and layouts
β
Component composition patterns
β
Event handling and binding
β
TypeScript integration
β
TailwindCSS + Skeleton UI styling
β
Build optimization with Vite
β
Production deployment strategies
This is a tutorial project for educational purposes.
This is a personal learning project, but feedback and suggestions are welcome!
Built with β‘ by Thor | Powered by Svelte 5 & TailwindCSS 4
