> ## 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.

# Introduction

> Combine the powers of Go and TypeScript. Towards ergonomic backends.

Forst is a programming language that brings TypeScript's type safety and developer experience to Go.

## Motivation

Our primary goal is to help you move away from TypeScript on the backend:

* Generate **instantly re-usable TypeScript types** from backend endpoints – enabling full-stack development without build steps.
* **Strong static typing with aggressive inference and smart narrowing** – so you move fast while staying safe.
* Data types that **automatically validate deeply nested input data** – to keep untrusted user input out of your application logic.

Constraints on the type replace scattered validation checks at the boundary:

<Tabs>
  <Tab title="Forst">
    ```ft theme={"languages":{"custom":["/languages/forst.json"]}}
    type PlaceOrderInput = {
    	stockKeepingUnit: String.Min(1).Max(64),
    	quantity:         Int.Min(1).Max(99),
    }

    func placeOrder(in: PlaceOrderInput) {
    	// in is already validated; business logic starts here
    }
    ```
  </Tab>

  <Tab title="Generated Go">
    ```go theme={"languages":{"custom":["/languages/forst.json"]}}
    // forst build
    type PlaceOrderInput struct {
    	stockKeepingUnit string
    	quantity         int
    }

    func placeOrder(in PlaceOrderInput) {
    	if len(in.stockKeepingUnit) < 1 || len(in.stockKeepingUnit) > 64 { ... }
    	if in.quantity < 1 || in.quantity > 99 { ... }
    	// business logic starts here
    }
    ```
  </Tab>

  <Tab title="Generated TypeScript">
    ```typescript theme={"languages":{"custom":["/languages/forst.json"]}}
    // forst generate → generated/types.d.ts
    export interface PlaceOrderInput {
      quantity: number;
      stockKeepingUnit: string;
    }
    ```
  </Tab>
</Tabs>

<Info>
  Forst is actively developed. Some features (Result types, Go import loading, sidecar) are **experimental**. See the [roadmap](/resources/roadmap) for current status.
</Info>

## How it fits your stack

Forst compiles `.ft` sources to Go, and optionally emits TypeScript types for clients:

```mermaid theme={"languages":{"custom":["/languages/forst.json"]}}
flowchart LR
  ft[".ft sources"]
  goOut["Generated Go"]
  deploy["go build / deploy"]
  dts["generated/types.d.ts"]
  clients["API clients"]

  ft --> goOut --> deploy
  ft -.-> dts -.-> clients
```

Run `forst generate` when clients need TypeScript types from the same source.

## Start here

<CardGroup cols={2}>
  <Card title="Why Forst?" icon="circle-question" href="/why">
    Design priorities and what Forst omits.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Install, write your first `.ft` file, run it.
  </Card>

  <Card title="Language overview" icon="book" href="/language/overview">
    Aligned with Go, structural typing, explicit control flow.
  </Card>

  <Card title="Validated shapes" icon="table-columns" href="/language/shapes-and-constraints">
    Types as schemas with built-in constraints.
  </Card>

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

## Examples and packages

* **Compiler examples:** [github.com/forst-lang/forst/tree/main/examples/in](https://github.com/forst-lang/forst/tree/main/examples/in)
* **npm compiler:** [`@forst/cli`](https://www.npmjs.com/package/@forst/cli)
* **Gradual adoption:** [`@forst/sidecar`](https://www.npmjs.com/package/@forst/sidecar), for invoking Forst from Node during migration

For client type generation, see [Generate client types](/interop/node/generate-types).
