{"library":"localbase","title":"Localbase: Offline Firebase-Style Database","description":"Localbase is a JavaScript library providing a Firebase Cloud Firestore-like API for an offline, browser-based database powered by IndexedDB. It simplifies local data persistence, allowing developers to manage data in collections and documents without direct interaction with the complexities of IndexedDB. The current stable version is 0.7.7. Releases appear somewhat irregularly, primarily addressing bug fixes, compatibility issues (e.g., Vite environment), and new features like collection filtering. Its key differentiators include its familiar API for developers accustomed to Firebase, robust offline capabilities, and its foundation on LocalForage, which handles cross-browser IndexedDB inconsistencies. It also ships with TypeScript type definitions for improved developer experience.","language":"javascript","status":"active","last_verified":"Wed Apr 22","install":{"commands":["npm install localbase"],"cli":null},"imports":["import Localbase from 'localbase'","import Localbase from 'localbase'\n// ... then use 'new Localbase()' which provides type inference ..."],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import Localbase from 'localbase'\n\nconst db = new Localbase('my-app-db')\n\nasync function manageData() {\n  // Add a document\n  await db.collection('users').add({\n    id: 'user123',\n    name: 'Alice',\n    email: 'alice@example.com'\n  })\n  console.log('Added Alice.')\n\n  // Update a document\n  await db.collection('users').doc('user123').update({\n    email: 'alice.updated@example.com'\n  })\n  console.log('Updated Alice\\'s email.')\n\n  // Get all documents in a collection\n  const users = await db.collection('users').get()\n  console.log('Current users:', users)\n\n  // Get a specific document\n  const alice = await db.collection('users').doc('user123').get()\n  console.log('Alice data:', alice)\n}\n\nmanageData().catch(console.error)","lang":"typescript","description":"This quickstart demonstrates how to initialize Localbase, add a new document to a collection, update an existing document, and retrieve data from a collection and a specific document using async/await.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}