Skip to content

Svelte Firekit Starter

A production-ready starter template for building Firebase-powered applications with SvelteKit and svelte-firekit. Includes interactive demos for every Firekit feature, authentication flows, and a polished UI built with shadcn-svelte.

  • Svelte 5 with runes-based reactivity
  • SvelteKit file-based routing with layout groups
  • Firebase authentication, Firestore, Realtime Database, and Storage
  • svelte-firekit reactive wrappers for all Firebase services
  • shadcn-svelte component library with 30+ UI components
  • Tailwind CSS v4 for styling
  • TypeScript throughout
  • Dark mode support via mode-watcher
  • Form handling with sveltekit-superforms and Valibot/Zod validation

The starter includes 7 interactive demo pages showcasing Firekit features:

PageRouteDescription
Overview/User state dashboard and feature index
Authentication/authUser profile, SignedIn/SignedOut components
Documents/documentsReal-time Firestore document subscriptions
Collections/collectionsCollection queries with reactive updates
Mutations/mutationsCRUD operations, counters, field helpers
Realtime DB/realtimeRealtime Database nodes and lists
Storage/storageFile uploads with progress tracking
Presence/presenceNetwork status and offline detection
  • Node.js (v18+)
  • A Firebase project with the following services enabled:
    • Authentication (Email/Password and Google sign-in providers)
    • Cloud Firestore
    • Realtime Database
    • Storage
  1. Clone the repository:
Terminal window
git clone https://github.com/code-gio/svelte-firekit-starter.git
cd svelte-firekit-starter
  1. Install dependencies:
Terminal window
npm install
  1. Configure Firebase by copying .env.example to .env and filling in your Firebase project credentials:
Terminal window
cp .env.example .env
PUBLIC_FIREBASE_API_KEY=your-api-key
PUBLIC_FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
PUBLIC_FIREBASE_DATABASE_URL=https://your-project.firebaseio.com
PUBLIC_FIREBASE_PROJECT_ID=your-project-id
PUBLIC_FIREBASE_STORAGE_BUCKET=your-project.firebasestorage.app
PUBLIC_FIREBASE_MESSAGING_SENDER_ID=your-sender-id
PUBLIC_FIREBASE_APP_ID=your-app-id
PUBLIC_FIREBASE_MEASUREMENT_ID=G-XXXXXXXXXX
  1. Start the development server:
Terminal window
npm run dev
src/
├── lib/
│ ├── components/
│ │ ├── ui/ # shadcn-svelte components (button, card, sidebar, etc.)
│ │ ├── auth/ # Auth forms (sign-in, sign-up, forgot-password)
│ │ ├── layout/ # App sidebar, navigation, user menu
│ │ └── showcase/ # Demo page utilities (code blocks, sections)
│ ├── hooks/ # Svelte hooks (is-mobile)
│ ├── assets/ # Static assets (favicon)
│ ├── firebase.ts # Firebase app initialization
│ └── utils.ts # Utility functions (cn, getUserInitials)
├── routes/
│ ├── (auth)/ # Public auth routes (sign-in, sign-up, forgot-password)
│ └── (app)/ # Protected routes behind AuthGuard
│ ├── +page.svelte # Overview
│ ├── auth/+page.svelte # Authentication demo
│ ├── documents/+page.svelte # Firestore documents demo
│ ├── collections/+page.svelte # Collections demo
│ ├── mutations/+page.svelte # CRUD demo
│ ├── realtime/+page.svelte # Realtime DB demo
│ ├── storage/+page.svelte # Storage demo
│ └── presence/+page.svelte # Presence demo
└── app.d.ts # TypeScript type definitions

Run the included script to strip all demo content and get a clean starting point:

Terminal window
bash scripts/remove-demo.sh

This script will:

  • Remove all demo route pages (/auth, /documents, /collections, /mutations, /realtime, /storage, /presence)
  • Remove showcase components (demo-section, page-header, code-block)
  • Replace the overview page with a clean starter
  • Reset the sidebar navigation to a single “Home” link

The script preserves the auth service pages (/sign-in, /sign-up, /forgot-password), the app layout with AuthGuard, and all UI components.

CategoryTechnology
FrameworkSvelteKit v2 + Svelte v5
BackendFirebase v12
Firebase SDKsvelte-firekit
UI Componentsshadcn-svelte
StylingTailwind CSS v4
IconsTabler Icons + Lucide
Formssveltekit-superforms
ValidationValibot / Zod
CommandDescription
npm run devStart development server
npm run buildBuild for production
npm run previewPreview production build
npm run checkRun svelte-check for type errors
npm run check:watchRun svelte-check in watch mode