> ## Documentation Index
> Fetch the complete documentation index at: https://bytebeam.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting up Bytebeam ESP-RS SDK

> Learn how to set up and utilize the Bytebeam ESP-RS SDK on any ESP32 board with this comprehensive document. Get step-by-step instructions on provisioning the device, integrating the Bytebeam client into your project, and building and flashing.

This section provides step by step instructions on how to set up and start using the [﻿](https://github.com/bytebeamio/esp-bytebeam-sdk)﻿[﻿](https://github.com/bytebeamio/esp-bytebeam-sdk)[Bytebeam ESP-RS SDK](https://github.com/bytebeamio/bytebeam-esp-idf-sdk)﻿ . This SDK can be used with any ESP32 board. The only requirements are WiFi and a working internet connection.

## Provision device with device config data

**bytebeam-esp-rs** requires **device\_config.json** file in SPIFFS partition. We provide a tool for provisioning device.

```shell theme={null}
$ git clone https://github.com/bytebeamio/bytebeam-esp-rs-sdk.git
$ cd bytebeam-esp-rs-sdk/tools/provision
```

Download the device configuration JSON file from Bytebeam cloud by following the Provisioning a Device guide and place it inside **the provision** project with the name **device\_config.json**

You can use [cargo espflash](https://github.com/esp-rs/espflash) to build the project and flash it.

Connect your ESP board using USB and run the following command inside **provision** project :

```shell theme={null}
cargo espflash --release --monitor --partition-table partitions.csv
```

*NOTE: If you want to use custom partition table for your application, please replace ****partitions.csv**** file provided in provision project*

You will see a log line with "Provisioning Done" message! You can then terminate it and move on to next step.

## Let's use bytebeam-esp-rs!

Add **bytebeam-esp-rs** as a dependency in your **Cargo.toml**

```shell theme={null}
cargo add bytebeam-esp-rs
```

This will add an entry in your **Cargo.toml** like:

```none theme={null}
[dependency]
bytebeam-esp-rs = "0.1.0"
```

Now you can start using Bytebeam client in your project

```rust theme={null}
/* other imports */
use bytebeam_esp_rs::ByteBeamClient;

fn main() -> anyhow::Result<()> {
    /*...
    Setup esp for Rust
    Connect to internet and initialize SNTP/NTP to sync time
    ...*/

    let bytebeam_client = ByteBeamClient::init()?;

    // use bytebeam_client here!
}

```

Check out <a href="https://github.com/bytebeamio/bytebeam-esp-rs-sdk/tree/main/examples" target="_blank">examples</a> for more details.

## Build and Flash

Run this command within your application project :

```shell theme={null}
cargo espflash --release --monitor --partition-table partitions.csv
```

*NOTE: Use the same ****partitions.csv**** that you used for provisioning! If you didn't use a custom table, you can download and use *<a href="https://github.com/bytebeamio/bytebeam-esp-rs-sdk/blob/main/tools/provision/partitions.csv" target="_blank">*partitions.csv*</a>*  from the provision app!*
