Architecture

root

src
├── index.html
├─> styles
├─> img
├─> fonts
└─> app
FileDescription
index.htmlMain html file this file will be processed with HtmlWebpackPlugin, which will add links for javascript and css files.
imgFolder for image assets.
fontsFolder for fonts assets.
stylesFolder for css files, here we can specify root styles mixins and variables. By default it uses bootstrap.
appFolder for your javascript code.

app

app
├─> common
├─> layouts
├─> pages
├─> store
├── App.js
├── api.js
├── index.js
├── init.js
├── polyfills.js
└── routes.js
FileDescription
commonFolder for cross project reusable components and helper functions
layoutsFolder for layout components
pagesFolder for pages components
storeFolder for redux middle-wares actions and reducers
App.jsRoot React component
api.jsFile to define module for HTTP request
init.jsFile with global redux configurations and main application imports such as polyfills, styles, ext.
polyfills.jsFile with polyfills for cross browsers support
routes.jsFile with root routes JSON configs
index.jsentry point of react application

common

common
├─> forms
├─> router
├─> session
├─> utils
└─> widgets
FileDescription
formsFolder for form code. For more information read here
routerFolder for navigation code. For more information read here
sessionFolder for level access code. For more information read here
utilsFolder for cross application helpers functoins
widgetsFolder for cross application React components

pages

We recommend you to use router-based architecture. This architecture is the most suitable for easy scalling large applications. The main idea is to group your code based on screens. Also you can group some screens in some folder if it has some logical common things. For example session authorisation screens such as Login, SignUp, ForgotPassword.... can be grouped togather in auth folder.

Each page folder folder can consist from next files:

pages
└─> auth
├── index.js
├─> login
│ ├── Login.js
│ ├── LoginView.js
│ ├── index.js
│ ├── login.scss
│ ├─> utils
│ ├─> widgets
│ └── withLogin.js
└── routes.js

Please, pay attantion that all files inside login folder should consist login in their name.

FileDescription
index.jsentry point
routes.jsFile with JSON configs for this page. For more information read here
utilsFolder for cross page helpers functoins
widgetsFolder for cross page React components
login.scssPage styles. This file should be same as folder name, in case folder name is cammelcase, use -, for example user-profile.scss
withLogin.jsJS file to describe all HOC's
LoginView.jsReact Component for Login form. Mostly this should be pure function that returns JSX. All props and logic should be defined in withLogin.js file
Login.jsFile that combine LoginView and withLogin
LoginPage.jsLayout file for login page