Sinatra Project - Cellr
It is project time again at Learn! For our second project we were tasked with creating a CRUD/MVC app using Sinatra. I have loved learning Sinatra thus far and was excited to get into a project from the ground up. The task was simple. Create an app that tracked something, included multiple models (one being users), included associations, sessions, and all basic CRUD functionality. I have been on a bit of a wine kick lately and just recently purchased a wine refrigerator for my home. Bingo! I was going to track my own personal wine collection with my app.
At the end of my last project, I vowed to never start another development project without writing down the requirements and the project structure. I started there and it made my life so much easier as I began to get into the code.
I kicked off my project with the Corneal gem which was awesome. A few commands in the terminal and the file structure was done! ActiveRecord, Shotgun, etc. were all baked in so now I just had to get started.
The app is very simple. A user can login, view all the wines in their Cellr, update or delete those wines and logout. Cellr tracks the wine name, the wine grape variety, the wine vintage and the current bottle count the user has on hand! In order to fulfill the requirements I am using bcrypt to hash passwords and authenticate with the has_secure_password
macro. A user has_many
wines and wines belong_to
a user. Sessions are keeping users logged in and clearing when a user logs out. Lastly, I am using some form validation to ensure that a user cannot save or update a wine without the information being valid.
I leveraged Bootstrap 4 to style and clean up the look a bit as well.
I am learning the more I get into these projects that it is very easy to have a wishlist a mile long. I am already wanting to add improvements to my project. Things like sorting/filtering, archiving wines, adding photos, etc. I had to catch myself and focus in on the requirements. I think this will be a good lesson to remember moving forward in both projects and work. This project really helped me continue to learn the CRUD/MVC as well as HTTP and Restful routes. Excited to take this knowledge into Rails!
All in all, I am pleased with my project. It satisfies the requirements and is truly something I can see myself using down the road. As I mentioned before, I do have other features I would love to build into so I plan to write those down in the repo and go from there as I have time! For now...
👉🏻 Check out the project on GitHub
Buy some wine! Visit Vervewine.com
Thanks for reading! Cheers!