Create a Sinatra App in 3 Minutes!

Amra Sezairi
Nov 4 · 3 min read
You can create ME, baby!

While being a student at Flatiron School may be hard, I’ve discovered a Ruby gem that helped ease my transition into becoming a software engineer. When learning how to build an app it can become confusing remembering all the pieces that fit together. Am I naming my folders correctly? Do I have all my MVC folders? What about my migrations?

Enter: Corneal!

One of the most helpful gems I’ve discovered while using Sinatra was the Corneal Gem, which really helped me understand how everything thing in my App is connected.

To install the Corneal gem you simply need to run ‘gem install corneal’ in your terminal.

gem install corneal
Successfully installed corneal-1.2.3
Parsing documentation for corneal-1.2.3
Done installing documentation for corneal after 0 seconds
1 gem installed

After installing your gem successfully, you will need to give your app a name. You can create a new app by entering “corneal new ‘app_name’ ” in the terminal.

Corneal new APP-Bookingscreate  app-bookings/config/initializers
create app-bookings/lib
create app-bookings/spec
create app-bookings/db/migrate
create app-bookings/lib/.gitkeep
create app-bookings/config/environment.rb
create app-bookings/public/stylesheets
create app-bookings/public/stylesheets/main.css
create app-bookings/public/javascripts
create app-bookings/public/javascripts/.gitkeep
create app-bookings/public/images
create app-bookings/public/images/.gitkeep
create app-bookings/public/images/corneal-small.png
create app-bookings/public/favicon.ico
create app-bookings/app/controllers
create app-bookings/app/controllers/application_controller.rb
create app-bookings/app/views
create app-bookings/app/views/layout.erb
create app-bookings/app/views/welcome.erb
create app-bookings/app/models
create app-bookings/app/models/.gitkeep
create app-bookings/spec/application_controller_spec.rb
create app-bookings/spec/spec_helper.rb
create app-bookings/config.ru
create app-bookings/Gemfile
create app-bookings/Rakefile
create app-bookings/README.md
I agree with the baby.

And voilaaa you see all the crazy stuff that you need for your app to work. It’s fantastic, isn’t it! This gem allows more time for you to focus on your fantastic coding skills as opposed to organizing your files.

Here, let’s take a look at what we made:

This is our default page!
This is a Welcome Page I made easily through Corneal!

All of this was generated instantly using Corneal! You could do it too.

Corneal gives you all you need for a Sinatra application. Your model, view, and controller folders are located inside of your app folder.

As you can see, your GemFile and your RakeFile are included. A Readme file is available if you ever have the need to further explain your code. By running bundle install we also generated a Gemfile.Lock file which is not intended for you to touch, as it can mess up your entire application. If you want to add any additional gems, this can be done in your GemFile.

In your config folder, you can find your environment file, which is where your connection to the database is established. A database folder along with a spec folder is provided, these files allow you to test out your app!

Now go ahead and create your brand new app, it’s definitely easier now with Corneal. :)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade