Sidebar

Displays the mobile sidebar.

Search the docs

Search the docs

charter
charter
What charter is
See it running
Where to go
What an app made with charter looks like
Getting started
Getting started
Working on it
Before a push
Shipping it
Tools
Every command
The commands, and what each one proves
The commands, and what each one proves
What is checked, and when you find out
What no compiler checks
create
dev
add
check
test
deploy
pack
run
The rest
An app's layout
An app's layout
What the Worker is bound to
main.go
What is generated
What is never in git
Pages
Pages
With the commands
The tree
A page declares what it needs
A region that changes by itself
The page being shown
A fragment opened as a page
What a page calls
Links
A link shows the next page with no page load
Which pages search engines get
A page that is the same for every reader
The head
The API
The API
With the commands
An operation
Who may call
Limits
SDKs
MCP
The live feed
The live feed
With the commands
Writing
Three ways out, one feed
A page's stream holds no Go
Resuming
The database
The database
With the commands
Changing it
Queries
Every statement is checked
One definition
Seeding
A deployed database
Reads near the reader
By hand
Signing in, and who may do what
Signing in, and who may do what
With the commands
One caller
Saying what is needed
Roles
The first admin, and inviting people
Signing in
Another device
An address to get back in by
Testing it
The clients
What is left to you
Languages and search engines
Languages and search engines
With the commands
Languages
Search engines
Agents
Screens and themes
Screens and themes
With the commands
The interface is gsxui's
Screens
The layout
What a page is made of
Themes
The editor, in your app
A style
While developing
Light and dark
What is checked, and what is not
Docs
Docs
With the commands
Groups, and the order
What you write, and what charter writes
Links are checked
Showing them
What comes with them
What the pages have
Code taken from a real file
Tests
Tests
A page, as plain Go
The whole app, on a real Worker
A page, in a real browser
What to test, and what not to
The API, through its own SDK
Where a test runs
A test leaves the Worker as it found it
Secrets a test needs
What else charter test does
Deploying
Deploying
Two Workers
With the commands
The plan
Nothing of your account in the repository
Credentials
Secrets
Resources
Taking an app away
Your own domain
Email
After a deploy
Environments
Everything Cloudflare gives a Worker
The admin screen
The admin screen
The pages
The app's own facts
From a program
What it does not do
Watching a deployed Worker
Watching a deployed Worker
Is it well?
Three numbers
Cloudflare's limits
Under load
A first hit
Every data centre, by country
What happened?
A failure has a reference
Memory
What charter leaves to Cloudflare
Upgrading
Upgrading
0.82
0.81
0.80
0.79
0.78
0.77
0.76
0.75
0.74
0.73
0.72
0.71
0.69
0.65
0.64
A binding, a variable, a secret's name
A scope
Screens
0.63
When upgrade stops
For your coding agent
For your coding agent
The plugins
In an app made with charter
Anywhere else
One set of commands
What an agent can ask
What a language model reads
What the Worker is bound to
What the Worker is bound to

The API

The API is written once, as a contract in Go (api/contract.go). Its OpenAPI and AsyncAPI documents, its MCP tools and its SDKs come from that.

With the commands

WhenCommandWhat it does for your API
You change api/contract.godev, runningit compiles, and the running Worker serves the operation
Before a pushcheck --fixwrites fern/openapi.json and fern/asyncapi.json from the Go types; check fails while the committed ones are behind
Before a pushtestthe API called through its own generated Go SDK, on a real Worker
Before a releasepack --provea client in each language, written by Fern from the spec, proven by calling the Worker
Nothingthe docs' page of the API is written from the spec: the example's

Checked before the app runs: what an operation takes and answers (Huma writes the spec from the Go types, never the other way); the scopes it needs (values); its limit, whose binding, calls and seconds are wrangler.jsonc's, said once.

Not checked until it runs: what a handler does with a request. And nothing checks that a change is safe for clients already out there: the API's row is the table's row, so a column you rename is a field renamed for every client. check shows the spec changed; whether that is acceptable is yours to decide.

An operation

{Method: http.MethodPost, Path: "/api/notes", OperationID: "createNote", Register: func(api huma.API) {
	huma.Register(api, huma.Operation{
		OperationID: "createNote", Method: http.MethodPost, Path: "/api/notes",
		Summary:  "Create a note", Tags: []string{"notes"},
		Security: charter.Needs(Write),
	}, env.create)
}},

charter check --fix writes fern/openapi.json and fern/asyncapi.json from the contract; charter check fails when they are behind it.

This site has no API of its own. The example's is live: every operation of it, written from its contract, its OpenAPI document, and its notes.

An app's docs get that page without anyone writing it: what charter writes.

Who may call

Reading is public. Writing needs a scope, which a bearer token, Cloudflare Access or an OpenID Connect issuer gives. An unset secret trusts no one.

Limits

An operation says how often one caller may call it. The Worker's Rate Limiting binding enforces it, and charter check holds wrangler.jsonc to the contract.

SDKs

go tool charter pack -prove

Fern generates a client for each language charter.toml names. Each is proved in its own language, and then against the Worker itself: the program in test/sdk/<language>/ is refused and let through as the contract says (who may do what). It all runs in containers, so nothing of Rust or Python is on your machine. The Go client is committed in sdk/go (charter pack -publish), and this site's own tests use it as the client.

MCP

Every operation is also an MCP tool, at /api/mcp.