A web app boilerplate with following technologies:
- Babel for ES6 syntax
- Webpack for JS bundles
- React for view components
- Redux for state handling
- PostCSS for styles
- pino for logging
- Express for dev app
- Nunjucks for server-side rendering
Stripped down version of crcd-fullstack for client-side apps (which is now deprecated, we swapped riot with react).
Browser support can be adjusted in .babelrc using babel-preset-env. Default configuration:
last 2 versions, ie >= 10
npm install npm run dev Builds static views in dev mode and then starts a development server and a webpack server which handles the hot reload. Defaults to port 3000 (with webpack in 3001).
Note The dev server only works on a modern browser.
npm run build npm run start Does the same as dev build but instead of the webpack dev server, it creates a webpack bundle. Static views are built in production mode and the express server is started. Defaults to port 8080.
NOTE: Build throws an error during first run since the build dir is missing. Shall be fixed.
Just copy and serve build/static/ and the client-side application is included in index.html.
src/: Source for server (built using Babel)config/: YAML or JSON configs for the web-serverstatic/: Static files and webpack build outputstatic-views/: Nunjucks templates to be rendered as static html files intostatic/client/: Source for client (built using Webpack)components/: Re-usable React componentsmodules/: Application modules, usually containing a React container and its components plus redux related filesredux/: Configuration for redux store and additional middlewarestyles/: Shared styles etc.utils/: Helpers etc.
build/: Build outputstatic/dist: Webpack output
.tmp/: Temp builds in dev mode
This boilerplate was originally based on React Redux Universal Hot Example. Thanks to erikras and contributors for the awesome example.
Also, Jack Hsu introduced a clever way of structuring a React app.