loading...
Cover image for The Coffee Project: Sinatra knows this ditty

The Coffee Project: Sinatra knows this ditty

thecodingbarista profile image Melissa Holt ・2 min read

Flatiron SWE Projects (2 Part Series)

1) Dev.to CLI Gem 2) The Coffee Project: Sinatra knows this ditty

The Coffee Project is the app that serves as the grand finale to Module 2 of my Flatiron School program: Sinatra.

Sprinkled throughout the app are a few nods to the late, great Frank Sinatra, and its name is derived from one of his songs, "The Coffee Song."

As a barista and coffee lover, I took inspiration for this project from what I know well - day to day life in a coffee shop. The prompt required that the app functions as a Content Management System (CMS), and I decided to build an app that would track inventory for The Cafe Sinatra, a fictional small chain of coffee shops.

A checklist of the project requirements

Application Structure

The Coffee Project is an MVC (Model-View-Controller) Sinatra application. Sinatra is a Domain-specific language for creating web applications with Ruby. When paired with the Shotgun gem, it's incredibly easy to view your app in browser with real-time changes.

Models

The Cafe Sinatra has multiple cafe locations, and each of those locations (Store model) has its own inventory of supplies (Item model) and employees (User model). Put in terms of Ruby model relationships:

  1. A Store has_many items and users
  2. A User belongs_to a Store and has_many Items
  3. An Item belongs_to a Store and to (many) Users through their Store

User Validations and CRUD Actions

CRUD = Create, Read, Update, Delete

Before a user is able to complete the signup process, the form is checked for completeness and the username they entered is checked against the database to ensure that it hasn't already been taken by way of the validates_uniqueness_of macro.

Each store has two types of users - employees and admins. The full inventory of an individual store is available for all of its users to view (read) and update when they are logged in, but only admins are able to create and delete items.

An example of the Store Inventory page

Building this app was quite a learning experience, and after all of the debugging, researching, route building, and testing, I'm proud to say Sinatra KNOWS this ditty!

Check out the repo here:

GitHub logo TheCodingBarista / the-coffee-project

An inventory management web app for a coffee shop

The Coffee Project is an inventory management system for The Cafe Sinatra, a fictional small chain of coffee shops.

Installation

  • Fork and clone this repository to your local machine.

  • Execute:

    $ bundle install

Usage

To get started:
1. Run 'rake db:migrate'
2. Run 'shotgun' to open the app in browser

With The Coffee Project, you can:

1. View/edit your store's inventory
2. See a list of your store's current employees

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/TheCodingBarista/the-coffee-project. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.




Flatiron SWE Projects (2 Part Series)

1) Dev.to CLI Gem 2) The Coffee Project: Sinatra knows this ditty

Posted on Apr 4 by:

thecodingbarista profile

Melissa Holt

@thecodingbarista

Yo, I'm Mel! Aside from coding, I'm into personal finance and Starbucks is my third place. Let's break in!

Discussion

markdown guide