PROJECT TEMPLATES

Start from code that runs. Then make it yours.

New projects in GopherForge can start from a template: a small, complete Go program with its files, module and tests in place. Each one is written to be read and run on iPhone or iPad, and its page shows how to run it on a server. Every template also opens in the browser Playground, compiled and run on your own computer. Every template's Go program was compiled for GOOS=wasip1 GOARCH=wasm with Go 1.27, then run, vetted and tested before it was added to the app.

Every template except Drone flight is in the App Store app today (1.3.5). Drone flight arrives in 1.3.7 with the Drones with Go course; it already runs in the browser Playground.

Basics

Small programs that need nothing but the standard library: flags, formatted output, goroutines, tests and generics.

In the app now

Command-line tool

Flags, arguments and stdout, the shape most Go programs start as.

Offline: standard library only

Read the code →Run in browser

In the app now

Tabular report

Structs, slices and text/tabwriter, without a single dependency.

Offline: standard library only

Read the code →Run in browser

In the app now

Worker pool

Goroutines, a jobs channel and a WaitGroup, closed by the sender.

Offline: standard library only

Read the code →Run in browser

In the app now

Package with tests

A package, a table-driven test and go test, all running locally.

Offline: standard library only

Read the code →Run in browser

In the app now

Generic collections

Map, Filter, Reduce and a Set[T], with type parameters and tests.

Offline: standard library only

Read the code →Run in browser

Web and APIs

HTTP services with Gin, chi and plain net/http, plus a static website you preview on the device.

In the app now

Gin REST API

A books API with routes, path params, JSON binding and httptest checks.

Offline: bundled Gin-compatible subset

Read the code →Run in browser

In the app now

net/http JSON API

Go 1.22 method routing and PathValue: an API with no dependency at all.

Offline: standard library only

Read the code →Run in browser

In the app now

chi router

Nested routes, URL params and middleware with go-chi/chi.

Downloads github.com/go-chi/chi/v5 on first build (about 60 KB)

Read the code →Run in browser

In the app now

Static website

HTML, CSS and JavaScript previewed live, plus html/template in Go.

Offline: standard library only

Read the code →Run in browser

Command line

A command-line tool with subcommands and flags, the way larger Go CLIs are built.

In the app now

Cobra CLI

Subcommands, flags and help with spf13/cobra.

Downloads github.com/spf13/cobra on first build

Read the code →Run in browser

Data

Go programs that keep their data in a database file next to the code.

In the app now

SQLite app

database/sql with migrations, STRICT tables, UPSERT and tests; data kept between runs.

Offline: bundled gopherforge.app/sqlite driver, data kept with the project

Read the code →Run in browser

Robotics and simulation

Go programs that steer simulated machines: a drone autopilot you can watch fly.

Coming in 1.3.7

Drone flight

A survey square in a crosswind with the bundled flight simulator; the flight replays as an animation.

Offline: bundled gopherforge.app/drone simulator; Run replays the flight under Output

Read the code →Run in browser

Templates are starting points, not a course. To learn the ideas behind them, follow the Go learning map or a dedicated course such as Gin.