Skip to content

Introduction

svelte-firekit is a complete Firebase integration library for Svelte 5 and SvelteKit. It wraps every major Firebase service in reactive primitives built with Svelte 5 runes ($state, $derived) so that your UI automatically updates when Firebase data changes — without stores, without manual subscriptions, and without cleanup boilerplate.

Every reactive piece of state in svelte-firekit is a plain class property powered by $state. There are no Svelte stores. You read .data, .loading, .error directly — Svelte’s reactivity system does the rest.

<script lang="ts">
import { firekitDoc } from 'svelte-firekit';
const post = firekitDoc<Post>('posts/my-post');
</script>
<!-- Svelte re-renders whenever post.data changes -->
{#if post.loading}
<p>Loading…</p>
{:else if post.data}
<h1>{post.data.title}</h1>
{/if}

No service makes network calls on the server. Every reactive instance returns safe defaults (loading: false, data: null, empty arrays) during SSR so your pages render without Firebase credentials or browser APIs. Client-side hydration then kicks in and opens the real-time listener.

svelte-firekit never imports $app/* or $env/*, so it works in any Svelte 5 project — Vite, plain SvelteKit, or custom setups.

Class / function API — instantiate a reactive object in <script> and read its properties directly in your template.

Component API — use <Doc>, <Collection>, <AuthGuard>, etc. for a declarative, slot-driven approach.

Both APIs are first-class and cover the same surface area. Pick the style that fits your project.

AreaServices
AuthEmail, OAuth, Phone, MFA, SAML, OIDC, Anonymous, Custom token
FirestoreDocuments, collections, collection groups, queries, pagination, batch, transactions, bundles
Realtime DatabaseNodes, lists, presence
StorageDownload URLs, uploads, directory listings, metadata
AIGemini generation, streaming, multi-turn chat (Google AI + Vertex AI)
FunctionsCallable functions by name or URL
MonitoringAnalytics, Performance Monitoring, Remote Config
MessagingFCM push notifications, In-App Messaging
PlatformApp Check, Presence tracking