---
title: "Environment Setup"
editUrl: true
head: []
template: "doc"
sidebar: {"order":3,"hidden":false,"attrs":{}}
pagefind: true
draft: false
---

Set up your development environment for building Arete stacks.

:::tip[Just want to use an existing stack?]
If you're consuming data from a deployed stack, see [Using Stacks → Installation](/using-stacks/installation) instead.
:::

---

## Prerequisites

- **Rust** 1.70+ ([install via rustup](https://rustup.rs/))
- A code editor with Rust support (VS Code + rust-analyzer recommended)

---

## CLI

The Arete CLI (`a4`) handles project initialization, deployment, and SDK generation.

```bash
cargo install a4-cli
```

Verify the installation:

```bash
a4 --version
```

:::note[PATH configuration]
Ensure `~/.cargo/bin` is in your PATH. Most Rust installations configure this automatically.
:::

---

## Rust Dependencies

Add the Arete crate to your stack project's `Cargo.toml`:

```toml
[dependencies]
arete = "{{VERSION}}"
serde = { version = "1.0", features = ["derive"] }
```

This gives you access to:

- `#[arete]` — The main macro for defining stacks
- `#[entity]`, `#[map]`, `#[aggregate]` — Field-level attributes
- `Stream` derive macro — Generates streaming infrastructure

---

## Project Initialization

Create a new stack project:

```bash
cargo new my-stack --lib
cd my-stack
```

Initialize Arete configuration:

```bash
a4 init
```

This creates `arete.toml` and a `.arete/` directory for generated stack files.

**arete.toml:**

```toml
[project]
name = "my-stack"

[sdk]
output_dir = "./generated"
```

Validate your setup:

```bash
a4 config validate
```

---

## Environment Variables

| Variable        | Description           | Default        |
| --------------- | --------------------- | -------------- |
| `ARETE_API_URL` | Override API endpoint | Production API |

---

## Next Steps

- [Stack Definitions](/building-stacks/stack-definitions) — Understand the declarative model
- [Your First Stack](/building-stacks/your-first-stack) — Build an end-to-end streaming app
- [Macros Reference](/building-stacks/rust-dsl/macros) — Complete attribute documentation

---

## Troubleshooting

| Issue                   | Solution                                        |
| ----------------------- | ----------------------------------------------- |
| `a4: command not found` | Add `~/.cargo/bin` to your PATH                 |
| `cargo build` fails     | Ensure `arete = "{{VERSION}}"` is in Cargo.toml |
| `a4 init` fails         | Check you're in a valid Cargo project           |
