Rack App Structure

Alberto Saenz
2 min readAug 24, 2021

Then above screenshot is from an app I worked on for Flat iron. This was a simple app with only a couple of models(Users and courses). The intention was to create a simplified version of an e-learning app. I will break it down for you so you can see the parts involved in creating this back end. But first let me show you the same screen shot with it’s parts separated by color(I know, the lines are not straight but you’ll get it).

Let’s start with red. A rack app could be boiled down to a class with a call method, that uses middleware to filter requests and responses coming and leaving your application in the client-server request -response cycle. The area delimited by the red, is the skin of the Rack ,in other words, the way we declare a Rack App.

Blue: The “call method”. The method listening to requests coming from the front-end.

Green: The middleware, or the filters. These filter the response and provide features like query parsing string and multipart handling, or generate convenient HTTP replies and cookie handling.

Yellow: This section contains our endpoint handlers. These are responsible to handle the request by listening for the type of method the request was made with “POST”, “PATCH”, “GET”, “DELETE” and arrange the response accordingly.

There is a lot more to dive into when it comes to Rack app, but this post was directed at pointing out the basic structure of a Rack app.

--

--