Skip to content

thortek/thor-3770-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Thor Dev - Svelte Tutorial Application

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/

Tutorial Home

πŸ“š Overview

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.

✨ Features

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

πŸ› οΈ Tech Stack

πŸ“ Project Structure

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

πŸŽ“ Tutorial Sections

⚑ Reactivity

Learn Svelte's reactive state management:

  • $state: Reactive variables that trigger UI updates
  • $derived: Automatically computed values
  • $effect: Side effects and cleanup
  • Counter: Demonstrates independent reactive state

Key Components:

  • Counter.svelte - Independent counter with shared global state
  • globalState.svelte.ts - Shared reactive state

πŸ”— Props

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 - Accepts name prop with default value
  • CodeBlock - 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

🎯 Events

Handle user interactions:

  • DOM event handlers (onclick, onpointermove, etc.)
  • Event bubbling and propagation
  • Passing event handlers as props
  • Stepper: Increment/decrement callbacks
  • BigGreenButton: Custom click handlers

Key Components:

  • Stepper.svelte - Accepts increment and decrement functions
  • BigGreenButton.svelte - Forwards all props

πŸ”„ Bindings

Two-way data binding:

  • bind:value: Text inputs, numbers, textareas
  • bind:group: Radio buttons and checkboxes
  • bind:checked: Single checkbox state
  • Markdown rendering with marked
  • Form validation examples

Key Components:

  • InsecureQuestion.svelte - Complex form with multiple binding types

πŸš€ Getting Started

Prerequisites

  • Node.js (version specified in package.json)
  • npm, pnpm, yarn, or bun

Installation

# 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

Available Scripts

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

🎨 Theming

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

πŸ”§ Configuration Files

  • 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

πŸ“¦ Key Dependencies

Production

  • @faker-js/faker - Generate fake data for examples
  • marked - Markdown to HTML converter

Development

  • @skeletonlabs/skeleton - UI component library
  • @sveltejs/kit - SvelteKit framework
  • @sveltejs/adapter-vercel - Vercel deployment adapter
  • @tailwindcss/vite - TailwindCSS integration
  • shiki - Syntax highlighting
  • typescript - Type safety

🌐 Deployment

This project is configured for Vercel deployment using @sveltejs/adapter-vercel.

# Build for production
npm run build

# Preview production build locally
npm run preview

The build output is optimized and ready for deployment to Vercel or any Node.js hosting platform.

πŸ“ Code Highlights

Reactive State with $state

// src/lib/global/globalState.svelte.ts
export const counter = $state({ count: 0 })

Derived State with $derived

<!-- src/routes/tutorial/reactivity/+page.svelte -->
let numbers = $state([1, 2, 3, 4]);
let total = $derived(numbers.reduce((acc, n) => acc + n, 0));

Props with Defaults

<!-- src/lib/components/Child.svelte -->
<script lang="ts">
    let { name = 'Thor' } = $props()
</script>

<p>Hello {name}!</p>

Two-way Binding

<!-- src/routes/tutorial/bindings/+page.svelte -->
<input type="text" bind:value={name} />

🎯 Learning Objectives

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

πŸ“„ License

This is a tutorial project for educational purposes.

🀝 Contributing

This is a personal learning project, but feedback and suggestions are welcome!


Built with ⚑ by Thor | Powered by Svelte 5 & TailwindCSS 4

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors