# SQLiteStateStore

import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';

SQLiteStateStore provides a [State Store](/concepts/state) using local SQLite databases with support for multiple SQLite engines including Bun SQLite, better-sqlite3, and libSQL.

:::note
See the [SQLiteStateStore documentation](/providers/sqlite/sqlite-state-store) for more details.
:::

<Steps>

1. **Configure SQLiteStateStore**

   Update your `alchemy.run.ts` to use local SQLite state storage:

   ```typescript
   import alchemy from "alchemy";
   import { SQLiteStateStore } from "alchemy/state";

   const app = await alchemy("my-app", {
     stateStore: (scope) => new SQLiteStateStore(scope)
   });

   // Your resources here...

   await app.finalize();
   ```

2. **Deploy your app**

   Use the Alchemy CLI to deploy and initialize the SQLite state store:

   <Tabs syncKey="pkgManager">
     <TabItem label="bun">
       ```sh
       bun alchemy deploy
       ```
     </TabItem>
     <TabItem label="npm">
       ```sh
       npx alchemy deploy
       ```
     </TabItem>
     <TabItem label="pnpm">
       ```sh
       pnpm alchemy deploy
       ```
     </TabItem>
     <TabItem label="yarn">
       ```sh
       yarn alchemy deploy
       ```
     </TabItem>
   </Tabs>

   Alchemy automatically creates a SQLite database at `.alchemy/state.sqlite`.

3. **Verify the state store**

   Check that the database file was created:

   ```sh
   ls -la .alchemy/
   # You should see state.sqlite
   ```

4. **View in your editor**

   Most IDEs can view the SQLite database file directly.


   ![SQLite State Store](/sqlite-state-store.jpeg)
</Steps>