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 admin screen

What an admin sees of the system: the app at a glance, what the Worker is bound to, and what its databases hold. It is one of charter's screens, for an app that has people who sign in.

go tool charter add screen:admin
admin screens.Admin `route:"/admin Admin"`
<screens.AdminLink/>

The link goes in your header. It is there for whoever may open the pages, and for no one else. The pages need the scope that manages people (admin): nobody is sent to sign in, and someone signed in without it gets a 403, by the same rule as every other page.

The pages

PageShows
OverviewThe app's name; the charter and Go versions it was built with, and its own commit; how many people there are of each role; the invitations that still wait, each with a button that cancels it; the app's own facts
PeopleThe people page: roles, invitations, removing a person
SystemEach binding the Worker has, and what kind it is; its variables and secrets, by name, with whether each is set
DatabaseEach database's tables with how many rows they have, and the migrations that ran

Each page asks only for what it shows. Nothing here changes anything, but an invitation that is cancelled.

It is what the Worker really has. The bindings are read from the Worker's own environment as it runs, not from wrangler.jsonc: what is listed is what is bound. A database, a KV namespace and a bucket have a Check button, which asks one small thing (a SELECT 1, a key that is not there) and says whether it answered and how fast. It asks when you press it, never when the page loads.

A value is never shown. A variable and a secret are listed by name, with "set" or "not set". An invitation is listed by what it is to and when it ends, never by its code, which is the invitation.

The app's own facts

What an admin wants to know of your app goes on the overview, as lines you name:

(&app.App{
	Facts: []app.Fact{
		{Label: locales.FactsNotes, Value: func(ctx context.Context) (any, error) {
			report, err := api.Report(ctx)
			return report.Notes, err
		}},
	},
}).Run()

Each is asked when the page is. A number is written as the reader's language writes one, a time.Time as a date, anything else as it prints.

From a program

The pages are functions of api.Auth, which check the caller as the pages do: auth.Overview(r), auth.System(r), auth.Probe(r, binding), auth.Databases(r), auth.CancelInvitation(r, id). Their answers are plain values with JSON names, so an operation of your contract can give a program the same thing a page gives a person.

What it does not do

  • Logs and errors. A Worker keeps none itself: go tool charter run logs follows them live.
  • Anything on Cloudflare. Deleting a resource and changing a secret are commands (deploying), each asked twice.