README.md

January 30, 2026 ยท View on GitHub

logo

smithy4rs

Smithy code generators for Rust

Build Status License crates.io dependencies

Smithy code generators for shapes, clients, servers in Rust.

Generated shapes provide runtime access to schema metadata and implement schema-guided (de)serialization to support any number of protocols.

Note

smithy4rs is an unofficial, community-supported code generator.


This repository contains:

  1. smithy-build plugins that execute code generation from Smithy model definitions.
  2. Core packages to support the runtime behavior of generated shapes.
  3. Protocol definitions and other packages for building high-performance clients and services with generated shapes.

Documentation

For user-guides and general documentation see the Documentation Site.

For API documentation see our Rust docs.

Getting started

Note

If you are new to Smithy, we recommend going through the Smithy Quickstart guide before using smithy4rs.

Prerequisites

  1. Ensure you have installed rust and cargo
  2. Ensure you have the Smithy CLI installed. To check if you have the CLI installed, Run smithy --version in your terminal. If you need to install the CLI, see the Smithy CLI installation guide.
  3. Install cargo-generate

Copy the template

Run the following command to copy the type-codegen template:

cargo generate --git https://github.com:mellemahp/smithy4rs-type-codegen-template.git

This template uses the rust-types build plugin to generate standalone types from any Smithy models in the model/ directory.

Build

Now, cd into the project directory created by cargo generate and run cargo test to build and test the generate shapes.

Next steps

Try modifying the Smithy models in the model/ directory to see what different shapes you can generate.

For a longer, guided introduction to this project, see the smithy4rs Quick Start Guide.

Core packages

  • Core

    • smithy4rs-core - Core functionality for all generated shapes
    • smithy4rs-core-derive - Provides derive macros used to automatically implement schema-guided (de)serialization for generated shapes.
  • Codegen

    • codegen:core - Provides common functionality for all codegen plugins. Only plugins should depend on this directly.
    • codegen:plugins - Aggregate package that provides all code generation plugins. Depend on this in smithy-build.json files.
  • Codecs

    • json - Schema-guided (de)serialization for JSON.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.