Skip to content

About

This interactive map displays webcams from all over Switzerland, giving you a real-time glimpse of the current weather conditions and helping you plan your next outdoor adventure.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Sunpeak

This interactive map displays webcams from all over Switzerland, giving you a real-time glimpse of the current weather conditions and helping you plan your next outdoor adventure. So why wait? Let's find out where the sun is shining today!

Available here: sunpeak.app

Tech stack

  • Next.js (App Router) with React and TypeScript
  • Leaflet / react-leaflet for the interactive map, with MapLibre rendering swisstopo's vector tiles underneath. MapLibre is served from public/vendor (copied by scripts/copy-maplibre.mjs before dev and build) instead of the bundle, so the page and its web worker share one download
  • Tailwind CSS for styling
  • Biome for linting and formatting
  • Vitest for unit tests

Languages

The app is available in German (default) and English under /de and /en. A proxy (src/proxy.ts) sends unprefixed URLs such as / to the language picked with the switcher, then to the browser language. All texts live in src/messages/ as typed dictionaries; a unit test checks that both languages have the same keys and placeholders.

Pages

Besides the map (/de, /en), every webcam has its own indexable page under /webcams/<slug>, and every town from the sheet's Ort column gets a page listing its webcams under /webcams/in/<town> (e.g. /de/webcams/in/lenzerheide), which is what a search for "Webcam Lenzerheide" should land on. /webcams lists all webcams grouped by town. All of them carry hreflang links, Open Graph tags and schema.org data and are listed in /sitemap.xml.

Data sources

Data Source
Webcams A Google Sheet (read via the Sheets API), manually curated with name, location, coordinates, and image URLs
Temperature, sunshine & wind MeteoSwiss 10-minute measurements via data.geo.admin.ch
Webcam altitude swisstopo height service, cached for good per position
Map tiles swisstopo light base map (vector tiles) recoloured to night tones, grey pixel map as raster fallback without WebGL

The MeteoSwiss data is delivered in the Swiss LV95 coordinate system and converted to WGS84 with proj4.

Getting started

  1. Use Node.js 24 (nvm use).

  2. Install dependencies:

    npm ci
  3. Copy .env.template to .env.local and fill in the values (see the comments in the template for where to get them).

  4. Start the dev server:

    npm run dev

Scripts

Script Description
npm run dev Start the development server
npm run build Create a production build
npm run start Serve the production build
npm run lint Typegen, Biome, type check, and unused-code check
npm run format Format all files with Biome
npm run test:unit Run unit tests once
npm run test:unit:watch Run unit tests in watch mode
npm run test:unit:coverage Run unit tests with a coverage report
npm run map:style Rebuild public/map-style-dark.json from swisstopo's current light base map style

Continuous integration

Pull requests against main run lint (Biome, type check, unused exports), unit tests, and a production build via GitHub Actions. Dependency updates are managed by Renovate.

Deployment

The app is deployed on Vercel; every push to main goes to production. The environment variables from .env.template must be configured in the Vercel project.

License

MIT

About

This interactive map displays webcams from all over Switzerland, giving you a real-time glimpse of the current weather conditions and helping you plan your next outdoor adventure.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Used by

Contributors

Languages