Search titles and sections of every page. ↑↓ to move, ↵ to open

Tutorial

Tutorial

Build a reading list with accounts, tests and a deploy, one step per page.

1 min read Edit on GitHub

This tutorial builds Shelf, a reading list: you save links to read later, mark them read, and filter them. Then you add accounts, so every user has a shelf of their own, write tests for it, and ship it as one binary to a server.

Each step adds one idea and ends with an app that runs. Along the way you use most of what a Tern app is made of:

  1. Create the app: a new project, and the dev server
  2. Your first page: a Go load, and the types it gives your Svelte page
  3. A database: SQLite, and migrations
  4. Saving links: a form action, validated from Go struct tags
  5. A page for each link: a route parameter, not-found pages, more actions
  6. Filtering: state in the URL
  7. Accounts: sign-up, sign-in, and data that belongs to its user
  8. Tests: the whole app, tested from Go
  9. Ship it: one binary, deployed over SSH

The finished app is examples/shelf, if you want to compare. It goes one step further than the tutorial: assistants such as Claude can use it, through the tools in assistants.go (Apps for assistants).

#What you need

  • Go 1.26 or later, and Node.js 22 or later. Node builds the client in development; the app you ship runs without it.
  • Some Go, and some Svelte or another component framework. You don't need to know SvelteKit, but if you do, much of this will look familiar: Coming from SvelteKit lists the differences.