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

# Quickstart

> Install Forst, write a validated handler, and run it in five minutes.

Get from zero to a running Forst program with validated input.

## 1. Install the compiler

Install via your package manager:

<Tabs>
  <Tab title="npm">
    ```bash theme={"languages":{"custom":["/languages/forst.json"]}}
    npm install -D @forst/cli
    npx forst version
    ```

    The wrapper downloads the matching native binary on first use. See [Installation](/docs/installation) for CI and offline setups.
  </Tab>

  <Tab title="bun">
    ```bash theme={"languages":{"custom":["/languages/forst.json"]}}
    bun add -d @forst/cli
    bunx forst version
    ```

    The wrapper downloads the matching native binary on first use. See [Installation](/docs/installation) for CI and offline setups.
  </Tab>

  <Tab title="pnpm">
    ```bash theme={"languages":{"custom":["/languages/forst.json"]}}
    pnpm add -D @forst/cli
    pnpm exec forst version
    ```

    The wrapper downloads the matching native binary on first use. See [Installation](/docs/installation) for CI and offline setups.
  </Tab>

  <Tab title="Native binary">
    Download the latest release for your platform from [GitHub Releases](https://github.com/forst-lang/forst/releases), add it to your `PATH`, then:

    ```bash theme={"languages":{"custom":["/languages/forst.json"]}}
    forst version
    ```
  </Tab>
</Tabs>

## 2. Create your first file

Create `hello.ft`:

<HelloFt />

## 3. Run it

Compile, build, and run the file:

```bash theme={"languages":{"custom":["/languages/forst.json"]}}
npx forst run hello.ft
```

Forst transpiles to Go, builds, and runs the program. You should see `Hello, World!` on stdout.

## 4. Add validated input

Replace the body of `hello.ft` with a handler that only accepts well-formed orders. Constraints live on the type. Invalid calls fail at compile time and runtime checks are emitted automatically.

<Tabs>
  <Tab title="Forst">
    ```ft theme={"languages":{"custom":["/languages/forst.json"]}}
    package main

    type PlaceOrderInput = {
    	stockKeepingUnit: String.Min(1).Max(64),
    	quantity:         Int.Min(1).Max(99),
    }

    func placeOrder(in: PlaceOrderInput) {
    	println("Order placed:", in.stockKeepingUnit, in.quantity)
    }

    func main() {
    	placeOrder({
    		stockKeepingUnit: "ITEM-1",
    		quantity:         2,
    	})
    }
    ```
  </Tab>

  <Tab title="Generated Go">
    ```go theme={"languages":{"custom":["/languages/forst.json"]}}
    // forst build
    package main

    type PlaceOrderInput struct {
    	stockKeepingUnit string
    	quantity         int
    }

    func main() {
    	placeOrder(PlaceOrderInput{
    		stockKeepingUnit: "ITEM-1",
    		quantity:         2,
    	})
    }

    func placeOrder(in PlaceOrderInput) {
    	println("Order placed:", in.stockKeepingUnit, in.quantity)
    }
    ```
  </Tab>
</Tabs>

Run again:

```bash theme={"languages":{"custom":["/languages/forst.json"]}}
npx forst run hello.ft
```

Try changing `quantity` to `0` or `100`. The typechecker rejects out of range values before you ship.

## 5. Summary

| Manual Go                                | Forst                                            |
| ---------------------------------------- | ------------------------------------------------ |
| Struct + manual `if len(sku) < 1` checks | Constraints on the type itself                   |
| Separate Zod/Yup schema for TS clients   | `forst generate` emits matching `.d.ts`          |
| Two sources of truth for API shapes      | One `.ft` definition, Go + TS from the same tree |

## Next steps

<CardGroup cols={2}>
  <Card title="Shapes and constraints" icon="table-columns" href="/docs/language/shapes-and-constraints">
    Structural typing and runtime validation.
  </Card>

  <Card title="Generate client types" icon="https://mintcdn.com/forst/r5GJChnfkgCSJa-b/icons/typescript.svg?fit=max&auto=format&n=r5GJChnfkgCSJa-b&q=85&s=8a8c0cd7b4bf60c264d51f66d0f52e91" href="/docs/interop/node/generate-types" width="512" height="512" data-path="icons/typescript.svg">
    Emit `generated/types.d.ts` for your frontend or BFF.
  </Card>

  <Card title="CLI reference" icon="terminal" href="/docs/workflow/cli">
    `run`, `build`, `generate`, `dev`, and more.
  </Card>

  <Card title="Go interop" icon="https://mintcdn.com/forst/r5GJChnfkgCSJa-b/icons/golang.svg?fit=max&auto=format&n=r5GJChnfkgCSJa-b&q=85&s=e676ee132c42dfabaf125e76fe733c20" href="/docs/interop/go" width="205" height="77" data-path="icons/golang.svg">
    Import Go packages and mix `.ft` with `.go`.
  </Card>
</CardGroup>
