Firestore는 웹 클라이언트 간에 데이터의 동기화를 유지하는 데 적합한 확장 가능한 데이터베이스 솔루션입니다.
많은 앱에서 Firestore의 관리형 오프라인 지원이 특히 중요합니다. 이를 통해 네트워크 지연 시간이나 인터넷 연결에 관계없이 작동하는 반응형 앱을 빌드할 수 있게 하기 때문입니다. 하지만 기능이 다양한 SDK를 사용하면 크기와 관련된 비용이 늘어날 수 있습니다. 기본적인 만들기, 읽기, 업데이트, 삭제 작업만 사용하고 관리형 오프라인 지원은 필요 없는 앱에는 어떤 솔루션을 제공하는 것이 좋을까요?
솔루션: Firestore Lite
Firestore Lite는 일반 웹 SDK보다 작은 크기로 단일 문서 가져오기, 쿼리 실행, 문서 업데이트를 지원하는 경량의 독립형 REST 전용 Firestore SDK입니다. Firestore Lite에는 지연 시간 보정, 오프라인 캐싱, 쿼리 재개, 스냅샷 리스너가 생략되어 있지만 특정 사용 사례에서는 라이브러리 크기 감소 및 시작 시간 단축이라는 큰 장단점이 있습니다.
Firestore Lite 가져오기
Firestore Lite는 모듈형 SDK의 일부로 NPM을 통해 제공됩니다. 따라서 완전히 모듈형이며 트리 쉐이킹이 가능합니다.
표준 Firestore SDK의 오프라인 지속성 및 캐싱 기능을 어떤 경우에 포기할지 판단하기가 어려울 수 있습니다. Firestore Lite의 낮은 오버헤드를 위해 포기를 결정하기 앞서 이러한 기능을 이해해야 합니다. 일반적으로 Firestore Lite 사용 여부를 결정할 때는 다음 요소를 고려하세요.
온라인 상태 - Firestore Lite는 실시간 업데이트와 연결이 필요 없는 앱에 적합합니다.
크기 제약 조건 - Firestore Lite는 전체 자바스크립트 번들 크기를 축소하려는 경우에 적합합니다.
[null,null,["최종 업데이트: 2025-08-16(UTC)"],[],[],null,["\u003cbr /\u003e\n\nFirestore is a good scalable database solution to keep data in sync across Web\nclients.\n\nFor many apps, Firestore's managed offline support is especially important,\nletting you build responsive apps that work regardless of network latency or\nInternet connectivity. But feature-rich SDKs come at a size cost. What\ndoes Firebase offer for apps that only need to use basic create, read, update\nand delete operations, and don't need managed offline support?\n| **Note:** Before using Firestore Lite, be sure you understand the standard Firestore Web API and Firestore's offline capabilities as part of the full [feature set](../index.html). We recommend Firestore Lite for developers who have experience building with Firestore and can evaluate the tradeoffs of using a lightweight version.\n\nSolution: Firestore Lite\n\nFirestore Lite is a lightweight, standalone REST-only Firestore SDK that\nsupports single document fetches, query execution, and document updates, at a\nfraction of the regular Web SDK size. Firestore Lite omits latency compensation,\noffline caching, query resumption and snapshot listeners, but for particular\nuse cases, the reductions in library size and startup time make a great tradeoff.\n\nImport Firestore Lite\n\nFirestore Lite is available via npm as part of the\n[modular SDK](//firebase.google.com/docs/web/learn-more#modular-version). It is\nthus fully modular and tree-shakeable.\n\nThe following import style is supported. \n\n import { initializeApp } from \"firebase/app\";\n import {\n getFirestore,\n getDoc,\n updateDoc\n } from 'firebase/firestore/lite';\n\nAPI features not supported by Firestore Lite\n\nFor size and speed, Firestore Lite omits these features from the standard\nFirestore SDK:\n\n- **DocumentSnapshot event handlers** . The `onSnapshot` method and `DocumentChange`, `SnapshotListenerOptions`, `SnapshotMetadata`, `SnapshotOptions` and `Unsubscribe` objects are not included.\n- **Persistence helpers** . The `enableIndexedDBPersistence`, `enableMultiTabIndexedDbPersistence`, and `clearIndexedDbPersistence` methods are not included.\n- **Firestore bundles** . The `loadBundle` method and related methods, and the `LoadBundleTask` and `LoadBundleTaskProgress` objects are not included.\n\nImplement document fetches, queries and updates\n\nAfter importing Firestore Lite, you can make all of the familiar API get\nand update calls. The use cases for [adding data](../manage-data/add-data)\nand [getting data](../query-data/get-data) all apply. \n\n import {\n getFirestore,\n getDoc,\n updateDoc,\n doc\n } from '@firebase/firestore/lite';\n\n const firestore = getFirestore(app);\n const docRef = doc(firestore, 'collection/doc');\n const docSnap = await getDoc(docRef);\n await updateDoc(docRef, \"field\", 'value');\n\nWhen to use Firestore Lite\n\nIt can be tricky to decide when to let go of the standard Firestore SDK's\noffline persistence and caching features. You should understand these features\nbefore deciding to trade them away for the lower overhead of Firestore Lite. In\ngeneral, weigh these factors when deciding whether to use Firestore Lite:\n\n- **Online status** - Firestore Lite is good for apps that do not need live updates and have connectivity.\n- **Size constraints** - Firestore Lite is great if you want to reduce your overall JavaScript bundle size."]]