Examples by category

The Tapir repository contains a number of how-to guides. If you’re missing an example for your use-case, please let us know by reporting an issue!

Each example is fully self-contained and can be run using scala-cli (you just need to copy the content of the file, apart from scala-cli, no additional setup is required!). Hopefully this will make experimenting with Tapir as frictionless as possible!

Examples are tagged with the stack being used (Direct-style, cats-effect, ZIO, Future), server implementation, generated documentation format etc.

Hello, World!

Client interpreter

Custom types

Error handling

JSON

Logging

Multipart

Observability

OpenAPI documentation

Schemas

Security

Server Sent Events

Static content

Status code

Streaming

Testing

WebSocket