Examples

August 31, 2026 ยท View on GitHub

Runnable examples covering each protocol NSmithy supports. Every example is self-contained and consumes NSmithy the way an application would: as NuGet packages, resolved from the locally packed feed in artifacts/packages.

All .NET projects are collected in a single solution, examples.slnx.

ExampleProtocolShows
restjson1aws.protocols#restJson1Weather service: REST endpoints, MCP tools, pagination, retries, OpenTelemetry
restjson1-streamingaws.protocols#restJson1Bidirectional restJson1 event streaming (chat service)
simplerestjsonalloy#simpleRestJsonPizza Admin service: unions, enums, maps, errors, API-key auth
rpcv2cborsmithy.protocols#rpcv2CborThe restjson1 Weather service over CBOR: resources, pagination, errors, retries
rpcv2cbor-streamingsmithy.protocols#rpcv2CborBidirectional rpcv2Cbor event streaming (chat service)
grpcalloy.proto#grpcLibrary service over native gRPC (no protoc): proto codec features like sparse maps, oneOf unions, enums
grpc-streamingalloy.proto#grpcBidirectional gRPC event streaming (chat service), with a Grpc.Net interop comparison
aws-localstackAWS JSON, restXml, restJson1Generated AWS clients with SigV4 signing against LocalStack
polyglotaws.protocols#restJson1.NET client calling a Smithy Java server, via docker-compose

Building

Pack the NSmithy packages first, then build the solution:

just build pack
dotnet build examples/examples.slnx

The gRPC examples need two build passes on a clean tree: the first pass generates the .proto files, the second compiles them. If the first build fails in the gRPC projects, build again.

Each example's README explains how to run it.