# Defender store mock when running locally

**URL:** <https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756>\
**Category:** Defender\
**Created:** [July 2, 2021, 9:10pm UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756 "2021-07-02T21:10:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![abarmat](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abarmat/32/7319_2.png) [@abarmat](https://forum.openzeppelin.com/u/abarmat)\
**Post date:** [July 2, 2021, 9:10pm UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756/1 "2021-07-02T21:10:04Z")

</div>

Hey, is there any official way to mock the Defender kvstore when running locally?

Thanks.

---

<div class="post-metadata">

**Author:** ![spalladino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/spalladino/32/22_2.png) [@spalladino](https://forum.openzeppelin.com/u/spalladino)\
**Post date:** [July 2, 2021, 9:59pm UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756/2 "2021-07-02T21:59:17Z")

</div>

Not yet. What would work best for you…?

- An ephemeral in-memory store
- A disk-based local store
- A store that connects to the kvstore in your Defender account via an API token

---

<div class="post-metadata">

**Author:** ![abarmat](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/abarmat/32/7319_2.png) [@abarmat](https://forum.openzeppelin.com/u/abarmat)\
**Post date:** [July 4, 2021, 12:54am UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756/3 "2021-07-04T00:54:47Z")

</div>

For testing purposes I find a disk-based local store sufficient, so you can try persistence across multiple runs, even from different autotasks.

---

<div class="post-metadata">

**Author:** ![spalladino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/spalladino/32/22_2.png) [@spalladino](https://forum.openzeppelin.com/u/spalladino)\
**Post date:** [July 5, 2021, 12:53pm UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756/4 "2021-07-05T12:53:27Z")

</div>

Got it! Will work on it this week.

---

<div class="post-metadata">

**Author:** ![spalladino](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.openzeppelin.com/spalladino/32/22_2.png) [@spalladino](https://forum.openzeppelin.com/u/spalladino)\
**Post date:** [July 5, 2021, 7:06pm UTC](https://forum.openzeppelin.com/t/defender-store-mock-when-running-locally/11756/5 "2021-07-05T19:06:50Z")

</div>

Hey @abarmat, check out the [1.10.0-local.0](https://www.npmjs.com/package/defender-kvstore-client/v/1.10.0-local.0) release of the `kvstore-client`. It’s still not tagged as `latest` until it’s reviewed, but it may help in the meantime!

```auto
const { KeyValueStoreClient } = require('defender-kvstore-client');

async function local() {
  // Creates an instance of the client that will write to a local file
  const store = new KeyValueStoreClient({ path: '/tmp/foo/store.json' });

  // The store.json file will contain { myKey: myValue }
  await store.put('myKey', 'myValue');
}

```
