Get your React application up and running under 2 minutes!
I wrote a blog post on why I created this boilerplate and thoughts that went into it.
- The React and related libraries are updated to the latest version as of 10/10/2017
- The client side is hooked up with Redux! 09/10/2017
- The app runs in Docker! 11/08/2017
-
Make sure you have
node
andnpm
installed, if not refer to below. -
Alternatively, use yarn for faster dependency installation and more stable dependency management. You can use
yarn
in the place ofnpm
.$ yarn install
instead of
$ npm install
- Instructions for installation: https://yarnpkg.com/lang/en/docs/install/
-
Clone the repository.
- Using SSH (recommended):
$ git clone git@github.com:MisaOgura/react-express-docker-boilerplate.git
- Using HTTPS:
$ git clone https://github.com/MisaOgura/react-express-docker-boilerplate.git
-
Move into the cloned directory.
$ cd react-express-docker-boilerplate
-
Install dependencies.
$ npm/yarn install
-
Run the app locally in a development mode.
$ npm/yarn run dev
- The development mode comes with a "watch" functionality. Changes made either to the client side and the server side are immediately detected and the app is re-bundled / re-started automatically.
-
Run the app locally in a production mode.
$ npm/yarn start
- The production mode bundles the app into a much smaller size.
-
Visit
http://localhost:8080/
: you should see ahello world
message. -
Use the repo as a starting point of your app!
This project comes Docker ready out of the box. Docker is a software container platform. A Docker image contains information on everything required to make an app run. This self-contained system makes it extremely easy to ensure that your app runs on any OS without worrying about the dependency compatibility.
Regardless of where it’s deployed, your app will always run the same as long as Docker is installed on the machine.
-
Install Docker: https://docs.docker.com/engine/installation/
-
Clone the repo and move into the directory (see above)
-
Run the app in Docker.
$ ./run-app-in-docker.sh
-
Yep, that's it. Visit
http://localhost:8080/
to checkout the app.
The project uses Jest as a test runner. It comes with useful features like parallel testing, intelligent test watching and coverage report.
-
Install dependencies, if you haven't done yet.
-
Run all the tests once.
$ npm/yarn test
- Also runs
standard
(JavaScript Standard Style) at the end to highlight any linting errors.
- Also runs
-
Run tests in a watch mode.
$ npm/yarn test:watch
Happy TDD!
Please feel free to raise PRs or open issues to help improve the boilerplate.
Misa Ogura