How It Works
Gravity uses a standard Model-View-Controller pattern with a RESTFUL API. Controllers and models are written in Node.js while the views are built with React.
Adding your own views and features is a simple 4 step process:
- Create a new model in /models that contains your database queries
- Create a new controller in /controller that handles the server request and calls the appropriate method in the model
- Create a new endpoint in /api.js to route the request to your controller method
- Create a new React view in /client/src/views that makes the API request.
Gravity Core is built with React & Node v12 with following dependencies:
- bcrypt 3.0.0
- client-sessions 0.8.0
- express 4.16.3
- jsonwebtoken 8.5.0
- mailgun-js 0.20.0
- mysql 2.16.0
- randomstring 1.1.5
- stripe 6.3.0
- axios: 0.19.0
- node-sass 4.12.0
- react: 16.8.6
- react-chartjs-2 2.7.6
- react-dom 16.8.6
- react-router-dom 5.0.0
- react-sripts 3.0.0
- react-stripe-elements 3.0.0
Routes & API
The page routes are handled by React in /client/src/app/app.js
API routes are defined in /api.js
Routes are handled by the controllers located in the /controller directory.
Models are located in the /model directory.
There are separate models for:
Views contain the different interfaces presented to the user and are located in the /client/src/views directory.
Let's go ahead and start the installation process now.Install Node.js