Project Structure
Let us explore the general Project Structure of the Apps provided by mockBee templates.
All Apps that you intend to build using mockBee's backend will have the following Project Structure after the installation process.
my-projectβββ node_modulesβββ publicβ βββ index.htmlβ βββfavicon.icoβ βββ ...βββ srcβ βββ App.jsxβ βββ App.css| βββ index.jsβ βββ index.cssβ βββ server.jsβ βββ backendβ βββ controllersβ βββ Controller1.jsβ βββ Controller2.jsβ βββ dbβ βββ Database1.jsβ βββ Database2.jsβ βββ utilsβ βββ Utility1.jsβββ package.jsonβββ README.mdβββ yarn.lockProject Structure Rundown#
As you must have already observed, this is a typical Create-React-App with some extra capabilities.
/publicis the Page Template/src/index.jsis the entry point
You can delete or rename the other files.
Below are the files related to Mock Backend. You don't need to worry much about what goes inside these files; we have abstracted it already for you!
/src/server.jscontains the backend server entry point./src/backendcontains/controllerscontains various Controller functions for handling various actions based on the requested route./dbcontains of Database that will be made available to the app/utilscontains various utility modular functions that are used across the backend
You can refer README.md file for more insights about the project you are working on.
Project Dependencies#
- React and ReactDOM - Frontend Library
- MirageJS - API Mocking Library
- jwt-encode, jwt-decode - For JWT Authentication
- uuid - For generating random IDs
- day-js - For date formatting
- mockman-js - For Testing APIs in the Browser
Feel free to extend the dependencies by installing more by running:
npm i package-nameyarn add package-nameWinding Up#
The Project Structure is made keeping in mind that you can create your frontend flexibly. Other folders for frontend such as components, pages, redux, context etc. can be added by following the general CRA project structure practices.