export declare const gettingStartedContent = "# Getting Started with LiveStore\n\nBuild your first local-first application with LiveStore in minutes. This guide walks through creating a real-time collaborative todo app that works offline and syncs when online.\n\n## Quick Start\n\n### 1. Installation\n\n```bash\n# Install LiveStore core\nnpm install @livestore/livestore\n\n# Choose your platform adapter\nnpm install @livestore/adapter-web # For web applications\nnpm install @livestore/adapter-node # For Node.js applications\nnpm install @livestore/adapter-expo # For React Native/Expo apps\n```\n\n### 2. Define Your Schema\n\nLiveStore uses an event-driven architecture where all changes are recorded as immutable events and applied to materialized SQLite tables.\n\n```typescript\n// schema.ts\nimport { Events, makeSchema, Schema, SessionIdSymbol, State } from '@livestore/livestore'\n\n// Define your state as SQLite tables\nexport const tables = {\n todos: State.SQLite.table({\n name: 'todos',\n columns: {\n id: State.SQLite.text({ primaryKey: true }),\n text: State.SQLite.text({ default: '' }),\n completed: State.SQLite.boolean({ default: false }),\n deletedAt: State.SQLite.integer({ nullable: true, schema: Schema.DateFromNumber }),\n createdAt: State.SQLite.integer({ schema: Schema.DateFromNumber }),\n },\n }),\n \n // Client-only state (not synced)\n uiState: State.SQLite.clientDocument({\n name: 'uiState',\n schema: Schema.Struct({ \n newTodoText: Schema.String, \n filter: Schema.Literal('all', 'active', 'completed') \n }),\n default: { id: SessionIdSymbol, value: { newTodoText: '', filter: 'all' } },\n }),\n}\n\n// Define events that represent state changes\nexport const events = {\n todoCreated: Events.synced({\n name: 'v1.TodoCreated',\n schema: Schema.Struct({ \n id: Schema.String, \n text: Schema.String,\n createdAt: Schema.Date \n }),\n }),\n todoCompleted: Events.synced({\n name: 'v1.TodoCompleted',\n schema: Schema.Struct({ id: Schema.String }),\n }),\n todoUncompleted: Events.synced({\n name: 'v1.TodoUncompleted',\n schema: Schema.Struct({ id: Schema.String }),\n }),\n todoDeleted: Events.synced({\n name: 'v1.TodoDeleted',\n schema: Schema.Struct({ id: Schema.String, deletedAt: Schema.Date }),\n }),\n \n // UI state events (local only)\n uiStateSet: tables.uiState.set,\n}\n\n// Materializers map events to state changes\nconst materializers = State.SQLite.materializers(events, {\n 'v1.TodoCreated': ({ id, text, createdAt }) => \n tables.todos.insert({ id, text, completed: false, createdAt }),\n \n 'v1.TodoCompleted': ({ id }) => \n tables.todos.update({ completed: true }).where({ id }),\n \n 'v1.TodoUncompleted': ({ id }) => \n tables.todos.update({ completed: false }).where({ id }),\n \n 'v1.TodoDeleted': ({ id, deletedAt }) => \n tables.todos.update({ deletedAt }).where({ id }),\n})\n\nconst state = State.SQLite.makeState({ tables, materializers })\n\nexport const schema = makeSchema({ events, state })\n```\n\n### 3. Create Reactive Queries\n\nLiveStore queries automatically update your UI when underlying data changes.\n\n```typescript\n// queries.ts\nimport { queryDb } from '@livestore/livestore'\nimport { tables } from './schema.js'\n\n// Reactive query for all active todos\nexport const activeTodos$ = queryDb(\n tables.todos\n .select()\n .where({ deletedAt: null, completed: false })\n .orderBy('createdAt'),\n { label: 'activeTodos' }\n)\n\n// Reactive query for completed todos\nexport const completedTodos$ = queryDb(\n tables.todos\n .select()\n .where({ deletedAt: null, completed: true })\n .orderBy('createdAt'),\n { label: 'completedTodos' }\n)\n\n// UI state query\nexport const uiState$ = queryDb(\n tables.uiState.get(),\n { label: 'uiState' }\n)\n```\n\n### 4. Connect to Your UI Framework\n\n#### React Integration\n\n```typescript\n// TodoApp.tsx\nimport React from 'react'\nimport { useLiveQuery, dispatchEvent } from '@livestore/react'\nimport { activeTodos$, completedTodos$, uiState$ } from './queries.js'\nimport { events } from './schema.js'\n\nconst TodoApp: React.FC = () => {\n const activeTodos = useLiveQuery(activeTodos$)\n const completedTodos = useLiveQuery(completedTodos$)\n const uiState = useLiveQuery(uiState$)\n \n const createTodo = (text: string) => {\n const id = crypto.randomUUID()\n dispatchEvent(events.todoCreated({ id, text, createdAt: new Date() }))\n }\n \n const toggleTodo = (id: string, completed: boolean) => {\n dispatchEvent(\n completed \n ? events.todoCompleted({ id })\n : events.todoUncompleted({ id })\n )\n }\n \n const deleteTodo = (id: string) => {\n dispatchEvent(events.todoDeleted({ id, deletedAt: new Date() }))\n }\n \n return (\n
\n

Local-First Todos

\n \n {/* Add todo form */}\n
{\n e.preventDefault()\n const form = e.target as HTMLFormElement\n const input = form.elements.namedItem('todo') as HTMLInputElement\n if (input.value.trim()) {\n createTodo(input.value.trim())\n input.value = ''\n }\n }}>\n \n \n
\n \n {/* Active todos */}\n
\n

Active ({activeTodos.length})

\n {activeTodos.map(todo => (\n
\n toggleTodo(todo.id, true)}\n />\n {todo.text}\n \n
\n ))}\n
\n \n {/* Completed todos */}\n
\n

Completed ({completedTodos.length})

\n {completedTodos.map(todo => (\n
\n toggleTodo(todo.id, false)}\n />\n {todo.text}\n \n
\n ))}\n
\n
\n )\n}\n\nexport default TodoApp\n```\n\n#### Vue Integration\n\n```vue\n\n\n\n\n```\n\n### 5. Initialize Your Application\n\n```typescript\n// main.ts\nimport { LiveStore } from '@livestore/livestore'\nimport { WebAdapter } from '@livestore/adapter-web'\nimport { schema } from './schema.js'\n\n// Initialize LiveStore with your schema\nconst liveStore = LiveStore.create({\n schema,\n adapter: WebAdapter({\n databaseName: 'todo-app',\n // Optional: Add sync configuration\n sync: {\n url: 'wss://your-sync-server.com',\n auth: { token: 'your-auth-token' }\n }\n })\n})\n\n// Start your application\nconst app = document.getElementById('app')\nif (app) {\n // Your framework-specific initialization\n // React: createRoot(app).render()\n // Vue: createApp(TodoApp).mount(app)\n}\n```\n\n## Advanced Features\n\n### Offline Support\n\nYour app automatically works offline. All operations execute against the local database, and changes sync when connectivity returns.\n\n```typescript\n// Check online status\nconst isOnline$ = queryDb(\n LiveStore.connectionStatus(),\n { label: 'connectionStatus' }\n)\n```\n\n### Real-Time Collaboration\n\nMultiple users can collaborate in real-time. Conflicts are automatically resolved using last-write-wins or custom merge strategies.\n\n```typescript\n// Custom conflict resolution\nconst materializers = State.SQLite.materializers(events, {\n 'v1.TodoTextChanged': ({ id, text, editedAt }) => \n // Use timestamp for conflict resolution\n tables.todos\n .update({ text, editedAt })\n .where({ id })\n .and(tables.todos.column('editedAt').lt(editedAt))\n})\n```\n\n### Testing\n\n```typescript\n// todo.test.ts\nimport { createTestStore } from '@livestore/testing'\nimport { schema, events } from './schema.js'\n\ntest('creating and completing todos', async () => {\n const store = createTestStore(schema)\n \n // Dispatch events\n await store.dispatch([\n events.todoCreated({ id: '1', text: 'Test todo', createdAt: new Date() }),\n events.todoCompleted({ id: '1' })\n ])\n \n // Query final state\n const completedTodos = await store.query(\n tables.todos.select().where({ completed: true })\n )\n \n expect(completedTodos).toHaveLength(1)\n expect(completedTodos[0].text).toBe('Test todo')\n})\n```\n\n## Next Steps\n\n### Production Deployment\n1. **Set up sync server**: Deploy LiveStore sync server for real-time collaboration\n2. **Configure authentication**: Add user authentication and authorization\n3. **Add monitoring**: Set up distributed tracing and performance monitoring\n4. **Optimize performance**: Add indexes and query optimization\n\n### Advanced Patterns\n- **Multi-user collaboration**: User permissions and access control\n- **Rich text editing**: Operational transforms for collaborative editing\n- **File synchronization**: Binary data and file attachment handling\n- **Schema migrations**: Evolving your data model over time\n\n### Platform-Specific Guides\n- **Web deployment**: Service workers, PWA configuration, OPFS optimization\n- **Mobile apps**: Background sync, push notifications, native storage\n- **Desktop apps**: Electron integration, native file system access\n\n## Examples Repository\n\nExplore complete working examples:\n- **TodoMVC**: Classic todo app with real-time sync\n- **Collaborative Editor**: Rich text editing with operational transforms\n- **Chat Application**: Real-time messaging with presence indicators\n- **E-commerce**: Product catalog with shopping cart and orders\n\n```bash\n# Clone examples repository\ngit clone https://github.com/livestorejs/examples.git\ncd examples/web-todomvc\nnpm install && npm run dev\n```\n\nVisit [docs.livestore.dev](https://docs.livestore.dev) for comprehensive documentation, API reference, and advanced patterns."; //# sourceMappingURL=getting-started.d.ts.map