Erf - A design-first Erlang REST Framework

What is erf?

erf is a design-first Erlang REST framework. It provides an interface to spawn specification-driven HTTP servers with several automated features that aim to ease the development, operation and maintenance of design-first RESTful services. Its HTTP protocol features are provided as a wrapper of the elli HTTP 1.1 server.

What is design-first?

When following a code-first approach to develop APIs, the interface is produced as a result of the implementation and, therefore, client-side code, integration tests and other parts of the system that depend on the API behaviour, need to wait until the server-side work is done.

Design-first is an approach to API development that prioritises the design of the API before its implementation. The explicit contract produced in this design, which should be the result of an agreement between the stakeholders of the API, aims to reduce bottlenecks in the development process.

How does erf help developing design-first RESTful services?

erf is an HTTP server framework that, taking an API design in the form of an specification file and a callback module as input, starts a server and dynamically generates code to efficiently type-check and route requests to callback functions. Its main goal is to provide a tool to REST API development in Erlang that reduces the development time by automating the implementation of boilerplate code that can be inferred from the API specification.

Features

  • Automatic generation of runtime type-checked request routers.
  • Support for pre and post processing middlewares.
  • Support for static files serving.
  • Support for swagger-ui serving.
  • Support for custom API specification parsers (OpenAPI 3.0 is included by default).
  • Hot-configuration reloading.
  • HTTP 1.1.
  • HTTP 2.
  • Parameter type-casting.
  • Mock mode.
  • Telemetry features.

Links

9 Likes