Skip to main content
Use this page when generating or editing Forst (.ft) backend code. It is a usage cheat sheet, not a language spec. Fetch deeper pages only when you need one topic.

Mintlify AI endpoints

This site is Mintlify-hosted. Fetch these directly (no HTML): Also available at /.well-known/llms.txt and /.well-known/llms-full.txt. Mintlify sends Link and X-Llms-Txt headers on every page so agents can discover the index. See Mintlify llms.txt docs.

What Forst is

Go-interoperable backend language. Source: .ft files. Output: Go you build with go build. Structural types carry validation constraints. TypeScript types come from the same tree via forst generate.

Install and run

Minimal install and compile commands:
CI: set FORST_BINARY to a preinstalled compiler path.

Typical layout

Common project tree for a Forst backend:
Same-package .ft files merge when you pass -root. Go files and Forst files can live in one module.

Syntax you must use

Constraints reference (common)

Chain with dots. Same names work on type fields and in ensure.

CLI quick reference

Flags: -root merges same-package .ft files; -export-struct-fields emits exported struct fields with json tags for wire serialization; -log-level trace|debug|info|warn|error.

When writing code

  1. Put validation on types at the HTTP boundary. Avoid manual if len(s) < 1 when a constraint fits.
  2. Keep business failures as nominal error types or Result, not string errors.
  3. Thread request payloads through parameters. Use use / with for loggers, clocks, repos (not context.Context values).
  4. Import real Go packages when needed (fmt, your module). Generated Go must compile with go build.
  5. After edits, run npx forst run or npx forst test on the touched package.

Do not invent

Read more (single topic)