Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

🔥 Weather Front - Svelte


A tiny weather app
🚀 Demo📊 Results

About

This is a simple weather app, built in Svelte (as well as also 10 other frontend frameworks) in order to review, compare and benchmark frontend web frameworks.

  • 🌦️ Live weather conditions
  • 📅 7-day weather forecast
  • 🔍 City search functionality
  • 📍 Geolocation support
  • 💾 Persistent location storage
  • 📱 Responsive design
  • ♿ Accessible interface
  • 🎨 Multi-theme support
  • 🧪 Fully unit tested
  • 🌐 Internationalized

Status

Task Status
Test - Executes all e2e and unit tests Test Status
Lint - Verifies code style and quality Lint Status
Build - Builds and deploys the app Build Status

Usage

First, follow the repo setup instructions. Then cd apps/svelte and use the following commands:

npm run dev    # Start dev server (vite dev --port 3000)
npm test       # Run tests
npm run lint   # Run lint checks
npm build      # Build for production (vite build)
npm start      # Serve built prod app (from ./dist)

For troubleshooting, use npm run verify from the root of the project.

Svelte Implementation

Svelte Stores

The weather-store.js uses Svelte's writable stores for global state management. Store actions are grouped in an object, providing a clean API for weather operations.

Reactivity Without Framework Runtime

Svelte compiles away at build time, meaning no virtual DOM or framework code ships to the browser. Reactive statements using $: syntax automatically recompute when dependencies change.

Built-in State Management

No external state management library needed - Svelte's stores handle global state with automatic reactivity. Components can subscribe to stores using the $store syntax.

SvelteKit Integration

Uses SvelteKit's file-based routing with +page.svelte and +layout.svelte. The $app/environment module provides SSR-safe environment detection with the browser check.

Simplified Component Syntax

Svelte components use <script>, <template>, and <style> sections, but with less boilerplate than other frameworks - no need for explicit return statements or render functions.

About Svelte

Svelte compiles your code at build time into minimal JS with no runtime framework. That makes it very fast, with tiny bundle sizes. It’s one of the most loved frameworks in surveys like Stack Overflow’s. The syntax is simple and elegant, and it feels closer to writing plain HTML, CSS and JS. The main drawback is a smaller ecosystem compared to React or Vue.

My Thoughts on Svelte

Svelte is just fun. There's something magical about writing count += 1 and having the UI automatically update. No useState, no useEffect, no ref() - just assign to a variable and it reacts. This is how UI frameworks should work.

Unlike React or Vue, Svelte doesn't ship a runtime. Your components get compiled into highly optimized vanilla JavaScript at build time. The result? Tiny bundles, blazing fast performance, and surprisingly readable compiled output. Our weather app compiles down to around 15KB, which is frankly ridiculous for a full-featured application.

The $: reactive statements are brilliant for computed values - $: tempDisplay = ${temp}°C`` just works and updates whenever temp changes. Svelte stores handle global state beautifully, and the automatic subscription cleanup means you never have to worry about memory leaks.

The template syntax feels natural - {#if}, {#each}, and {#await} blocks handle conditional rendering and async data elegantly. Two-way binding with bind:value eliminates the usual form boilerplate you'd write in React.

For our simple weather app, we didn't need Svelte's built-in animations or transitions. But Svelte is my go to choice for nearly all my personal projects, as these features become incredibly powerful. The transition: and animate: directives can make your UI feel incredibly polished with minimal code.

Real-World App

Since the weather app is very simple, it may be helpful to see a more practical implementation of a Svelte app. So, checkout:

Networking Toolbox - 100+ offline-first networking tools for sysadmins
🐙 Get it on GitHub at github.com/Lissy93/networking-toolbox
🌐 View the website at networkingtoolbox.net


License

Weather-Front is licensed under MIT © Alicia Sykes 2025.
View Attributions for credits, thanks and contributors.