Toolchain documentation

create-sdkgen

The way in. One command from a spec to a project, then a loop you stay in: edit the model, generate, run the tests.

Scaffolds a project. The way in. One command turns an OpenAPI spec into a project with the model already built, the targets you asked for already added, and a generate script wired up. Start here unless you are working on the toolchain itself. Checked against the source repository, which is the authority where it and this page disagree.

What it is#

create-sdkgen is a scaffolder. It runs apidef over your spec to build the model, creates the project layout around it, adds the targets and features you name, and installs dependencies. What you get is a project you own, not a service you call.

It is the right entry point for building an SDK for your own API. The sdkgen and apidef pages are about the machinery; this one is about using it.

After the scaffold you are in a loop, and it is worth being explicit about which parts of the tree are yours: you edit the model under .sdk/model/, run generate, and run the target's tests. Everything under the language directories is output.

Concepts#

The ideas you need to hold to use it, and the ones that cost time when nobody told you.

Commit before you regenerate

Generation three-way merges into an existing generated file by default, and a project can switch to plain overwrite with one line of config, which is what both demo repositories do. Either way an uncommitted experiment in a target directory is at risk, and voxgig-sdkgen doctor exists to tell you what a resync would revert. Commit first, and fix bugs in the model, a template or a component rather than in the output.

The model is where you shape the SDK

Entities, operations and fields all live in .sdk/model/. Renaming an entity, dropping an operation you do not want to expose, tightening a type: those are model edits. .sdk/model/project.aon is created once and never overwritten, so project-level decisions belong there. The model files beside it are toolchain-derived and refreshed, and apidef merges into your edits rather than clobbering them.

Your documented examples are tested

Every generated target carries a readme_examples test that extracts each code block from that language's README.md and REFERENCE.md, compiles it, and runs the runnable ones in offline test mode. A documented example that does not work fails that target's build. This is why the examples on this page were copied out of real generated READMEs rather than written by hand.

Publishing is yours to do

The toolchain generates packages; it does not publish them. When the tests are green, each language package is published the way its ecosystem expects: npm, PyPI, Packagist, RubyGems, LuaRocks, or a Go module tag.

Examples#

Commands and API calls are as the component's own documentation gives them. Every example marked with a source is copied from that public repository, so it can be checked rather than trusted.

From a spec to a tested SDK

Four steps. The first scaffolds, the second adds targets and offline test mode, the third generates, the fourth proves it. This is the shape both worked examples on this site were built with.

shell, the four steps
# 1. Scaffold a project from your OpenAPI 3 spec
npx @voxgig/create-sdkgen my-api -d ./openapi.yaml -o ./my-api-sdk

# 2. Add the languages you want, plus offline test mode
cd my-api-sdk/.sdk
npx voxgig-sdkgen target add ts py go
npx voxgig-sdkgen feature add test

# 3. Generate (builds the .sdk sources, then runs the generator)
npm run generate

# 4. Verify
cd ../ts && npm install && npm run build && npm test

Targets and features can also be named at scaffold time with -t ts,py,go and -f test, which collapses steps 1 and 2.

The loop you stay in

After the scaffold, every change follows the same three moves. Nothing here is a one-off: adding an entity, correcting a classification apidef got wrong, and turning on a feature all go through the same loop.

shell, the regenerate loop
git commit -am 'before regenerate'          # generation rewrites ts/, py/, go/

$EDITOR .sdk/model/entity/planet.aon        # shape the SDK here
(cd .sdk && npm run generate)               # regenerate every target

(cd ts && npm test)                         # offline: no server, no credentials
(cd py && python -m pytest)

Options

The scaffolder takes a name, a spec and an output directory, plus the targets and features to add on the way. --no-install is the one to reach for in CI or when you want to inspect before anything is fetched.

shell, the scaffolder options
create-sdkgen <name> [options]

  <name>                 SDK name in kebab-case, the package base name
  -d, --def <spec>       OpenAPI 3 spec file (.yaml or .json)
  -o, --folder <dir>     output directory (default: <name>-sdk)
  -t, --target <langs>   targets to add during scaffold, e.g. ts,py,go
  -f, --feature <feats>  features to add, e.g. test
      --no-install       skip npm install
  -h, -v                 help, version

What the two worked examples were built from

Both public demo SDKs on this site came out of this scaffold. solardemo took every target the toolchain has; elementdemo took six and then added a feature of its own. Reading either repository is the fastest way to see what your own project will look like a few steps in.

shell, reading the worked examples
git clone https://github.com/voxgig-sdk/voxgig-solardemo-sdk
git clone https://github.com/voxgig-sdk/voxgig-elementdemo-sdk

# The model is the interesting part; the language directories are output.
ls voxgig-solardemo-sdk/.sdk/model/entity     # moon.aon  planet.aon
ls voxgig-elementdemo-sdk/.sdk/model/feature  # elementcard.aon and four more
ls voxgig-elementdemo-sdk/ext                 # the project's own sdkgen package

Reference#

The lookup tables. The first-party documentation below goes deeper on every row.

What the scaffold produces

NameWhat it is
.sdk/The project: the model, the generator components and templates, and the generate script.
.sdk/model/project.aonYours. Created once, never overwritten.
.sdk/model/entity/One file per entity, from apidef.
<target>/One directory per target, all generated output.
README.mdThe top-level README, generated, listing every target.
AGENTS.mdThe guide an agent reads to work on the project.

The three moves

NameWhat it is
Edit.sdk/model/ only. The language directories are output.
Generate(cd .sdk && npm run generate).
VerifyEach target's own test command, offline by default.

First-party documentation#

This page summarises at the altitude a decision needs. These go all the way down, and they are the authority.

The rest of the toolchain#

  • sdkgen Turns the model into SDKs.
  • apidef Turns a spec into a model.
  • docgen Generates documentation targets.
  • apigen Not yet published.

The pipeline, the components, and the two worked examples

Read the generated code#

The toolchain is MIT and open, and the catalog holds 600+ generated SDKs readable without installing anything.

Voxgig SDK GeneratorTalk to Voxgig

Get the Voxgig dispatch

Short notes on building SDKs, CLIs, REPLs, and MCPs for API-first teams, plus the occasional Fireside episode pick.

By signing up you agree to our Terms and Conditions.