tapir
Declarative, type-safe web endpoints library.

Intro
With tapir, you can describe HTTP API endpoints as immutable Scala values. Each endpoint can contain a number of input and output parameters. An endpoint specification can be interpreted as:
a server, given the “business logic”: a function, which computes output parameters based on input parameters. Currently supported:
Akka HTTP
Route
s/Directive
sNetty (using
Future
s, cats-effect or ZIO)Helidon Níma (using JVM 21 Virtual Threads and direct style)
Finatra
http.Controller
Pekko HTTP
Route
s/Directive
sPlay
Route
Vert.X
Router => Route
(usingFuture
s, cats-effect or ZIO)ZIO Http
Http
Armeria
HttpServiceWithRoutes
(usingFuture
s, cats-effect or ZIO)JDK HTTP
HttpHandler
(simple, synchronous API only)aws through Lambda/SAM/Terraform
a client, which is a function from input parameters to output parameters. Currently supported:
documentation. Currently supported:
Depending on how you prefer to explore the library, take a look at one of the examples or read on for a more detailed description of how tapir works!
Why tapir?
type-safety: compile-time guarantees, develop-time completions, read-time information
declarative: separate the shape of the endpoint (the “what”), from the server logic (the “how”)
OpenAPI / Swagger integration: generate documentation from endpoint descriptions
observability: leverage the metadata to report rich metrics and tracing information
abstraction: re-use common endpoint definitions, as well as individual inputs/outputs
library, not a framework: integrates with your stack
Adopt a tapir
Availability
Tapir is available:
all modules - Scala 2.12 and 2.13 on the JVM (Java 11+)
selected modules - Scala 3 on the JVM (Java 11+)
selected modules - Scala 2.12, 2.13 and 3 using Scala.JS
selected modules - Scala 2.12, 2.13 and 3 using Scala Native
Tapir is licensed under Apache2, the source code is available on GitHub.
Adopters
Is your company already using tapir? We’re continually expanding the “adopters” section in the documentation; the more the merrier! It would be great to feature your company’s logo, but in order to do that, we’ll need written permission to avoid any legal misunderstandings.
Please email us at tapir@softwaremill.com from your company’s email with a link to your logo (if we can use it, of course!) or with details who to kindly ask for permission to feature the logo in tapir’s documentation. We’ll handle the rest.
Thank you!
Other sttp projects
sttp is a family of Scala HTTP-related projects, and currently includes:
sttp client: the Scala HTTP client you always wanted!
sttp tapir: this project
sttp model: simple HTTP model classes (used by client & tapir)
sttp shared: shared web socket, FP abstractions, capabilities and streaming code.
sttp apispec: OpenAPI, AsyncAPI and JSON Schema models.
Sponsors
Development and maintenance of sttp tapir is sponsored by SoftwareMill, a software development and consulting company. We help clients scale their business through software. Our areas of expertise include backends, distributed systems, blockchain, machine learning and data analytics.
Commercial Support
We offer commercial support for sttp and related technologies, as well as development services. Contact us to learn more about our offer!
Table of contents
Getting started
Endpoints
Server interpreters
- Running as an akka-http server
- Running as an http4s server
- Running as an http4s server using ZIO
- Running as a Netty-based server
- Running as a Helidon Níma server
- Running as a Finatra server
- Running as a pekko-http server
- Running as a Play server
- Running as a Vert.X server
- Running as a zio-http server
- Running as an Armeria server
- Running as a JDK http server
- Running using the AWS serverless stack
- Server options
- Path matching
- Interceptors
- Server logic
- Observability
- Error handling
- Logging & debugging
Client interpreters
Documentation interpreters
- Generating OpenAPI documentation
- Generating and exposing documentation in a single step
- Generating OpenAPI documentation separately
- Exposing generated OpenAPI documentation
- Options
- Inlined and referenced schemas
- Authentication inputs and security requirements
- OpenAPI Specification Extensions
- Hiding inputs/outputs
- Using SwaggerUI with sbt-assembly
- Generating AsyncAPI documentation
- Generating JSON Schema