Description
Servant is a set of Haskell libraries for writing type-safe web applications. You describe a web API as a Haskell type, and Servant checks that your server handlers implement that API faithfully. From the same type, it can derive Haskell client functions that call the API, generate a Swagger or OpenAPI description, produce client code in other languages, such as JavaScript, and generate documentation. The approach means that when the API changes, the compiler points out the code that needs to change, so clients and servers stay in step. The documentation has a tutorial, a cookbook and example projects, and it covers serving an API, querying it, generating JavaScript functions to query it, documenting it, and authentication. The cookbook covers structuring APIs, OpenAPI, record-based APIs and serving a web app alongside an API. Servant is for Haskell developers who want strong guarantees about their HTTP APIs without writing the client and documentation by hand. It is a library rather than an end-user application. The project is open source and its documentation is published on the Servant docs site.…
Highlights
- Describe an HTTP API as a Haskell type
- Type-checked server handlers
- Derived clients and OpenAPI or Swagger docs
- Tutorial, cookbook and examples
Ratings & Reviews
No ratings yet
Be the first to rate Servant.
People also visit
Utoipa
Simple, Fast, Code first and Compile time generated OpenAPI documentation
Servant FAQ
What is Servant?
A set of Haskell libraries for writing type-safe web APIs, deriving clients and generating documentation from the API's type.
Is it free?
Yes. It is a free, open-source library.
Do I need to know Haskell?
Yes. Servant is a Haskell library, and its tutorial is written for Haskell developers.
Can it generate documentation?
Yes. The site says it can generate Swagger or OpenAPI descriptions and documentation from the API type.
Can it generate clients in other languages?
Yes. The docs cover generating JavaScript functions to query an API.
Where do I start?
The tutorial, which covers installation, describing a web API as a type, and serving it.
What are the best Servant alternatives?
Popular alternatives to Servant include Wai, Keter and Ktor Documentation. See all Servant alternatives








