The Problem We Solved
In a traditional setup, API contracts drift between backend and frontend: the Rust team writes structs, the TypeScript team writes matching types, and they diverge silently. We eliminated this entirely.Before: 3 Sources of Truth
Hand-written Rust structs + hand-written TypeScript types + an OpenAPI doc nobody keeps in sync.
After: 1 Source of Truth
One
.smithy model file generates everything — Rust server traits, TypeScript SDK, and DTO types.Zero Drift
If the Smithy model doesn’t compile, nothing builds. Contract mismatch caught at compile time, not runtime.
Codegen Pipeline Diagram
Step-by-Step
Define the contract in Smithy IDL
API shapes, operations, and errors are described once in
.smithy files under smithy/model/. The service is com.aarokya.api#AarokyaService.Generate the Rust server (smithy-rs)
aarokya_server_api Rust crate with generated handler traits. Your Actix-web handlers implement these traits — the compiler enforces the contract.Generate the TypeScript client
@aarokya/api-client — a fully typed npm package. The Expo app consumes it directly via a file: dependency path.Generate DTO types (Rust + TypeScript)
backend/smithy-api-model-generated/dto-rust/dto.rsbackend/smithy-api-model-generated/dto-ts/api.ts
Build Matrix
| Projection | Maven Plugin | Output | Used By |
|---|---|---|---|
server-rust | smithy-rs:codegen-server:0.1.6 | Rust crate with server traits | Actix-web backend |
client-typescript | smithy-aws-typescript-codegen:0.47.0 | npm package @aarokya/api-client | Expo React Native app |
(codegen binary) | cargo run (Rust binary) | dto.rs + api.ts | Both ends |
Why No OpenAPI in Codegen?
Smithy generates Rust server code and TypeScript clients directly, bypassing OpenAPI entirely in the codegen path. OpenAPI is only generated from Rust code annotations (via utoipa) — separately — for documentation/developer tooling purposes.This means the Smithy model is the authoritative contract, not an OpenAPI document that could drift.