Ski Alerts
A SvelteKit app that tracks ski resort conditions and creates personalized alerts using AI. This is the starter project for the Svelte on Vercel course.
Getting Started
Use Node.js 24. This project uses SvelteKit 3, Svelte 5, Vite 8, and the Vercel adapter 7. SvelteKit and adapter options live in vite.config.ts.
npm install
cp .env.example .env # Add your AI_GATEWAY_API_KEY
npm run devOpen http://localhost:5173 to see the app.
What's Already Built
The UI, data layer, and routing are ready to go:
- Conditions dashboard showing live weather for 5 ski resorts
- Alerts page with localStorage persistence
- Chat interface wired up and waiting for a streaming endpoint
- Resort data for Mammoth, Palisades Tahoe, Grand Targhee, Steamboat, and Mt. Bachelor
- Weather service pulling from Open-Meteo (free, no API key needed)
- Alert schemas validated with Valibot
What You'll Build
Look for // TODO: comments in the codebase. Throughout the course, you'll implement:
- AI chat endpoint (
src/routes/api/chat/+server.ts): Streaming responses with tool calling - Structured output (
src/routes/api/parse-alert/+server.ts): Natural language to structured alert data - Background workflow (
src/routes/api/workflow/+server.ts): Durable execution with error handling - ISR caching (
src/routes/+page.server.ts): Incremental Static Regeneration for the dashboard - AI provider (
src/lib/ai/provider.ts): Centralized model config with usage tracking
Project Structure
src/
├── lib/
│ ├── ai/ # AI provider config (TODO)
│ ├── components/ # ResortCard, AlertCard, Chat
│ ├── data/ # Resort metadata
│ ├── schemas/ # Alert Valibot schemas
│ └── services/ # Weather API, alert evaluation
├── routes/
│ ├── +page.svelte # Conditions dashboard
│ ├── alerts/ # My Alerts page
│ └── api/
│ ├── chat/ # AI streaming endpoint (TODO)
│ ├── evaluate/ # Alert evaluation
│ ├── parse-alert/ # Structured output (TODO)
│ └── workflow/ # Background workflow (TODO)Environment Variables
| Variable | Description |
|---|---|
AI_GATEWAY_API_KEY | API key for the AI Gateway (required for AI features) |
Complete Reference
Switch to the complete branch to see the finished implementation:
git checkout completeTech Stack
- SvelteKit with adapter-vercel
- AI SDK v6 for streaming chat and tool calling
- Valibot for schema validation
- Tailwind CSS v4
- Open-Meteo for weather data