Skip to content

What is Golem ​

Choose the Golem package you need and see how the parts work together.

Which package you need ​

Each generator installs on its own and runs through the same golem command and golem.yaml file. The command and its configuration file are named golem. The packages are published under @exprtlabs.

You haveFeature and packageYou get
TypeScript fields and app behaviorObjects and models: @exprtlabs/golem-modelValidation, JSON conversion and a model<T>() base for your class
An OpenAPI documentOpenAPI to TypeScript SDK: @exprtlabs/golem-openapi-tsTyped operations, request and response models
TypeScript controllers, with NestJS as the supported frameworkTypeScript to OpenAPI: @exprtlabs/golem-ts-openapiAn OpenAPI document from routes and types
An OpenAPI document and app modelsgolem-openapi-ts and golem-modelApp models that reuse the SDK's types

NestJS is not required. Every generated model and client imports the runtime package @exprtlabs/golem (packages).

IObject or IModel ​

An IObject declares fields whose values stay plain objects. An IModel is an IObject whose class extends model<T>() from @exprtlabs/golem/model to add methods (Define models).

How it works ​

task.model.ts
export type TTask = IModel<{  title: string & MinLength<1>;  due: Date;}>;
Generated check
typeof v.title === "string" && codePointLength(v.title) >= 1typeof v.due === "string" && isDateTime(v.due)→ .golem/models/models.validators.generated.ts
Your code, after a build tool
parse<TTask>(text)requireObjectCodec("TTask_…").parse(text)
  1. The TypeScript type checker reads your IObject and IModel declarations, including tags such as MinLength<3>, TValidation and TSerde.
  2. Golem compiles each type and its tags directly to validator IR and writes TypeScript validators in models.validators.generated.ts inside the output folder of the model block (default .golem/models/).
  3. Golem writes all generated codec files inside .golem/models/, keeping your src/ folder free of generated files.
  4. When you build or load your code, a build tool rewrites model<T>() and calls such as parse<T> to that generated code: golem build, the Vite or esbuild plugin, or the Node loader (Build tools).

How each generator uses these steps ​

GeneratorReadsThen
@exprtlabs/golem-modelYour IObject and IModel declarationsRuns steps 1 to 3. A build tool runs step 4.
@exprtlabs/golem-openapi-tsAn OpenAPI 3.1 or 3.2 documentResolves its $refs across local files and the HTTPS hosts you allow, and checks it against the official OpenAPI schema and the cross-field rules of the specification. It reads the rules from the document's schemas, not from TypeScript types, and writes the typed SDK in its own output folder. A standalone SDK also gets its own validators. For a golem SDK, the models job writes them with your models (SDK modes).
@exprtlabs/golem-ts-openapiTypeScript controllers, with NestJS as the supported framework, and their types, without starting the appRuns step 1 on the types of each route, then writes an OpenAPI document. With the nest extension, step 4 also adds the decorators that NestModelInterceptor reads to convert bodies, queries and returns.

What you need ​

Golem supports the Node.js and TypeScript versions in Compatibility. Validation is on and MobX is off by default.