Getting Started
This guide takes you from zero to a deployed service in about ten minutes. You'll build a small JSON API, then a web app with a database, and finally a production binary.
You need: Go 1.26+, make, and Git. Docker is optional and only needed
for container images.
1. Install the CLI
go install github.com/WhoseBiasDoYallSeek/fgoths-framework/cmd/fgoths@latest
fgoths version # version: 1.4.1
This puts fgoths in $(go env GOPATH)/bin, so make sure that folder is on
your PATH. Prefer building from source? See
Install.
2. Your first API
fgoths init --name=orders --preset=api
cd orders
make dev
make dev starts the server on :8080 and restarts it every time you save a
.go file. In another terminal:
curl localhost:8080/health # {"status":"ok"}
curl localhost:8080/status # {"service":"orders","status":"up"}
What was generated
orders/
βββ main.go β routes live here
βββ handlers/ β your code goes here
βββ pkg/runtime/ β the embedded FGOTHS runtime (you rarely touch it)
βββ cmd/dev/ β the hot-reload watcher used by `make dev`
βββ Makefile
βββ Dockerfile
It is a plain Go module. There is no hidden framework import, and everything the service does is in this folder.
Add an endpoint
Create handlers/orders.go:
package handlers
import (
"net/http"
"orders/pkg/runtime"
)
func GetOrder(w http.ResponseWriter, r *http.Request) {
id := runtime.PathValue(r, "id")
writeJSON(w, http.StatusOK, map[string]any{"id": id, "status": "pending"})
}
Register it in main.go, next to the existing routes:
server.Get("/orders/{id}", handlers.GetOrder)
Save, and the server restarts on its own:
curl localhost:8080/orders/42 # {"id":"42","status":"pending"}
The server also has Post, Put, Patch, Delete, Any, and Use (for
middleware). Use runtime.PathValue to read {params}.
Test it
make test # go test ./...
go test -race ./... # recommended before shipping
The generated handlers/handlers_test.go shows the pattern: an
httptest.Recorder and a direct handler call, with no server to start.
3. A web app with a database
fgoths init --name=shop --preset=webapp
cd shop
make dev # β http://localhost:8080
The webapp preset adds:
views/: Templ components, compiled to Go, so templates are type-checked;models/andinternal/database/: SQLite with embedded migrations;static/: CSS and JS. In development, the browser reloads automatically when you save a view, a stylesheet, or a script.
Scaffold a resource
fgoths generate crud Product name:string price:float64 in_stock:bool
This creates the model, repository, handler, SQL migration, and tests, and registers the full resource for you: list, create, read, update, and delete.
curl -X POST localhost:8080/api/products \
-d '{"name":"Coffee","price":12.5,"in_stock":true}'
curl localhost:8080/api/products
curl localhost:8080/api/products/1
curl -X PUT localhost:8080/api/products/1 \
-d '{"name":"Espresso","price":9,"in_stock":true}'
curl -X DELETE localhost:8080/api/products/1
Field types: string, bool, int, int64, float64. Write entity names
in PascalCase and field names in lower_snake.
4. Add features
Pick features when you create a project:
fgoths init --name=billing --preset=api --db=postgres --features=metrics,openapi,jwt-auth
Each feature adds code, and dependencies only when it truly needs them. Run
fgoths presets or see the CLI reference for the full
list.
5. Ship it
As a single binary
make build # β bin/app (static Linux binary, ~6 MB)
scp bin/app server:/opt/orders/
ssh server systemctl restart orders
The binary has no runtime dependencies: no Go, no libc, and no container engine on the server.
As a container
make docker-build # FROM scratch image, under 10 MB
make docker-run
With an SBOM
fgoths build --scratch --sbom # binary + Dockerfile + software bill of materials
6. Keep it up to date
New FGOTHS releases never change your project on their own. When you want the latest runtime fixes, run:
fgoths upgrade --dir=. # preview
fgoths upgrade --dir=. --apply # apply
See Upgrading for the details.
Where next
- CLI reference: every command and flag
- Project layout: what each generated file does
- Architecture: how the runtime works and which contracts it guarantees
- Working examples: examples/api-demo and examples/webapp-demo