• Rafael Lopez

Surfing Quiver App with Sinatra

Hey! I just built a fun web app using Sinatra, a domain-specific language (DSL) of Ruby. Sinatra is a free and open source software web application library and domain-specific language written in Ruby. It is an alternative to Ruby web application frameworks such as Ruby on Rails, Merb, Nitro, and Camping. It is dependent on the Rack web server interface and of course, it is named after musician Frank Sinatra.

Surfing Quiver App is a web application for families or surfing clubs looking to keep organized their member's surfboards. The app allows you to create, read, update and/or delete (CRUD) profiles for your new boards. Some of the data you can add includes surfboard measurement specs like type of surfboard, brand name, shaper, and type of surf among others.

I learned a lot about the MVC framework, which stands for Models, Views and Controllers. Models are used for creating associations among my classes. In this case I had two, one for surfboards and one for surfboard owners. I created and migrated a database using these two and added their respective attributes. For example, surfboard owners have names, last names and emails, and surfboards have measurement specs. Controllers are used in Sinatra to establish the routes and http verbs I worked with, both GET and POST. Routes are what connect the different requests from a browser to the specific methods in my app, they handle dealing with the request and sending the respective response. Finally, I also worked on the Views which is where I have my html but also Capybara. Capybara is really cool because it allows you write Ruby code within html files.

I also learned about CRUD and dealing with forms and URL params to handle user input. I didn't know forms are key to pass along any type of user interaction data through http request. This is a highly relevant topic to the work I do day-to-day in analytics so I've been very intrigued about how all of these verbs and protocol requests work. The hard thing at first was to correctly hook up the forms I had in my different views to my controllers but hopefully with practice I'll get better.

Draft homepage of the Surfing Quiver App built with Sinatra
Draft homepage of the Surfing Quiver App

Surfboard attributes in my SQLite database table.
Surfboard attributes in my database table.