Skip to content

Latest commit

 

History

History
66 lines (53 loc) · 5.82 KB

README.md

File metadata and controls

66 lines (53 loc) · 5.82 KB

MyNotes App

A simple web app for writing/taking down notes. This app uses Firestore, a NoSQL document database from Firebase, to create, update, delete and query notes. MyNotes was used during the "Build MyNotes App with Firestore" Virtual Hands-on-Workshop organized by Developer Student Clubs, Alex Ekwueme Federal University Ndufu Alike Ikwo (DSC AE-FUNAI), on Friday, 16th October 2020, from 8pm to 10:30pm GMT+1, on the DSC AE-FUNAI WhatsApp Group. Know more about the event at https://dsc.community.dev/e/mgffeb/

On Firestore

Firestore is a cloud-hosted, NoSQL database that your web and mobile apps can access directly. Firestore can be quickly setup in Firebase, a platform developed by Google for creating mobile and web applications.

Firestore is easy to use. You can easily store, synchronize and query data directly from your mobile and web apps. With Firestore, you structure and query data, the way you like. Data stored is in key-value pair mechanism. As such, data is like the contents of the dictionary where you need a key or language word, to get a value, or meaning of that word.

An entity is essentially a document. A document contains data in key-value pairs. For example, a single note, taken in the MyNotes app could contain the date, the subject, the topic and details (the note itself). This single note can be stored in Firestore as a document that contains key-value pairs of date, subject, topic and details with their values.

Similar documents are grouped into collections. So, we will have a single notes collection, which will in turn contain note documents. A unique note document will then contain the data associated with one note. A document can also contain a collection. In other words, collections, each containing documents, can be nested in a document, contained in a top-level collection.

structured data

In Firestore, like all other databases, data can be Created, Read (retrieved/queried), Updated, and/or Deleted. These four CRUD operations can be quickly achieved in Firestore as implemented in MyNotes. You can create, query, edit, and delete notes. Well, if all the above is complex, just follow the below workshop instructions.

Workshop Instructions

1. Create a Firebase project.

2. Enable Firestore

  • In the Firebase project you just created, in the left hand menu, click Cloud Firestore.
  • Click create database, select start in development mode and leave the default location. It will take a few minutes to be enabled.

3. Setup Firebase on your computer.

  • Download and install NodeJS from https://nodejs.org/
  • In your terminal/command line, install Firebase, through NodeJS, by running the following command
    npm install -g firebase-tools
    
  • Login into your Firebase in your terminal/command line with your Google account by running the following command
    firebase login
    

4. Get the code

  • The website code to make MyNotes work is available in this repo at https://github.com/DSC-AEFUNAI/mynotes
  • Get the code by either Cloning (Recommended) or Downloading as ZIP
  • If you have Git installed on your computer, you can clone with the following command
    git clone https://github.com/DSC-AEFUNAI/mynotes
    

5. Deploy MyNotes with Firebase.

  • In your terminal/command line, change the current directory to the just cloned/downloaded mynotes folder. If you used the clone command above, run the following command to mynotes folder
    cd mynotes
    
    Else, if you downloaded as ZIP, extract the ZIP. Then copy or take note of the full path of the extracted mynotes folder. Run the following command to enter the mynotes folder in your terminal/command line. Replace FULL_PATH with the path you copied or took note of.
    cd FULL_PATH 
    
  • Run the following command to link your Firebase project with MyNotes. If you have more than one Firebase project, use up and down arrow keys to cycle through other projects. Press Enter to choose your project and when prompted for project alias, use default
    firebase use --add
    
  • Finally, deploy your MyNotes by running the following command
    firebase deploy
    

MyNotes is at YOUR-PROJECT-ID.web.app, as you will be shown by the terminal. Start writing/taking notes!!! After you must have written some notes, check back firestore in the Firebase console. Go to https://console.firebase.google.com/project/_/firestore and take note of the notes collection and the note documents you have created with MyNotes. Creating/Editing/Deleting notes from Firestore directly, will get them shown/updated/deleted in MyNotes. Same occurs the other way round, that is, changes in MyNotes will reflect in Firestore. This is another real-time power of Firestore.