Skip to content

About

Smithy code generator for BEAM languages Erlang, Elixir, Gleam*

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Repository files navigation

Available on Maven Central and Hex

smithy-beam

smithy-beam

Release Hex publish smithy_beam version Hex.pm

Code generator for the Smithy interface modelling language.

Support for BEAM languages: Erlang, Elixir, Gleam*.

fully extensible with the toolchain (follows the official Creating a Code Generator guidelines)

*Gleam support will follow :)

Hex package lives in-repo at hex/smithy_beam

Build and Test

Prerequisites:

  • Java 21+
  • Gradle 8+
  • Smithy CLI
  • Erlang/OTP 24+
  • rebar3 3+
  • Elixir 1+
make build
make test

Examples

make build publishes SNAPSHOT codegen plugins to the local Maven repository under io.github.f34nk.smithy.beam. Example smithy-build.json files depend on that group. Run examples with Java 21+.

make examples
make aws-examples

How to generate an Elixir client

Check out Maven Central for the latest version.

Assuming you have a model basic.smithy.

Create a smithy-build.json.

{
  "version": "1.0",
  "sources": [
    "basic.smithy"
  ],
  "maven": {
    "dependencies": [
      "io.github.f34nk.smithy.beam:codegen-elixir:0.3.1",
      "software.amazon.smithy:smithy-aws-traits:1.54.0"
    ],
    "repositories": [
      {
        "url": "https://repo1.maven.org/maven2"
      }
    ]
  },
  "plugins": {
    "elixir-client-codegen": {
      "service": "smithy.beam.demo.basic#BasicService",
      "edition": "2026"
    }
  }
}

Generate the code with

smithy build

The generated code is in build/smithy/source/elixir-client-codegen.

├── build
│   └── smithy
│       ├── classpath.json
│       └── source
│           ├── build-info
│           │   └── smithy-build-info.json
│           ├── elixir-client-codegen
│           │   ├── basic_service_client.ex
│           │   ├── basic_service_rest_json_1.ex
│           │   ├── basic_service_types.ex
│           │   ├── runtime_http_client.ex
│           │   ├── runtime_http.ex
│           │   ├── runtime_types.ex
│           │   └── runtime_utils.ex
│           ├── model
│           │   └── model.json
│           └── sources
│               ├── basic.smithy
│               └── manifest
├── Makefile
├── basic.smithy
└── smithy-build.json

All the basic_service_* files are generated. The name is defined by the model namespace. Additionally, the codegen also adds runtime_ files, which are essentially re-usable modules used internally.

About

Smithy code generator for BEAM languages Erlang, Elixir, Gleam*

Topics

Resources

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages