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

# Quickstart

> Run the Kimia protocol end-to-end on devnet in under 10 minutes.

This quickstart walks through cloning the repo, building the programs, launching the
frontend against devnet, and running the end-to-end script that touches every program.

## Prerequisites

<Steps>
  <Step title="Install toolchain">
    You need Rust, the Solana CLI, and Anchor.

    ```bash theme={null}
    # Rust
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

    # Solana
    sh -c "$(curl -sSfL https://release.solana.com/stable/install)"

    # Anchor
    cargo install --git https://github.com/coral-xyz/anchor avm --locked --force
    avm install latest && avm use latest
    ```
  </Step>

  <Step title="Fund a devnet wallet">
    ```bash theme={null}
    solana config set --url devnet
    solana-keygen new --outfile ~/.config/solana/id.json
    solana airdrop 2
    ```
  </Step>
</Steps>

## Clone and build

```bash theme={null}
git clone https://github.com/kimia-protocol/kimia.git
cd kimia
```

The repo has three workspaces:

```
kimia/
├── Perp-engine/   # kimia-perp Anchor program + perps-math / perps-common crates
├── Programs/      # delta-vault, intent-router, yield-amm, split-engine, kusd-mint
└── frontend/      # Next.js 16 app (app/, codama clients, wallet)
```

Build every Anchor program:

```bash theme={null}
cd Perp-engine && anchor build && cd ..
cd Programs    && anchor build && cd ..
```

## Run the devnet end-to-end

The `Programs/` workspace ships a single script that:

1. Initializes the perp market and orderbook
2. Seeds the spot pool with USDC/wSOL
3. Initializes the delta-vault, opens a hedged position
4. Creates a split-engine market (PT + YT)
5. Creates a yield-AMM pool and swaps YT for underlying

```bash theme={null}
cd Programs
npm install
npx ts-node tests/devnet-e2e.ts
```

<Tip>
  The script is idempotent, re-running it skips initialized accounts.
</Tip>

## Launch the frontend

```bash theme={null}
cd frontend
npm install
npm run setup    # builds Anchor vault + regenerates all Codama clients
npm run dev
```

Open [http://localhost:3000](http://localhost:3000), connect a wallet, pick **devnet**
in the cluster switcher, and you'll see:

| Route        | What it exposes                                                   |
| ------------ | ----------------------------------------------------------------- |
| `/`          | Perp trading, TradingView chart, orderbook, order form, positions |
| `/vaults`    | Deposit / withdraw / claim funding on the delta-vault             |
| `/earn`      | Buy PT, claim yield, redeem at maturity                           |
| `/yield-amm` | Add / remove LP, swap PT ↔ underlying                             |
| `/intent`    | Fixed-rate lock flow across the full stack                        |
| `/kusd`      | Mint / redeem kUSD, stake for yield                               |

## Regenerate clients after a program change

Every program has a Codama config that targets its IDL. After you edit Rust:

```bash theme={null}
cd frontend
npm run codama:all
```

This rewrites TypeScript clients under `app/generated/<program>/`, instructions,
accounts, and PDA helpers, all typed against `@solana/kit`.

## What next?

<CardGroup cols={2}>
  <Card title="Architecture" icon="diagram-project" href="/architecture">
    See the CPI graph between the six programs.
  </Card>

  <Card title="Program reference" icon="book" href="/programs/overview">
    Instructions, accounts, and error codes per program.
  </Card>
</CardGroup>
