Generator

Scaffold plain Go from a declaration

When you want a head start, generate the code. It writes plain Go to disk. You own it, read it, and edit it. One shot: nothing to keep regenerating against.

code generationSDKscustomer CLIapp-spec

Code generation

gofastr generate turns a declaration into Go on disk. Config-driven generators write under gen/; every run is reproducible, and --dry-run shows you the plan first.

5 lines
# preview without writing
gofastr generate --config gofastr.settings.yml --dry-run --json

# write the generated Go
gofastr generate --config gofastr.settings.yml

/docs/codegen →

SDKs

Generate a client for your API: a standalone Go module and a JS/TS ESM client. The app can host them behind a live docs page for your customers.

1 lines
gofastr generate sdk --target=go,js --out=gen/sdk

/docs/sdk →

Customer CLI

Generate a branded terminal client for your API, with scoped API-token auth. Your customers get a real CLI; you own the generated code under cmd/.

4 lines
gofastr generate cli --binary=meridian --only=customers,invoices

# customers sign in with a scoped token, read from stdin
echo "$TOKEN" | ./meridian login --url https://app.example.com --with-token

/docs/app-cli →

App specs

A gofastr.yml is a bundle of entities and screens. gofastr generate app gofastr.yml writes the app as plain package main to your module root: a one-shot scaffold you then own, not a tree you keep regenerating.

gofastr.yml
10 lines
entities:
  - name: plans
    crud: true
    fields:
      - name: name
        type: string
        required: true
      - name: slug
        type: string
        unique: true

/docs/app-spec →

Where next