Good Place library: Chidi

In the Good Place series, Chidi is one of the main characters. It is the main character's soulmate. Professor of ethics who has problems with making decisions.


Chidi is the framework for creating applications based on the http protocol. It has a straightforward http server based on the ev supervisors and fibers. It brings attractive performance characteristics and modularity.


In contrast to other Janet web frameworks, the core works only with request and response strings. The middleware solves everything else. From parsing request (by Janet's PEG) to constructing response (by printing to buffer).


Right now there are these middleware:

  • Parsing of the request string into table.
  • Routing based on the pretty URL.
  • Converting to and from JSON in the body.
  • Guarding http methods.
  • Guarding accepted mime types.
  • Parsing query params
  • Dispatching based on the http method.
  • Serving static files.
  • Parsing urlencoded data from forms.
  • Parsing multipart data from forms.
  • Parsing cookies from headers


Another module in the library is the response, which helps create, you guessed it, http responses. The most important is the http function, which transforms the response table used for middleware communication, into a response string. On top of this function, other specific response functions exist. For example success with status code 200, or not-found with status code 404.

Next there are couple of utility function for adding information to the response table. content-type and cookies for generating right header. Another are functions for rendering response body ->json for encoding json response and page for rendering html from the Temple template.

Last function in the response module is default-supervisor used in the server for supervising the creation and handling of the connection.

Package: chidi Good Place 2021 All rights rejected