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

Deploying

go tool charter deploy

That is the D1 migrations, then wrangler deploy twice: a deployed app is two Workers.

Two Workers

NameWhat it is
The Go Worker<name>-goThe app as wrangler.jsonc has it: every binding, its cron, its queue, its secrets. It has no address of its own
The Worker in front<name>A few KB of JavaScript at the app's address, with the browser's files. It answers a page that is the same for every reader from KV and hands everything else to the Go Worker

You write one wrangler.jsonc, which is what charter dev runs, as one Worker. charter deploy writes the two configurations from it each time (wrangler.go.built.json, wrangler.front.built.json, not kept in git).

Why two: a Worker that is not running where a request arrives is loaded there first, and that takes as long as it is large. Measured on 2026-11-28, a one-line answer from an 18 MiB Worker took 210 to 630 ms where it was not running and 25 ms where it was, whether or not Go was started. The Worker in front is small enough to be running anywhere in a few milliseconds, and KV is one copy for every data centre (a shared page).

  • Health, logs and secrets are the Go Worker's: that is where the app runs. run health, run logs, run secrets and run secrets:put mean it.
  • An app deployed as one Worker becomes two on its next deploy. The Worker of the app's name hands its queue and cron to the Go Worker and becomes the one in front. A secret that fnox does not have cannot be moved (Cloudflare never gives one back): deploy names it, and it has to be put again.
  • Each of an app's requests comes through the Worker in front, which gives them to fewer instances of the Go Worker than Cloudflare spreads readers over. The Go Worker keeps what its runtimes hold under a budget that follows the size of the build (watching).

With the commands

WhenCommandWhat it does
You shipdeployapplies the migrations, then deploys the Go Worker and the Worker in front with wrangler; the first time it makes what wrangler.jsonc names and writes the ids there
After ittest --deployedthe same tests, asked of the deployed Worker, which they leave as they found it
A secretrun secrets, run secrets:put NAMEwhat is declared and what the Worker has; one kept by fnox and put on the Worker
To see what is thererun resourcesthe database, KV namespace, bucket and queue the deployed Worker is bound to
To take it awayrun deletethe Worker and its secrets; its data only when you say so

Checked before it is deployed: everything check says of the code; that the deployed database gets the schema that code was checked against, before the code; that a resource is the one it was (its id), so a renamed bucket stops the deploy and does not make an empty one.

Not checked by a deploy: that the app works there, and that each secret it names has a value on the Worker. test --deployed and run secrets say. A deploy waits on neither: it tells you how the Worker did in the day before.

The plan

A charter app is for Workers Paid ($5 a month). Workers Free allows 10 ms of CPU time a request, and a Go Worker takes that or more for many of its requests. What Cloudflare allows a Worker and what it charges, each with a link to Cloudflare's own page, is in Cloudflare's limits.

Nothing of your account in the repository

wrangler.jsonc names its database, KV namespace, bucket and queue without ids. wrangler makes them on the first deploy and finds them by name after.

"d1_databases": [{ "binding": "DB", "database_name": "my-app", "migrations_dir": "db/migrations" }],
"kv_namespaces": [{ "binding": "KV" }],

Credentials

charter runs wrangler under fnox, which mise installs (mise.toml). The token comes from your keychain or password manager, never from a file. In CI the two variables are the environment's.

Secrets

The Worker's secrets are named in .dev.vars.example, each with a throwaway value for charter dev. Their real values are fnox's to keep, declared in the app's own fnox.toml, which you commit:

[secrets]
ADMIN_TOKEN = { provider = "keychain", value = "CHARTER_MY_APP_ADMIN_TOKEN", if_missing = "ignore" }

That is a name and where its value is kept, never the value. The provider is yours to choose: the keychain, a password manager, an encrypted file (fnox's providers). So each app has its own secrets, and nothing of an app's is in your global config.

go tool charter run secrets                            # which the app names, and which fnox has
go tool charter run secrets:put ADMIN_TOKEN --random   # a new random value: kept by fnox, put on the deployed Worker
echo "$address" | go tool charter run secrets:put MAIL_TO   # a value of your own, piped in

A value is never printed and never on a command line. charter does not write one into fnox.toml: with no provider to keep it, it stops and says how to add one. go tool charter test --deployed hands the tests the secrets fnox has.

An environment of wrangler.jsonc is a profile of fnox.toml, with the same names and its own values:

go tool charter run secrets staging
go tool charter run secrets:put staging ADMIN_TOKEN --random

Someone who clones the app has the file and not the values. charter tells them which are missing; nothing else stops.

Resources

The Worker's database, KV namespace, bucket and queue are named in wrangler.jsonc, and the first deploy makes them. What a resource is is its id (a database, a KV namespace) or its name (a bucket and a queue, which Cloudflare knows by name and cannot rename).

charter deploy writes the ids into wrangler.jsonc after it has made them, and you commit that:

"d1_databases": [{ "binding": "DB", "database_name": "my-app", "database_id": "c26412c3-…" }],
"kv_namespaces": [{ "binding": "KV", "id": "a20e27f8…" }],

From then on the Worker is bound to exactly that database and that namespace, whatever the Worker or the resource is later called. Rename the database in the file and it is the same database, with its rows.

A bucket's or a queue's name is different: a changed name is a new, empty one, and the old one is left behind with what it holds. charter deploy stops and says so; go tool charter deploy --new-resources goes ahead on purpose.

go tool charter run resources    # what the file names, and what the deployed Worker is bound to

The ids are no secrets. They do tie the repository to the account it deploys to; charter create starts a new app without them.

Taking an app away

go tool charter run delete                         # what there is: the Worker, its secrets, its data. Changes nothing
go tool charter run delete my-worker               # all of it
go tool charter run delete my-worker --keep-data   # the Worker and its secrets; its data stays

It deletes, so it is asked for twice: the second time with the Worker's name. Deleting the app deletes all of it (both Workers, and the pages the one in front kept), and wrangler.jsonc no longer names the ids of what is gone, so the next deploy makes its own.

With --keep-data the database, namespace, bucket and queue stay, and the file still names them: go tool charter deploy brings the same app back with the same data, and with its secrets from fnox, which deploy puts on a Worker that lacks them.

Cloudflare never gives a secret back. So while the Worker has a secret that fnox does not, delete stops and names it.

Your own domain

A new app is at <name>.<account>.workers.dev, which Cloudflare gives it for nothing and which is enough to build with. An app people sign in to belongs on a domain of its own, on a zone of your account. It is said once, in wrangler.jsonc, as wrangler has it:

"routes": [{ "pattern": "charter-example.ubuntusoftware.net", "custom_domain": true }],

From that line charter deploy does the rest:

WhatWho does it
The DNS record and the certificate for that nameCloudflare, as wrangler deploys the Worker in front there
charter.toml's url is that addressdeploy writes it: the specs, the tests and every command with --deployed ask it
Cloudflare sends mail for that name, when the Worker has a send_email bindingdeploy asks Cloudflare (Email Sending, on the Workers Paid plan), which adds the records
The app writes to its people from sign-in@ that namecharter, for a way back in and for confirming an address (another device)

An app made with charter create has the line written out and commented, with a name to change.

Choose the domain before people sign up. A passkey belongs to the host name it was made under: people who made theirs at workers.dev cannot use them at the domain the app moves to later, and deploy says so when it sees an app with the sign-in screen and no domain, and again as the address changes. Whoever signed up before the move gets back in by a link (run people:device).

Under charter dev the address is localhost, passkeys work there, and mail is not sent: wrangler keeps each message as a file under .wrangler/ and says where, which is where a test reads it (apptest.Mailed).

Email

A Worker sends email through its send_email binding. To an address verified on your account it sends as it is. To anyone, the domain it sends from is onboarded once (Cloudflare Email Sending, on the Workers Paid plan). For the app's own domain, deploy does that. For another:

go tool charter run mail                           # the domains that send, in the account
go tool charter run mail:enable mail.example.com   # onboard one, and show its records

Cloudflare adds the records that let it send for that domain. A subdomain keeps them apart from the domain's own mail.

After a deploy

go tool charter test --deployed
go tool charter run seo:audit
go tool charter run logs

Environments

An environment of wrangler.jsonc is deployed with go tool charter deploy staging and tested with go tool charter test --env staging. charter keeps its address in charter.toml.

Everything Cloudflare gives a Worker

workers-go's own packages work as its docs say (the example's package built uses each for one job, with a page that shows it): KV, R2, Queues, D1, Cron Triggers, the Cache API, Durable Objects, sockets and fetch. charter adds what it lacks: D1 as typed rows, rate limits and email. The example's pages for what it is built with use each one, each on a page of its own, with a test for each.