# Create the Project

## Create a Mercury Account and get your Token

To do anything with Mercury you first need to create an account. This can be done from [Mercury's app](https://main.mercurydata.app/signup). Once you're done, make sure to save somewhere your API token, unique to your account and needed to access your Zephir program.&#x20;

The token can always be found on the [dashboard's homepage](https://main.mercurydata.app/) under the *Active Subscriptions* section and is renewed every 7 days.&#x20;

For simplicity, you can load your mercury API token as a variable in your current shell. For example:

```
export MERCURY_JWT="your_api_token_here"
```

## Installing the Mercury CLI

The Mercury CLI, which currently supports only Zephyr functionalities, is an essential tool for interacting with Mercury's cloud execution environment. While it's technically possible to use the API, we recommend using the CLI for easier development.

To install the CLI simply run:

```bash
cargo install mercury-cli
```

This should install the CLI, you can verify with

```bash
mercury-cli --version
```

## Setting up the project <a href="#setting-up-the-project" id="setting-up-the-project"></a>

The `mercury-cli` takes care of setting up the project for us:

```bash
mercury-cli new-project --jwt value --name zephyr-hello-world
```

This will create the starting point for our Zephyr program: set up the `Cargo.toml`, add some compiler flags, a starting point in the `lib.rs` and create the `zephyr.toml`.

{% hint style="warning" %}
Set the --jwt value to whatever (soon to be fixed). As of now we noted that the command will return an error on the terminal: it should be fine, just check if the crate was crated in your directory.&#x20;
{% endhint %}

## Zephyr.toml

{% hint style="warning" %}
Every time you deploy your zephyr program, the zephyr toml gives the instructions to the backend of creating the tables it defines. In case these tables exist already they will be dropped. As a result, make sure that if you have already deployed and have ingested data and need to make only an update to the code logic, remove the tables from your zephyr.toml and place them in a copy of it.
{% endhint %}

As the last step for setting up our Zephyr program, we need to create and define a `zephyr.toml` configuration file. That is needed if your program will read from or write to some tables that you define.

This configuration mainly defines the tables your program will read from/write to and their structure. A more detailed explanation about `zephyr.toml` files can be found at [Understanding Zephyr.toml And Database Interactions](https://docs.mercurydata.app/zephyr-full-customization/learn/understanding-zephyr.toml-and-database-interactions), but here's an example configuration taken from the quickstart.&#x20;

```
name = "zephyr-hello-world"

[[tables]]
name = "test"

[[tables.columns]]
name = "hello"
col_type = "BYTEA"
```

The above file means that we are creating a table `"test"` with `"hello"` as the only column and declaring that we may write to/read from it during the execution of our Zephyr program.

{% hint style="info" %}
Note that `col_type = "BYTEA"` means that we can only store bytes in the database. Currently, this is the only supported data type (even though it will support built-in types in the future). That said, we recommend writing XDR structures to the database to ease decoding the client side with the existing Stellar tooling.
{% endhint %}

## Cargo.toml

It's temporatily needed to manually git-source the zephyr-sdk dependency:

```
[dependencies]
zephyr-sdk = { git="https://github.com/xycloo/rs-zephyr-toolkit" }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mercurydata.app/zephyr-full-customization/learn/get-started-set-up-and-manage-the-project/create-the-project.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
