strues / react-universal-boiler

A bold way to begin your next great universal React application. Uses Webpack 3, React 16, Redux, and more for a great developer experience.
MIT License
65 stars 11 forks source link
boilerplate react redux server-side-rendering ssr universal-javascript universal-react webpack

React Universal Boiler

styled with prettier Build Status codecov

Features

Demo

https://boiler.strues.io

Usage

Development

Getting up and running for development is easy.

git clone git@github.com:strues/react-universal-boiler.git

cd react-universal-boiler

Install the dependencies yarn.

Copy the env file cp .env.example .env.

Start development yarn dev and your universal React application is running on port 3000.

Production

Running the two commands below will compile your application and serve the production ready build.

Build: yarn build

Run: yarn start

Env Variables

PORT=3000
# where assets will be "served" from
PUBLIC_PATH=/assets/
# Entry file for Webpack on the server
SERVER_ENTRY=src/entry/server.js
# Entry file for the client
CLIENT_ENTRY=src/entry/client.js
# Output directory for clientside 
CLIENT_OUTPUT=build/assets
# Output directory for the server bundle
SERVER_OUTPUT=build

Notes

Configuring the development DLLs is handled in tools/webpack/createWebpackConfig.js at the bottom in the AutoDLLWebpackPlugin options. Adding dependencies here allows Webpack to bundle them once, and not again during development. This dramatically speeds up rebundle times.

For production, this is handled for you by comparing imports to what's in node_modules.

This boilerplate uses babel 7, which is currently in beta. If you plan on using babel-plugin-transform-decorators-legacy, please see the Planning for Babel 7, particularly Stage 3: Class Properties (from Stage 2)

Resources

Alternatives

Contributing

Pull requests are welcome and encouraged. If I made a mistake, raise an issue and/or fix it and submit a PR. Have a question? I'll do what I can to answer it for you.