Getting started/Installation
Installation
Install the fletch CLI, create a project, run the dev server, and build a static binary.
On this page
Requirements
- Go 1.27
CGO_ENABLED=0across every core module- No Node on
PATHon the default path (CI verifies the default toolchain in ano Node on PATHjob)
Install the CLI
Fletch is pre-release (0.1.0-dev), and the module’s go.mod still has local replace directives, so install from source:
git clone https://github.com/fletchhq/fletch
cd fletch
GOWORK=off CGO_ENABLED=0 go install ./cmd/fletch
Make sure $(go env GOPATH)/bin is on your PATH, then verify the binary:
fletch version
Pre-tag builds print 0.1.0-dev.
Create a New Project
Scaffold an app with fletch new:
fletch new shop
cd shop
fletch new flags
| Flag | Purpose |
|---|---|
--dir |
Target directory for the generated project |
--module |
Go module path written to go.mod |
--fletch-path |
Point go.mod at a local Fletch checkout instead of the module proxy |
--single-config |
Generate a single YAML config file instead of split config/*.yaml files |
The starter app includes a working modules/home vertical slice, SQLite migrations and Nock schema, Crest views, resources/css/app.css and resources/js/app.js, module and app tests, and agent context files (AGENTS.md, CLAUDE.md, skills, and .mcp.json). See Project Structure for the complete layout.
Run the Dev Server
Start the development loop from the project root:
fletch dev
By default, the app listens on http://127.0.0.1:3000 and the dev dashboard listens on http://127.0.0.1:4000.
fletch dev flags
| Flag | Default | Purpose |
|---|---|---|
--addr |
127.0.0.1:3000 |
Address for the application server |
--dashboard-addr |
127.0.0.1:4000 |
Address for the separate dev dashboard |
--no-dashboard |
false |
Disable the dev dashboard |
--https |
false |
Serve over local HTTPS |
--store-dir |
project default | Directory for local dev state |
--tidy |
false |
Run go mod tidy during startup |
How the dev loop works
- Polling watcher: Monitors Go files,
.cresttemplates, and files underresources/. - Proxy swap:
fletch devfronts your app with a local reverse proxy and swaps to the newly compiled binary once a rebuild succeeds, keeping your browser port steady. - CSS swap: Edits to stylesheets swap in place without a full page reload.
- Error overlay: Go and Crest compile errors render in an in-browser overlay instead of dropping the connection.
- Dev dashboard: Runs on its own port (
127.0.0.1:4000by default) so inspection endpoints stay off the application port.
Make a first edit
Open the starter home view and its paired Go file. After editing a .crest template, run fletch gen (or let fletch dev regenerate it) to update modules/home/views/index_crest.go.
<layouts.App title={i.Name}>
<slot:head><meta name="description" content={"The home page of " + i.Name}></slot:head>
<section class="home">
<h1>Welcome to {i.Name}</h1>
<p>Edit modules/home/views/index.crest, then run fletch gen.</p>
{if len(i.Notes) > 0}
<h2>Notes <components.Badge label={i.NoteCount()} /></h2>
<ul>
{for _, n := range i.Notes key n.ID}
<li>{n.Body}</li>
{/for}
</ul>
{/if}
</section>
</layouts.App>package views
type Note struct {
ID int64
Body string
}
type Index struct {
Name string
Notes []Note
}
func (i Index) NoteCount() string {
return strconv.Itoa(len(i.Notes))
}Run Tests and Checks
Run the standard Go test suite along with fletch check:
go test ./...
fletch check
go test ./... runs unit tests inside each module (modules/home/module_test.go) and integration tests in tests/app_test.go.
fletch check statically verifies the app against six diagnostic rules:
W0510: module boundary violationsW0511: table ownership violationsW0512: unmounted modulesW0513: schema drift againstdatabase/migrations/snapshot.jsonW0514: staleopenapi.jsonW0515: invalidschema.godefinitions
Build a Static Binary
Compile templates, bundle assets, and produce a standalone binary with fletch build:
fletch build
Cross-compile for a Linux server from macOS or Windows without a C cross-compiler:
fletch build --os linux --arch amd64 -o bin/shop
fletch build flags
| Flag | Purpose |
|---|---|
-o, --out |
Output path for the compiled binary |
--os |
Target GOOS (for example linux, darwin, windows) |
--arch |
Target GOARCH (for example amd64, arm64) |
--ldflags |
Extra linker flags passed to go build |
--tags |
Additional Go build tags |
--skip-assets |
Skip building frontend assets |
--json |
Emit machine-readable JSON output |
Upgrade Scaffold Files
When you update the fletch CLI, run fletch upgrade to pull scaffold changes into an existing app. Fletch stores base file snapshots in .fletch/scaffold.json and runs a 3-way merge so untouched starter files update cleanly while your edits stay intact.
Preview changes first, then apply:
fletch upgrade --dry-run
fletch upgrade
fletch upgrade flags
| Flag | Purpose |
|---|---|
--dry-run |
Show planned updates and conflicts without modifying files |
--json |
Print upgrade results as JSON |
--to |
Target framework version or ref |
--fletch-path |
Point upgrade resolution at a local Fletch checkout |
--no-tidy |
Skip go mod tidy |
--skip-gen |
Skip fletch gen after merging |
--skip-ax |
Skip regenerating agent/AX files |
--skip-check |
Skip running fletch check at the end |
--write-conflicts |
Write conflict markers directly into conflicted files |
--adopt |
Record .fletch/scaffold.json baseline for an existing project |
Offline Documentation
The fletch binary embeds framework documentation so you can browse and search it without network access:
fletch docs list
fletch docs show <topic>
fletch docs search "quiver"
fletch docs path
fletch docs listprints available topics.fletch docs show <topic>prints a topic page to stdout.fletch docs search <query>searches across embedded docs.fletch docs pathprints the local docs directory path.