A starter project for modern React apps with Redux
:tada: A Completely updated version of my initial boilerplate :rocket:
Note: If you still want to use a previous version, please checkout old-original-structure
branch.
A boilerplate using the power and simplicity of React, Redux, Webpack 2 + HMR, and ES6 + JSX via Babel. Includes Webpack's Tree Shaking
configuration. It's suitable for scalable applications and organized using the custom variation of the Ducks pattern — approach when each module's entry file (feature-name.js
) contains all of its related constants, actions/action creators, selectors and its reducer.
The provided boilerplate is powered by the following technology stack:
flow-bin
) without breaking the project.Mocha
Support for Node.js > 5
$ git clone https://github.com/nicksp/redux-webpack-es6-boilerplate.git app-name
$ cd app-name
$ npm install
package.json
src/client/assets/index.html
There are two ways in which you can build and run the web app:
Build once for (ready for Production):
$ npm run build
$ npm run build:serve
The last command will boot up HTTP server on 3003
port and serve build/client
directory in a default browser
Hot reloading via webpack middlewares:
$ npm start
(TBD)
To execute all unit tests, use:
$ npm run test
To run unit tests continuously during development (watch tests), use:
$ npm run test:watch
Assign yourself a unique publicly accessible url that will proxy all requests to your locally running webserver.
$ npm install -g localtunnel
$ npm start
$ npm run tunnel # run in a new tab
You will receive a url, for example https://tbst.localtunnel.me
, that you can share with anyone for as long as your local instance of lt
remains active. Any requests will be routed to your local service at the specified port.
In order to get info on errors that happened in production, we integrate Sentry into our application to track errors and get context on what happened.
To use it on your side, configure it first:
/src/client/assets/javascripts/app/config.js
file assign SENTRY_KEY
and SENTRY_APP
constants values that you got after adding a new projectAllowed Domains
section under your Project Settings
on Sentry website to track errors from required domainsFor debugging purposes please use:
This starter kit implements best practices like testing (unit testing
), minification, bundling, and so on. It saves you from the long, painful process of wiring it all together into an automated dev environment and build process.
npm start
?Webpack serves your app in memory when you run npm start
. No physical files are written. However, the web root is /src
, so you can reference files under /src in index.html. When the app is built using npm run build
, physical files are written to /build
folder and the app is served from /build
.
We're handling it differently in DEV vs PROD.
When you run npm start
:
The approach above supports hot reloading, which is great for development. However, it also create a flash of unstyled content on load because you have to wait for the JavaScript to parse and load styles before they're applied. So for the production build, we use a different approach:
When you run npm run build
:
npm run build
. This will prepare and build the project for production use. It does the following:
production
so that React is built in production mode/build
directory. (This is the folder you'll expose to the world).index.html
for changescode splitting
)FAQ
section to reflect latest greatest changesnpm
scriptsMIT License, 2016
Brought to you by Nick S. Plekhanov