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.
| Example | Protocol | Shows |
|---|---|---|
| restjson1 | aws.protocols#restJson1 | Weather service: REST endpoints, MCP tools, pagination, retries, OpenTelemetry |
| restjson1-streaming | aws.protocols#restJson1 | Bidirectional restJson1 event streaming (chat service) |
| simplerestjson | alloy#simpleRestJson | Pizza Admin service: unions, enums, maps, errors, API-key auth |
| rpcv2cbor | smithy.protocols#rpcv2Cbor | The restjson1 Weather service over CBOR: resources, pagination, errors, retries |
| rpcv2cbor-streaming | smithy.protocols#rpcv2Cbor | Bidirectional rpcv2Cbor event streaming (chat service) |
| grpc | alloy.proto#grpc | Library service over native gRPC (no protoc): proto codec features like sparse maps, oneOf unions, enums |
| grpc-streaming | alloy.proto#grpc | Bidirectional gRPC event streaming (chat service), with a Grpc.Net interop comparison |
| aws-localstack | AWS JSON, restXml, restJson1 | Generated AWS clients with SigV4 signing against LocalStack |
| polyglot | aws.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.