talira

Type-level web API DSL for Haskell: servers, clients and docs from one type

open sourceBSD-3-Clausefree

Servant is a family of Haskell libraries for type-safe web APIs. You describe an API as a Haskell type, and Servant checks at compile time that your server's request handlers implement it, derives Haskell client functions that call it, generates JavaScript clients, documentation and OpenAPI (Swagger) descriptions from it, and can mock it. The server side (servant-server) works as a web framework running on Warp through WAI, and servant-auth adds authentication. It's maintained by the Servant contributors, after starting at Zalora.

Problems it solves

  • build a REST API in Haskell where the compiler checks the handlers match the spec
  • get a typed client for my Haskell web API without writing it by hand
  • generate API docs and an OpenAPI spec from my Haskell server's types

Features

  • Describe a web API as a Haskell type checked at compile time
  • Serve the API with servant-server, checked against its handlers
  • Derive Haskell client functions with servant-client
  • Generate JavaScript client functions and API documentation
  • OpenAPI (Swagger) descriptions from the API type
  • Authentication with servant-auth