sveltekit-pwa-boilerplate Svelte Themes

Sveltekit Pwa Boilerplate

SvelteKit PWA Boilerplate

A modern, opinionated Progressive Web App (PWA) boilerplate built with the latest web technologies. This template provides everything you need to build fast, reliable, and engaging web applications.

๐Ÿš€ Features

  • ๐Ÿ”ง Modern Stack: SvelteKit 2.0, Svelte 5 with runes, TypeScript (strict mode)
  • ๐ŸŽจ Styling: Tailwind CSS 4.0 with shadcn-svelte UI components
  • ๐Ÿ“ฑ PWA Ready: Full offline support, install prompts, automatic updates
  • โšก Performance: Optimized for Vercel deployment with smart caching
  • ๐Ÿ” Code Quality: ESLint, Prettier, TypeScript strict mode
  • ๐Ÿงช Testing: Playwright (E2E) and Vitest (unit tests) pre-configured
  • ๐Ÿ“ฆ Package Manager: pnpm for faster installs and better dependency management

๐Ÿ›  Tech Stack

๐Ÿš€ Getting Started

Prerequisites

  • Node.js: Version 22+ (use fnm use 22)
  • Package Manager: pnpm (recommended)

Installation

  1. Clone or use this template

    git clone <your-repo-url>
    cd sveltekit-pwa-boilerplate
    
  2. Install dependencies

    pnpm install
    
  3. Generate PWA icons

    Run the automated icon generator to create all required PWA icons:

    pnpm run icons:generate
    

    This will automatically create all required icons from static/favicon.svg including:

    • PWA icons (192x192, 512x512, etc.)
    • Apple touch icons
    • Maskable icons
    • Favicon variations
    • Updates manifest.json and app.html

    Alternative manual tools:

Development

# Start development server
pnpm dev

# Start with network access
pnpm dev --host

Building

# Build for production
pnpm build

# Preview production build
pnpm preview

Testing

# Run all tests
pnpm test

# Unit tests only
pnpm test:unit

# E2E tests only
pnpm test:e2e

# Run tests in watch mode
pnpm test:unit --watch

Code Quality

# Format code
pnpm format

# Lint code
pnpm lint

# Type check
pnpm check

# Generate PWA icons
pnpm run icons:generate

๐Ÿ“ฑ PWA Features

Automatic Updates

The app automatically checks for updates and prompts users when new versions are available. Updates are seamless and don't require app store approval.

Offline Support

  • All app shell resources are cached
  • Fallback to cached content when offline
  • Smart cache-first strategy with background updates

Installation

  • Automatic install prompts on supported devices
  • Works on desktop and mobile browsers
  • Native app-like experience

Vercel Deployment

Optimized for Vercel with:

  • Automatic service worker registration
  • Smart caching strategies
  • Zero-config deployment

๐ŸŽจ Styling & Components

Tailwind CSS 4.0

Pre-configured with:

  • Modern CSS features
  • Optimized for production
  • Dark mode support ready

shadcn-svelte

  • High-quality, customizable components
  • Accessible by default
  • Tree-shakeable imports
  • Easy theming

To add components:

pnpm dlx shadcn-svelte@latest add button
pnpm dlx shadcn-svelte@latest add card

๐Ÿ”ง Configuration

TypeScript

Configured in strict mode for maximum type safety. See tsconfig.json.

ESLint & Prettier

Pre-configured for Svelte, TypeScript, and Tailwind CSS. See eslint.config.js and .prettierrc.

PWA Manifest

Edit static/manifest.json to customize:

  • App name and description
  • Theme colors
  • Display mode
  • Icons

Service Worker

The service worker (src/service-worker.ts) handles:

  • Asset caching
  • Update notifications
  • Offline fallbacks

Customize caching strategies as needed for your app.

๐Ÿšข Deployment

  1. Connect your repository to Vercel
  2. Deploy - Zero configuration needed!
  3. PWA features work automatically

The Vercel adapter is pre-configured for optimal PWA performance.

Other Platforms

For other platforms, you may need to:

  1. Change the adapter in svelte.config.js
  2. Adjust service worker paths if needed
  3. Ensure static assets are served correctly

๐Ÿ“ Project Structure

โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app.html              # HTML template with PWA meta tags
โ”‚   โ”œโ”€โ”€ app.css               # Global styles & Tailwind imports
โ”‚   โ”œโ”€โ”€ service-worker.ts     # PWA service worker
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ components/       # Reusable components
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ PWAPrompts.svelte
โ”‚   โ”‚   โ””โ”€โ”€ stores/           # Svelte stores
โ”‚   โ”‚       โ””โ”€โ”€ pwa.ts        # PWA state management
โ”‚   โ””โ”€โ”€ routes/               # SvelteKit routes
โ”‚       โ”œโ”€โ”€ +layout.svelte    # Root layout
โ”‚       โ””โ”€โ”€ +page.svelte      # Homepage
โ”œโ”€โ”€ static/                   # Static assets
โ”‚   โ”œโ”€โ”€ manifest.json         # PWA manifest
โ”‚   โ”œโ”€โ”€ favicon.svg           # App icon
โ”‚   โ””โ”€โ”€ icons-needed.md       # PWA icon requirements
โ”œโ”€โ”€ tests/                    # Test files
โ””โ”€โ”€ package.json              # Dependencies & scripts

๐Ÿค Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ™ Acknowledgments

Top categories

Loading Svelte Themes