# Creating a Store

A store is how ArchitectureKit reads from and writes to EventSourcingDB. Reading and writing events are methods of the store, such as `execute`, `load`, `read`, and those that run projections.

Import the crate, create an EventSourcingDB client, and create a store by providing the client and the source to use for all events you write:

```rust
use architecturekit::{Store, eventsourcingdb::Client};

// ...

let base_url = "http://localhost:3000".parse()?;
let api_token = "secret";

let client = Client::new(base_url, api_token);
let store = Store::builder(client, "https://library.eventsourcingdb.io").build();
```

`Store::builder` returns a `StoreBuilder`, whose `build` method returns a `Store`, which reads and writes the events of all commands. **ArchitectureKit brings the client SDK along as `architecturekit::eventsourcingdb`**, so that its version always fits the one of the kit: a new major version of the client SDK comes with a new major version of the kit. For details on the client, see the **[client SDK for Rust](/docs/eventsourcingdb/sdks/rust)**.

## Choosing the Source

The second argument of `Store::builder` is the source for all events you write. Every event in EventSourcingDB has one, and it identifies the system that produced the event, such as `https://library.eventsourcingdb.io`. It must be a URI reference, such as a URL or a tag URI, and it does not affect how events are processed (see **[Sources](/docs/eventsourcingdb/sources)**).

## Configuring the Store

The builder has methods that configure the store before `build` creates it, so they can not change a store that is in use. There are these methods:

- `conflict_retries` has `execute` decide again on a conflict, up to the given number of times (see **[Guarding Against Concurrent Changes](/docs/architecturekit/rust/using-preconditions#guarding-against-concurrent-changes)**).
- `state_cache` keeps the states of the most recently used subjects in memory, up to the given number, where `0` keeps none (see **[Caching States](/docs/architecturekit/rust/caching-states)**).
- `reconnect_delays` sets how long running projections wait before they read again after reading failed or the stream ended (see **[Running Projections](/docs/architecturekit/rust/projections#running-projections)**).
- `reconnect_observer` calls a function every time a running projection is about to wait before reading again, for example to log it (see **[Running Projections](/docs/architecturekit/rust/projections#running-projections)**).
- `signature_verification` checks the signature of every event the store reads, besides its hash (see **[Verifying Events](/docs/architecturekit/rust/verifying-events)**).
- `without_hash_verification` turns off checking the hash of every event the store reads, which the store does unless told otherwise (see **[Verifying Events](/docs/architecturekit/rust/verifying-events)**).

*Note that `without_hash_verification` can not be combined with `signature_verification`, since checking a signature includes checking the hash, so `build` panics if it gets both.*
