@forst/cli or a native binary (Installation), then compile a file:
forst CLI transpiles .ft sources, runs programs, generates the TypeScript client package, and starts development services.
Node apps that import @forst/gen also need the postinstall generate script. See
Installation § Generated TypeScript client.
Default compile and run
With no subcommand,forst compiles a single .ft file. Given hello.ft:
- Forst
- Generated Go
Common flags (see
forst --help):
forst generate
Emit a TypeScript client package from Forst sources:
forst dev. Import from @forst/gen/<package> after generate (and after postinstall on a fresh machine).
Each directory holds one Forst package name, matching Go. You may put many .ft files in that directory when they share the same package line. files.include globs select which .ft files are discovered. They do not allow multiple package names in one folder or the same package name in sibling folders.
--allow-stem-package-mismatch
By default, forst generate expects the file stem or parent folder name to match the package line. Use this flag when legacy files break that rule and you cannot rename or move them yet.
Normal colocation does not need the flag. Put files under a folder named for the package (for example
auth/login.ft with package auth). See Call Forst over HTTP § Colocate Forst with TypeScript.
--list (with optional --json) prints a machine-readable manifest of packages and exported functions without writing client output. Use it for IDE plugins, codegen pipelines, or CI introspection.
--watch regenerates when .ft files change. Use it when the dev server runs separately, or rely on regenerate-on-save from Dev server.
Output modes
Ephemeral output is removed by
forst clean and restored by the next generate. Committed mode is a normal workspace package you check in.
See Plugins to configure JSON Schema, RPC contracts, file routes, or custom generators during forst generate. Plugins are work in progress—see that page for versioning and coverage limits.
Generate configuration
Set these under"generate" in ftconfig.json:
Each plugin entry:
Optional Go sources (generate.go)
By default, forst generate writes only the TypeScript client (postinstall safe). Go sources run when generate.go.entry and generate.go.out are set in ftconfig.json, or when you override on the CLI with matching flag names.
TS client + Go sources (default):
@forst/gen and transpiled .go beside the output path.
Go sources only:
go build or review.
CLI flags mirror ftconfig fields (--go-entry, --go-out, --go-root, --skip-client). Unset flags fall back to ftconfig.json.
Or configure in ftconfig.json:
forst build for production linked programs.
Native program build (forst build)
Build a linked program binary and manifest.json for slim container images (similar to go build -o bin/main).
Local build (writes under .forst/, removed by forst clean):
-o is the output directory. Forst writes manifest.json and bin/<entryStem> directly inside it. No extra subfolder is required.
Output layout (entry ./app/main.ft → bin/main):
server.embedded: true in ftconfig.json. At runtime, run the linked binary with FORST_ROOT set to your project root (read binary from manifest.json):
How the binary fits with Node
Whenbridge.hostMode is enabled, the built binary can run Forst and talk to Node in one of two layouts.
All-in-one (default): One process runs your Forst entry point, starts the small HTTP server that @forst/gen uses to call Forst functions, and starts your Node app (for example remix-serve) as a child process:
FORST_SKIP_NODE_HOST=1): Use the same binary when Node already runs somewhere else (another container, systemd unit, or local dev process). Set FORST_SKIP_NODE_HOST=1 so the binary runs embedded invoke and your entry point but does not spawn the Node host. Your Node app runs on its own and connects using @forst/gen and the URL in .forst/invoke.ready.
forst build does not wait for the Node HTTP app to finish starting.
manifest.json (build output)
manifest.json sits beside the linked binary under your -o directory. Use these fields to verify how the program was built and which executable to run in production.
Older manifests may show
"kind": "invoke" and "binary": "bin/forst-invoke".
Task pages link here instead of repeating this table.
forst dev
Start the HTTP development server for function discovery, invocation, and types:
forst lsp
Start the language server (JSON-RPC over HTTP on POST /):
forst fmt
Format .ft sources:
forst test
Run Forst tests (discovery and emit bridge):
forst dump
Debug compiler phases (lexer, parser, typechecker, transformer):
forst clean
Remove compiler-generated artifacts under .forst/ (run sandboxes, the generated client, native build output under .forst/build/, test emit dirs, executor temp modules, nodert sockets, invoke ready markers). User config such as .forst-gomod/ is not removed.
forst clean, run forst generate (or rely on postinstall) to restore @forst/gen.
forst version
Print compiler version info:
npm wrapper
When installed via@forst/cli:
FORST_BINARY to skip download in CI.
Related
Installation
npm, binary, Docker, and the generated client setup.
Generate a TypeScript client
@forst/gen imports and layout.Dev server
HTTP contract and regenerate on save.
Quickstart
First commands in context.
Editor workflow
LSP integration in VS Code.