Sveltefire
Cybernetically enhanced Firebase apps
Install / Use
/learn @codediodeio/SveltefireREADME
A minimal, yet powerful library that puts realtime Firebase data into Svelte stores.
Build Complex Apps Faster
SvelteFire allows you to access Firebase Auth, Firestore, Storage, RealtimeDB, and Analytics with minimal complexity. It simplfies relational data with a declarative syntax, handles loading states, automatically disposes of realtime data subscriptions, and more!
Gaze in awe at the example below where we fetch multiple levels of realtime user data with just a few lines of Svelte code:
<!-- 1. 🔥 Firebase App -->
<FirebaseApp {auth} {firestore}>
<!-- 2. 👤 Get the current user -->
<SignedIn let:user>
<p>Howdy, {user.uid}</p>
<!-- 3 (a). 📜 Get a Firestore document owned by a user -->
<Doc ref={`posts/${user.uid}`} let:data={post} let:ref={postRef}>
<h2>{post.title}</h2>
<!-- 4 (a). 💬 Get all the comments in its subcollection -->
<Collection ref={postRef.path + '/comments'} let:data={comments}>
{#each comments as comment}
{/each}
...
Each component in this example above is underpinned by a Svelte store. These custom stores can be used for fine-grained control and to implement your own custom patterns.
Use stores to access Firebase data with Svelte's reactive $ syntax:
<script>
import { docStore } from 'sveltefire';
import { firestore } from '$lib/firebase'; // your firestore instance
const post = docStore(firestore, 'posts/id');
</script>
{$post?.title}
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
