Skip to content

griffinsockwell/quick-questions-firebase-react-mobx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

screenshot-1

This is a simple app where users can ask questions and get answers from other users.

I made this app to compare local vs global state management in react. This particular repo uses mobx for state management with react. To be compatible with create-react-app without ejecting, I'm using mobx without decorators. You can find out more about using mobx without decorators here.

You can find this same app using local state management here.

You can find this same app using redux for state management here.

To Run Locally

$ cd ~/Desktop
$ git clone https://github.com/griffinsockwell/quick-questions-firebase-react-mobx.git

Make sure Node.js is installed.

Login to Firebase and create a new app from the dashboard.

Click on 'Add Firebase to your web app'

Change the firebase config in '/src/reference.js'

firebase.initializeApp(<your-config-object-here>);

Enable an Authentication Sign-In Method with Google and then click Save.

screenshot-2

When creating new apps the default security rules require users to be authenticated to be able to read and write to the database. Below are some quick rules to get you started.

In the firebase dashboard click on Database and then select RULES and publish these rules:

{
  "rules": {
    "answers": {
      ".indexOn": "questionId",
      ".read": true,
      ".write": "auth != null"
    },
    "questions": {
      ".indexOn": "uid",
    	".read": true,
      ".write": "auth != null"
    }
  }
}

To learn more about firebase security check the docs here.

And here are some good examples of security rules:

Change into the correct directory.

$ cd quick-questions-firebase-react-mobx

Install the node modules.

$ npm install

Start the development server.

$ npm start

About

A react app using mobx for state management and backed by firebase.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published