Giter Site home page Giter Site logo

bilalbro / recipes-app Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 1.23 MB

A fully-fledged recipe-managing SPA, built using React and IndexedDB.

JavaScript 57.23% TypeScript 23.79% SCSS 18.98%
indexeddb react recipe-management recipe-manager single-page-app

recipes-app's Introduction

Recipes App

A fully-fledged recipe-managing SPA, built using React and FrontendDB.

recipes.mp4

Running the app on your end

Since this entire app runs on the frontend, there is nothing that you need to set up on your end, such as database systems, to get it into action.

All you need to do is first clone the repo using the following command:

> git clone https://github.com/bilalbro/recipes-app

And then run the following commands, in the order shown:

> npm install
> npm start

This will get a server instance running on port 3000. Now just go to your favorite browser and navigate to http://localhost:3000 and voila!

Motivation

Besides programming, I really love to do cooking/baking. I enjoy the activity so much and take it so precisely that I have a whole collection of my own recipes to manage. There is literally a lot to do in this regard โ€” write new recipes, iterate over previous ones, rate the recipes, give reviews so that I know where to tweak the recipes, and a lot more suchlike.

For a long time, I had been managing all this in a physical notebook (yeah, it works well in the beginning). But, needless to say, at one point not very far off, the notebook started to become a real trouble to manage. Almost every single recipe page got filled with pen marks, striking through ingredients, quantities, reviews, and what not.

Now, as a programmer, you could've imagined what was going through my mind at this stage. Let's build a recipe-managing application with all the feature that I want.

And behold! Project recipes-app begins.

Features

Here's a quick summary of the features of the app:

  • Create new recipes (with groups of ingredients, reviews, yields, and much more)
  • View recipes, with an indication of which ingredients have been scaled up or down compared to the previous iteration
  • Update recipes
  • Delete recipes
  • Iterate over existing recipes to improve them
  • Copy recipes to take them into a completely new course
  • Create new ingredients/categories
  • View all ingredients/categories
  • Update names of ingredients/categories
  • Delete ingredients/categories
  • Perform a data backup
  • Reset the app's data
  • Restore data using a backup file

Technologies used

Let's now talk about the technologies that I used to build this app.

React

The application is a SPA (Single-Page Application) and React is pretty good at creating these along with React Router. We get a very intuitive approach to break down the logic of our app into these composable and reusable components, making overall maintenance really seamless. So, my choice was React, hands down.

TypeScript

Instead of directly inlining model interaction code inside of components, using useEffect() hooks, I decided to create a class RecipeList and a class ItemSet and leave off all the model-associated logic to them both. This made sense because I was using React Router, where we fetch data of the app in loaders and then relay that data forward to the corresponding components. These classes and their related code together was all written in TypeScript.

SASS

Because the styling concerns of the app were also relatively complex, it was the high time to leverage a CSS preprocessor. And I guess, SASS is the de facto in this regard, at least for me, for now.

IndexedDB (wrapped around my FrontendDB library)

When the time came to decide the database technology to use to persist the data of the app, I went with a frontend, browser-based solution, IndexedDB. Have you heard about it?

For a long time, I had known about IndexedDB but never really worked with it. It seemed to me like a killer feature that a JavaScript developer should definitely know of. And with this app, I finally got the opportunity to turn this into a reality.

First I spent a lot of time experimenting with the IndexedDB API in general. You know, it's a relatively low-level API based on a complex event system, and takes some time to get comfortable with. Once I became rock solid in it, I transitioned to integrate it into my app.

(Well precisely speaking, first I built a wrapper library around IndexedDB to simplify working with it: FrontendDB and then integrated this library into my recipe-managing app. Quite ambitious, isn't this? ๐Ÿ˜Š)

recipes-app's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.