Examples
Whole apps, each one small enough to read
Each example is a real app in the repository's examples/ directory, built with Roc Solid from the database to the browser: the pieces fitting together, not a snippet. Each has a README that tours it and points to the file behind each feature, and a page here with its numbers and, for most, screenshots. All but hello have their own tests.
Where to start#
Start with hello: one page with a counting button, and one endpoint, the two files Getting started shows. Then read Tasks, written to be read first: file routing, middleware, a database, pages that read endpoints, forms that work without JavaScript, and optimistic updates, done the plain way, with comments on why each piece is where it is. Then pick the app that shows what you need from the table below.
To run one, set up the repository (just setup), then start the app from its own directory, so its database file lands beside it. rocx dev builds it, serves it at http://localhost:8080 and rebuilds on save. just examples builds, checks and tests an app as the repository's checks do. just examples-release builds it to deploy (rocx build), then runs its tests against a server optimized for speed.
cd examples/tasks && ../../bin/rocx dev # http://localhost:8080
just examples tasks # build, check and test it
just examples-release tasks # its tests, as deployedAt a glance#
The wasm column is the app's browser half, which every visitor downloads; an app of endpoints alone has none. A name links to the app's page.
- The smallest browser half
- 205.0 KB
- wasm, brotli: a page and a counter
- The JavaScript beside it
- 22.8 KB
- brotli: start.js, which every page loads too
- The largest here
- 433.5 KB
- wasm, brotli: Plate
- Echo, answered
- 123,732
- requests a second at 64 connections, a JSON string each; 115,086 with an order that nests
| App | What it is | Wasm, brotli | Pages | Lines of Roc | Database |
|---|---|---|---|---|---|
| hello | A page, a counter and an endpoint | 205.0 KB | 1 | 25 | none |
| Tasks | Task lists: the one to read first | 368.5 KB | 4 | 2,302 | SQLite |
| Journal | Markdown posts in two languages | 298.0 KB | 7 | 2,779 | none |
| Board | A live kanban board, for several at once | 374.9 KB | 3 | 3,525 | SQLite |
| Pinwheel | A live quiz for a room full of phones | 387.5 KB | 5 | 3,629 | SQLite |
| Status | An uptime monitor and its status page | 328.3 KB | 6 | 3,308 | SQLite |
| Notes | Notes in Markdown, for people and AI agents | 330.8 KB | 7 | 3,154 | SQLite |
| Pomodoro | A focus timer, in a browser and on Android | 239.7 KB | 1 | 414 | SQLite |
| Plate | A food diary for a phone | 433.5 KB | 11 | 4,047 | SQLite |
| Rack | A score keeper for word games on its own board, with no server | 358.6 KB | 2 | 3,128 | none |
| echo | Two endpoints, to measure the server | none | 0 | 42 | none |
| sqlite-vs-turso | SQLite against Turso, timed in Roc | none | 0 | 839 | SQLite |
| Million | A million checkboxes, shared live | 235.1 KB | 1 | 514 | none |
How they're measured#
Measured on 2026-11-29, at commit 74eec5b, with the compiler rocx-fork-a6628342f1, on an Apple M5, 10 cores. just example-apps rebuilds each app's browser half (rocx generate --client, then the wasm with --opt=size, as rocx build does) and compresses it as this site measures its own (gzip level 9, brotli quality 11). Then it counts pages, endpoints, the app's own lines of Roc (no blank lines, nothing rocx writes, no tests), expects and node tests.
just example-apps --bench reruns echo's server benchmark, and just example-shots takes the screenshots. This site's build only reads what they wrote, since a dozen wasm builds take minutes. How the browser's runtime compares with other frameworks: js-framework-benchmark.
The sizes are what a browser downloads compressed. The Roc Solid server sends files as they are, so in production a CDN or a compressing proxy (GitHub Pages, for this site) gets them down to these sizes.