# Svelte Adapter API — repStore() and repSecureStore() > API reference for @rep-protocol/svelte. repStore() creates a readable store for public variables with SSE hot reload. repSecureStore() for async encrypted variable access. Source: https://rep-protocol.dev/reference/adapters/svelte/ ```bash npm install @rep-protocol/svelte @rep-protocol/sdk ``` ## `repStore(key, defaultValue?)` ```typescript function repStore(key: string, defaultValue?: string): Readable; ``` Reads a PUBLIC tier variable as a Svelte `Readable` store. | Parameter | Type | Description | |---|---|---| | `key` | `string` | Variable name | | `defaultValue` | `string` | Optional fallback value | **Returns:** `Readable` **Behavior:** - Synchronous initial value from the payload - SSE subscription is **lazy** — established only when the store has subscribers - Updates automatically on config changes via hot reload - SSE connection closes when all subscribers unsubscribe ## `repSecureStore(key)` ```typescript function repSecureStore(key: string): Readable; ``` Reads a SENSITIVE tier variable as a `Readable` store. | Parameter | Type | Description | |---|---|---| | `key` | `string` | Variable name | **Returns:** `Readable` **Behavior:** - Starts as `null` - Resolves after session key fetch and decryption - Errors are swallowed (SDK logs them); store stays `null` - Does **not** support hot reload ## Requirements - Svelte >= 4 or Svelte 5 - `@rep-protocol/sdk` peer dependency