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

# Rust Quick Start

> Get up and running with BoxLite Rust crate in 5 minutes.

## Installation

Add BoxLite to your `Cargo.toml`:

```toml theme={null}
[dependencies]
boxlite = { git = "https://github.com/boxlite-ai/boxlite" }
tokio = { version = "1", features = ["full"] }
futures = "0.3"
```

## Basic Execution

<Steps>
  <Step title="Create a file src/main.rs">
    ```rust theme={null}
    use boxlite::{BoxliteRuntime, BoxOptions, BoxCommand, RootfsSpec};
    use futures::StreamExt;

    #[tokio::main]
    async fn main() -> Result<(), Box<dyn std::error::Error>> {
        // Create runtime
        let runtime = BoxliteRuntime::default_runtime();

        // Create box
        let options = BoxOptions {
            rootfs: RootfsSpec::Image("alpine:latest".into()),
            ..Default::default()
        };
        let litebox = runtime.create(options, None).await?;

        // Execute command
        let mut execution = litebox
            .exec(BoxCommand::new("echo").arg("Hello from BoxLite!"))
            .await?;

        // Stream stdout
        let mut stdout = execution.stdout().unwrap();
        while let Some(line) = stdout.next().await {
            println!("{}", line);
        }

        Ok(())
    }
    ```
  </Step>

  <Step title="Run it">
    ```bash theme={null}
    cargo run
    ```
  </Step>
</Steps>

## From Source (Development)

For contributing or local development:

<Steps>
  <Step title="Clone the repository">
    ```bash theme={null}
    git clone https://github.com/boxlite-ai/boxlite.git
    cd boxlite
    ```
  </Step>

  <Step title="Initialize submodules">
    <Warning>
      This step is critical! The build will fail without submodules.
    </Warning>

    ```bash theme={null}
    git submodule update --init --recursive
    ```
  </Step>

  <Step title="Install platform dependencies">
    ```bash theme={null}
    make setup
    ```
  </Step>

  <Step title="Build and test">
    ```bash theme={null}
    # Build
    cargo build

    # Run tests
    cargo test
    ```
  </Step>
</Steps>

See [CONTRIBUTING.md](https://github.com/boxlite-ai/boxlite/blob/main/CONTRIBUTING.md) for detailed build instructions.

## Next Steps

<CardGroup cols={2}>
  <Card title="Core concepts" icon="lightbulb" href="/getting-started/core-concepts">
    Understand the different box types, lifecycle, images, and resource configuration.
  </Card>

  <Card title="Architecture Documentation" icon="sitemap" href="/architecture/index">
    Understand how BoxLite works -- Core components (Runtime, LiteBox, VMM, Portal), Image management and rootfs preparation, Host-guest communication protocol.
  </Card>

  <Card title="Rust API Reference" icon="book" href="/reference/rust/index">
    Complete Rust API reference documentation.
  </Card>
</CardGroup>
