Rainmaker UI app structure
Rainmaker GitHub URL:Â Â
https://github.com/egovernments/frontend
Primary development branch: develop
Production branch : master
Tech stack used in Rainmaker App:-
- React JS -Â https://reactjs.org/
- Redux -Â https://redux.js.org/
- Material UI -Â https://material-ui.com/
- Javascript
- CSS/SASS
Dev tools:-
- Lerna -Â https://lernajs.io/
- Babel -Â https://babeljs.io/
- Webpack -Â https://webpack.js.org/
Citizen & Employee Apps (Packages module → \egov-web-app\web\rainmaker\packages\citizen)
- Both are independently running react apps, deployed in production
- What it contains?
- It has Landing page, profile and all user-specific components like OTP, Login, Forgot password as its native routes.
- It imports all the modules(eg. PGR, PT, TL, etc) as a package in its node-modules.
- The citizen and Employee apps provide the basic layout - The header with ULB name and Logo, and the left side navigation bar
- The content area is rendered from respective modules.
Egov-UI-Kit (Dev-Packages → \egov-web-app\web\rainmaker\dev-packages\)
- It's a common utility package, was made from the beginning of our first module PGR
- What it contains?
- A component library, with all the UI elements being used in PGR and PT can be found here.
- React HOCs - for controlling authorization access of the components at the top level(withAuthorization.js, withoutAuthorization.js), Creating components with all form related actions attached in a generic way, including all data population in dropdowns, managing onField change, onClick actions, dynamic creation of API request body and API calls onSubmit. (form.js, withData.js). It is mainly used in PGR and PT.Â
- The component Library contains UI elements(eg. Textfields, dropdowns, map, Radio Buttons, etc) which can be reused anywhere.
- The components are made on top of Material UI (version 0.20.1), with some customizations as per the existing Rainmaker design and theme we follow. (Mainly used in PGR and PT).
Egov-UI-Framework (Dev-Packages → \egov-web-app\web\rainmaker\dev-packages\)
- A UI Framework to provide similar form based screens and other reusable UIs with consistent designs, all achieved just by writing JSON configs.
- The framework was made in the later part of our journey of rainmaker, it's use can be found in the modules starting from TL.Â
- The Framework also contains the updated material UI (4.1.3) component library similar to the one in egov-ui-kit.
- For more information - Please refer the detailed documentation on egov-ui-framework.
Other Dev-Package Modules (Dev-packages → \egov-web-app\web\rainmaker\dev-packages)
- All packages inside dev-packages are independently runnable and deployable react apps
- What it contains?Â
- All the module specific contents resides here.
- It also contains their respective login, OTP, and other user-info pages for separate deployment purpose. (Not being used currently)
- The modules like PGR and PT, which has huge differences between citizen and employee interface are kept separate.
- Other modules are common for both Citizen and Employee.Â
- The apps are written in javascript ES6 version.
- These modules are transpiled and converted to ES5 version so that it can be imported and used in our citizen and employee apps as a node module.
Cloning, Transpiling, Bundling, and Running apps locally:-
- Clone rainmaker from the remote repo:Â Â
- git cloneÂ
- Switch path to \egov-web-app\web\rainmaker
- Run "yarn install"  → to install all required dependencies in rainmaker app
- Run "yarn run go" → what it does?Â
- It first builds CSS and sass files for all the modules.
- Transpiles all the packages present inside the dev-package folder to ES5 version and put them in lib folder inside packages.
- When all the transpiled packages are available in /packages/lib, Lerna works on soft-linking the dependencies for each module including citizen and employee package.
- Lerna goes inside all the packages mentioned in the lerna.json file and maps the dependencies required by them to their node-modules. Thus by soft-linking the dependencies and putting them in the respective node-modules, it is made sure that all dependencies are available to be used wherever required.
- In case of Mutex error do yarn run go until it gets successful , it happens in the first time installation due to weak internet connections
- After successful completion of above steps, The apps are ready to run.
- For running apps:Â
- Citizen app: "yarn run dev:citizen"
- Employee app: "yarn run dev:employee"
- Individual apps: move to /dev-packages/..." and run "yarn start"
- Bundling of files is done by webpack.Â