Ready to go monorepo frontend boilerplate for web and mobile app development. Realized with redux, redux-saga and react. Written in TypeScript.
Sometimes it is hard to deliver good quality software due to economic time pressure. With this project I tried to provide a best practise frontend boilerplate. Hopefully saving nerves of developers and other stakeholders.
To fully understand this project you should be familiar with the technologies below.
- lerna (monorepo management)
- react
- redux (with react)
- redux-saga
- jest (unit testing)
- react-test-renderer (react component testing)
- redux-saga-test-plan (integration testing)
- eslint (code linting)
- webpack (web app bundling)
- Http foundation and api template module:
- Request handling with axios library in the background
- Explicit type definitions e.g.
Request
,Response
and saga generator functions per endpoint.
- Basic jwt authentication:
- jwt
exp
in UTC time, seemock.http.request.dispatcher.ts
as the mock for several endpoints in dev mode - automatic token refresh, see
src/packages/src/common/authentication/domain/flow.ts
- ideally the authentication server responds with the
[jwtSecret]
cookie (httpOnly
andsameSite
) and[jwtHeader].[jwtPayload]
in the response body, to be protected against XSS and CSRF attacks. - auth user generally saved at session storage, when required also at local storage - according to remember me flag
- auth user type visible at
/src/packages/src/common/types/auth-user/domain/types.ts
- jwt
- Toasts integration:
- Smooth intro animation by automatically grouping new messages together
- Grouping of messages in toasts (success, info, warning, error toasts)
- Configurable options like (animation times, closable message, automatic close etc.)
- Form components in redux:
- Handling errors recursively trough every (partial) state tree (see
form
module) - Available form elements and customizable reducers (e.g. have a look at the login page's reducer)
- Handling errors recursively trough every (partial) state tree (see
- Loader integration
- Internal counter to show and hide a loader considering concurrent
showLoader
andhideLoader
calls.
- Internal counter to show and hide a loader considering concurrent
- Test integration with jest, react-test-renderer and redux-saga-test-plan
- Code linting with eslint
- More: see the docs
- Bootstrap 4 SCSS and material icons integration
- Styling with styled-components
- Dynamic browser support. Have a look at browsersl.ist (paste the content of
.browserslistrc
)
The purpose of the mobile app is a demonstration of using domain layer code in another view environment.
This was achieved by a small react native implementation of the packages/common/toaster
module.
- environment - installation, how to start development, other scripts
- architecture - structure and rules of the codebase
- coding guidelines - best practices and common conventions
- api documentation - how to use existing modules
Many thanks to the awesome react community.