Examples

Turbo ships a mix of runnable examples you can execute today and roadmap examples that document planned language features. This page separates the two so the product surface stays clear.

Two example tiers

  • Runnable today: examples under examples/ compile with the current toolchain.
  • Roadmap / planned: examples under examples/roadmap/ are design references and are not expected to compile yet.

Running examples today

Runnable examples are simple entry-point projects with README notes and executable main.tb files. Run them directly with the CLI:

turbolang run examples/web-dashboard/main.tb
turbolang run examples/simple-script/main.tb
turbolang run examples/speed-server/main.tb
turbolang build examples/todo-cli/main.tb

web-dashboard -- Flagship Browser Demo

Runnable todayBest first run

Hero example

The clearest single demo of what Turbo can do today: one Turbo file serves a styled HTML dashboard plus five JSON benchmark endpoints. This is the fastest way to prove the compiler, runtime, and browser story all work together.

Quickstart

turbolang run examples/web-dashboard/main.tb
# then open http://localhost:3000

Try this in the browser

  • Click Run All Benchmarks
  • Open /api/info in a second tab
  • Leave the terminal running until you press Ctrl+C

Key features demonstrated:

  • HTML UI plus JSON routes from one Turbo process
  • HTTP routing and browser-facing responses
  • CPU-bound benchmark endpoints you can trigger live
  • String-built HTML/CSS/JS without extra dependencies
  • Runnable today with the current compiler

simple-script -- Text Statistics Analyzer

Runnable today

Starter

A text analysis tool that demonstrates Turbo's core features: functions, strings, arrays, hashmaps, the pipe operator, and string interpolation.

Key features demonstrated:

  • Pipe operator for data flow
  • String operations (trim, upper, lower, split, replace)
  • Hashmap-based word frequency analysis
  • Array operations (map, filter, reduce)
  • String interpolation in print statements
// Pipe operator for clean data flow
let chars = text |> count_chars
let words = text |> count_words

// String operations pipeline
let sample = "  Hello, Turbo World!  "
let cleaned = sample |> trim
let upper = cleaned |> upper

speed-server -- HTTP Speed Server

Runnable today

Intermediate

A high-performance HTTP server example showcasing Turbo's current HTTP primitives, JSON responses, and benchmark-style endpoints.

Key features demonstrated:

  • HTTP routing and request handling
  • JSON responses
  • CPU-bound benchmark endpoints
  • Native compilation for server-style workloads

More runnable examples

ExampleDescriptionStatus
todo-cliTask manager with file I/O and structsRunnable today
data-pipelineLog analysis engine with parsing and aggregationRunnable today
game-of-lifeConway's Game of Life with string-grid updatesRunnable today

Roadmap examples

These examples are design references for features still in development. They help explain where Turbo is headed, but they are not runnable with the current compiler.

ExampleDescriptionStatus
web-apiProduction-style bookmarking API with JWT auth and WebSocket routesPlanned / not runnable yet
realtime-systemTrading order matching engine with zero-allocation ambitionsPlanned / not runnable yet
edge-wasmEdge image processing pipeline targeting future WASM workflowsPlanned / not runnable yet

Browse the full set of runnable and roadmap examples in the examples directory of the Turbo repository.