Skip to main content
forst generate emits TypeScript declarations from the same definitions the compiler validates, so Node clients import shapes that match the server. To call these functions at runtime, see Call Forst from Node. To call legacy JavaScript from compiled Forst, see Call JavaScript from Forst.

Manual types in TypeScript

Without generated types, every API change means updating TS by hand:
TypeScript cannot express quantity must be 1 to 99 unless you add Zod, Effect.Schema, or similar. That is another schema to maintain.

Types from .ft

Define the shape once in Forst:
Run:
Output layout (typical):
Import in your frontend or BFF:

Discovery with ftconfig.json

forst generate and forst dev share include/exclude rules from ftconfig.json:
Pass -config explicitly or let the CLI search upward from your target directory.

End-to-end example

The tictactoe example in the repository demonstrates merged-package generate:
See examples/in/tictactoe/ and examples/client-integration/.

Caveats

Structure only in TypeScript

Generated .d.ts files reflect field names and types. They do not carry runtime rules like String.Min(1) or Int.Max(99). Add client validation yourself, or call the Forst server which validates at the boundary.

Provider gated exports

Functions that need wired Providers(f) are excluded from TypeScript emit. The invoke wire stays payload only. See Providers § Caveats.

Nominal error tags

TypeScript _tag export for nominal errors is still maturing. Treat error payloads as evolving. See Errors and Result § Caveats.

Call Forst from Node

Invoke generated functions — dev server or built-in HTTP server.

Call JavaScript from Forst

Call legacy .ts/.js from compiled Forst (import node).

Node overview

Pick your migration path.

Installation

Install @forst/cli in your project.