Sidebar

Displays the mobile sidebar.

Search the docs

Search the docs

The example
The example
What is in it
What it has, exactly
Making it yours
How it is built
How it is built
A page declares what it needs
Running it
The API of charter-example
The API of charter-example
Operations
Ways in
GET /api/hello
GET /api/notes
POST /api/notes
GET /api/notes/watch
DELETE /api/notes/{id}
GET /api/people
PUT /api/people/{id}/role
Types
ErrorDetail
ErrorModel
Note
Person
The database
The database
Tables
notes
activity
attachments
users
passkeys
tokens
ceremonies
Statements
What the Worker is bound to
What the Worker is bound to
Sign in

Time zone and clock

Dates and times on every page use these settings. Automatic uses your browser's time zone.

Loading…

On this page

How it is built

Every part of the app is in the folder charter looks for it in.

FolderWhat is in it
pages/The page tree: the home page with its live list, the pages of how it's built, and the routes they call
api/The notes API's contract and handlers, and the one feed behind the page's list and the API's stream
db/schema.sql, the tables as they are now, and queries.sql
built/What the app does with what Cloudflare gives a Worker, one job each
locales/English, German, Arabic
docs/These pages
test/Tests of the pages in a real browser, and of the API through its own SDK

A page declares what it needs

func (Home) Props(r *http.Request, store api.Store) (HomeProps, error) {
	notes, err := store.Before(r.Context(), math.MaxInt64, shown)
	…
}

The store is made from the request and handed over. So pages/pages_test.go tests the pages as plain Go, with a store of its own, in half a second.

Running it

go tool charter dev
go tool charter check && go tool charter test
go tool charter deploy

Back to the start.