MERN stack + Basic JWT Authentication + Docker + Travis. My name is Justin Chen.
- Getting Started
- File Structure
- What's Included
- Testing Utilities
- NPM Scripts
- Recommendations
- Todo List
-
Install Docker. Mac users can download Docker for Mac (recommended) or Docker Toolbox. Windows users can only use Docker Toolbox.
-
Install npm. (Note: npm installation is not actually necessary since the docker image will have its own Node.js and npm instances. However, I've added some useful shorthand scripts to the package.json, making npm recommended to have. If you don't want to install npm, just directly use the docker commands aliased in the package.json)
-
Clone the project directory.
git clone https://github.com/otherchen/redux-boiler.git
-
Build the docker image. (this runs npm install inside the image and packages all the code into one neat bundle)
docker-compose build
-
Check that unit tests run.
npm run compose-tests
-
Start a docker container in development mode.
npm run compose-development
-
Open localhost:3000 to see the starter app.
- /client is where you write all of your react/redux code
- /server is where you write all of your server-side code
- /views is where you write your ejs (where you can include cdn scripts)
- /assets is where you write your sass and where you place your images
- /public is where the ejs looks for your static files (you shouldn't need to touch this)
- Dockerfile is used to define how to build your web application's Docker image
- docker-compose.yml is the base compose file used to instantiate & orchestrate the app's containers
- gulpfile.babel.js is used to create gulp tasks, specifically for building and running the entire app's code
- webpack.config.babel.js is used by webpack (in the gulpfile) to configure the bundling of client-side code
- .travis.yml is used by travis-ci to automate your continuous integration (can be removed)
- .editorconfig adheres your code editor to certain settings if the editorconfig plugin is installed (can be removed)
- react
- mongodb
- express
- node.js
- redux
- mocha
- chai
- sinon
- enzyme
- jsdom
- gulp
- webpack
- mongoose
- isomorphic-fetch
- babel (jsx/es6 support)
- jsonwebtoken
- redux-form
- redux-thunk
- docker
- travis-ci
- mocha - runner
- chai - asserts
- sinon - stubs
- enzyme - react components
- jsdom - headless browser
- mocha - runner
- chai - asserts
- sinon - stubs
- all tests should have the extension -
.spec.js
(ex. HelloWorld.spec.js) - test files can be placed anywhere but it is recommended to group them in folders with clear intentions (ex.
__test__
) - run your tests using
npm run compose-tests
- starts the app in development mode on port 3000
- starts the app in production mode on port 80
- runs the tests in development mode so you don't need to rebuild the Docker image each time you test
- used by docker to start the server (you shouldn't have to use this)
- used by docker to run the tests (you shouldn't have to use this)
- Follow Airbnb's react style guide for best practices
- Replace npm with yarn for faster installs and better memory utilization
- Add an application level build step in the Dockerfile so that in production, npm start only starts the server
- Add the supertest npm module for testing routes (integration tests)
- Create a Higher Order Component to handle checking the token on page refresh
- Implement Webpack hot reloading / Webpack dev server
- Implement Redux Router for Undo/Redo functionality