├── .babelrc
├── .dockerignore
├── .editorconfig
├── .eslintignore
├── .eslintrc.json
├── .gitattributes
├── .gitignore
├── .prettierrc
├── Dockerfile
├── README.md
├── circle.yml
├── package.json
├── postcss.config.js
├── server.js
├── src
├── bootstrap.js
├── components
│ ├── README.md
│ ├── app
│ │ └── index.js
│ └── button
│ │ ├── index.js
│ │ └── styles.css
├── index.html.js
├── index.js
├── modules
│ ├── README.md
│ ├── auth
│ │ ├── actions.js
│ │ └── reducers.js
│ ├── reducers.js
│ └── user
│ │ ├── actions.js
│ │ ├── reducers.js
│ │ └── selectors.js
├── routes.js
├── server.js
├── services
│ ├── auth.js
│ └── user.js
├── store
│ ├── configure-store.dev.js
│ ├── configure-store.js
│ └── configure-store.prod.js
├── styles
│ └── settings
│ │ ├── _grid.css
│ │ └── settings.css
├── utils
│ ├── README.md
│ ├── request-auth.js
│ ├── request.js
│ ├── routes.js
│ └── server.js
└── views
│ ├── README.md
│ ├── github
│ ├── index.js
│ └── user.js
│ ├── home
│ ├── index.js
│ └── styles.css
│ ├── internal-server-error
│ └── index.js
│ ├── login
│ └── index.js
│ ├── not-found
│ └── index.js
│ └── restrict
│ └── index.js
├── stylelint.config.js
├── tests
└── config.test.js
├── webpack.config.js
├── webpack.config.production.js
├── webpack.config.server.js
├── webpack.config.vendor.js
├── webpack
└── _resolve.js
└── yarn.lock
/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | [
4 | "es2015",
5 | {
6 | "modules": false
7 | }
8 | ],
9 | "stage-0",
10 | "react"
11 | ],
12 | "env": {
13 | "development": {
14 | "presets": [
15 | "react-hmre", "es2015", "stage-0", "react"
16 | ]
17 | },
18 | "test": {
19 | "presets": [
20 | "es2015",
21 | "stage-0",
22 | "react"
23 | ]
24 | },
25 | "production": {
26 | "plugins": ["transform-react-inline-elements"]
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/.dockerignore:
--------------------------------------------------------------------------------
1 | node_modules
2 | .git
3 |
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | indent_style = space
5 | indent_size = 2
6 | end_of_line = lf
7 | charset = utf-8
8 | trim_trailing_whitespace = true
9 | insert_final_newline = true
10 |
11 | [*.{json,js,yml}]
12 | indent_style = space
13 | indent_size = 2
14 |
15 | [.eslintrc]
16 | indent_style = space
17 | indent_size = 2
18 |
19 | [*.md]
20 | trim_trailing_whitespace = false
21 |
--------------------------------------------------------------------------------
/.eslintignore:
--------------------------------------------------------------------------------
1 | tests/__tests__
2 |
--------------------------------------------------------------------------------
/.eslintrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "cheesecakelabs"
3 | }
4 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | npm-debug.log
3 | node_modules
4 | .nyc_output
5 | dist
6 | dist-server
7 | tests/__tests__
8 |
--------------------------------------------------------------------------------
/.prettierrc:
--------------------------------------------------------------------------------
1 | {
2 | "printWidth": 100,
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "trailingComma": "es5",
6 | "bracketSpacing": true,
7 | "jsxBracketSameLine": false,
8 | "parser": "babylon",
9 | "semi": false
10 | }
11 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:6
2 |
3 | RUN mkdir -p /usr/src/app
4 | WORKDIR /usr/src/app
5 |
6 | COPY package.json /usr/src/app/
7 | COPY yarn.lock /usr/src/app/
8 | RUN yarn
9 |
10 | COPY . /usr/src/app
11 |
12 | RUN yarn build
13 | EXPOSE 3000
14 |
15 | CMD [ "yarn", "start" ]
16 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # react-redux-boilerplate
4 | Boilerplate project for a webapp using React/Redux architecture.
5 |
6 |
7 | ## Getting started
8 |
9 | 1. Clone this repository and delete the .git folder
10 | 1. Remove/Adapt all example components if necessary:
11 | component/button
12 | modules/counter
13 | views/home
14 | routes.js
15 | 1. Run `yarn`
16 | 1. Run `yarn dev`
17 | 1. Your application is running on `http://localhost:ENV.PORT || 3000`
18 |
19 |
20 | ## Prettier
21 |
22 | ### Sublime config
23 | - Install it globally with `npm i -g prettier`
24 | - Install jsprettier package via sublime package control
25 |
26 | [Package](https://packagecontrol.io/packages/JsPrettier)
27 |
28 | ```
29 | {
30 | "prettier_cli_path": "/usr/local/bin/prettier",
31 | "node_path": "/usr/local/bin/node",
32 | "auto_format_on_save": true,
33 | "allow_inline_formatting": false,
34 | "custom_file_extensions": [],
35 | "additional_cli_args": {},
36 | "max_file_size_limit": -1,
37 | }
38 |
39 | ```
40 |
41 | ### VSCode config
42 | [Package](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
43 | ```
44 | {
45 | "prettier.eslintIntegration": true,
46 | "editor.formatOnSave": true,
47 | "typescript.check.npmIsInstalled": false,
48 | "extensions.ignoreRecommendations": true
49 | }
50 |
51 | ```
52 |
--------------------------------------------------------------------------------
/circle.yml:
--------------------------------------------------------------------------------
1 | machine:
2 | node:
3 | version: 6
4 | services:
5 | - docker
6 |
7 | dependencies:
8 | override:
9 | - yarn
10 | cache_directories:
11 | - ~/.cache/yarn
12 |
13 | test:
14 | pre:
15 | - yarn lint
16 | override:
17 | - JEST_JUNIT_OUTPUT="$CIRCLE_TEST_REPORTS/junit.xml" yarn jest -- -w 1 --testResultsProcessor jest-junit
18 |
19 | deployment:
20 | production:
21 | tag: /v[0-9]+(\.[0-9]+)*(-\w+)?/
22 | commands:
23 | - eval $(aws ecr get-login --region $AWS_REGION | sed 's|https://||')
24 | - docker build -t $DOCKER_TAG --rm=false .
25 | - docker tag $DOCKER_TAG:latest $AWS_SERVER:$CIRCLE_TAG
26 | - docker push $AWS_SERVER:$CIRCLE_TAG
27 | - pip install ecs-deploy
28 | - ecs deploy $AWS_CLUSTER $AWS_SERVICE -t $CIRCLE_TAG --timeout $AWS_ECS_TIMEOUT
29 |
30 | development:
31 | branch: staging
32 | commands:
33 | - eval $(aws ecr get-login --region $AWS_REGION | sed 's|https://||')
34 | - docker build -t $DOCKER_TAG --rm=false .
35 | - docker tag $DOCKER_TAG:latest $AWS_SERVER:$AWS_TAG_DEV
36 | - docker push $AWS_SERVER:$AWS_TAG_DEV
37 | - pip install ecs-deploy
38 | - ecs deploy $AWS_CLUSTER $AWS_SERVICE_STAGING -t $AWS_TAG_DEV --timeout $AWS_ECS_TIMEOUT
39 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "react-redux-boilerplate",
3 | "version": "0.1.0",
4 | "description": "Boilerplate project for a webapp using React/Redux architecture.",
5 | "main": "lib/index.js",
6 | "license": "MIT",
7 | "repository": "CheesecakeLabs/react-redux-boilerplate",
8 | "scripts": {
9 | "start": "node dist-server/server.js",
10 | "test": "yarn lint && yarn generate-view-tests && yarn jest",
11 | "generate-view-tests": "rm -fr ./tests/__tests__ && generate-view-tests",
12 | "tdd": "yarn jest -- --watch",
13 | "jest": "NODE_ENV=test jest",
14 | "dev": "NODE_ENV=development PORT=5000 node server.js",
15 | "build": "yarn build:client && yarn build:server",
16 | "build:client": "yarn build:vendor && yarn build:production",
17 | "build:production": "NODE_ENV=production webpack --colors --config webpack.config.production.js --hide-modules",
18 | "build:server": "NODE_ENV=production webpack --colors --config webpack.config.server.js --hide-modules",
19 | "build:vendor": "NODE_ENV=production webpack --colors --config webpack.config.vendor.js --hide-modules",
20 | "lint": "yarn eslint && yarn stylelint",
21 | "eslint": "eslint src stories tests *.js",
22 | "stylelint": "stylelint 'src/**/*.css'",
23 | "precommit": "yarn lint",
24 | "prepush": "npm test"
25 | },
26 | "jest": {
27 | "verbose": false,
28 | "transform": {
29 | ".*": "babel-jest"
30 | },
31 | "moduleNameMapper": {
32 | "^.+\\.(css)$": "identity-obj-proxy",
33 | "^.+\\.(png|svg|txt)$": "/tests/empty-module.js",
34 | "^_modules/(.*)": "/src/modules/$1",
35 | "^_components/(.*)": "/src/components/$1",
36 | "^_services/(.*)": "/src/services/$1",
37 | "^_views/(.*)": "/src/views/$1",
38 | "^_utils/(.*)": "/src/utils/$1",
39 | "^_styles/(.*)": "/src/styles/$1"
40 | },
41 | "moduleFileExtensions": [
42 | "js"
43 | ],
44 | "setupFiles": [
45 | "./tests/config.test.js"
46 | ],
47 | "testPathIgnorePatterns": [
48 | "./tests/config.test.js",
49 | "[/\\\\](dist|dist-server|node_modules|.storybook)[/\\\\]"
50 | ],
51 | "transformIgnorePatterns": [
52 | "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
53 | ]
54 | },
55 | "devDependencies": {
56 | "autoprefixer": "^6.7.7",
57 | "babel-cli": "^6.22.2",
58 | "babel-eslint": "^7.2.3",
59 | "babel-jest": "^19.0.0",
60 | "babel-loader": "^6.2.10",
61 | "babel-plugin-transform-react-inline-elements": "^6.22.0",
62 | "babel-preset-es2015": "^6.22.0",
63 | "babel-preset-react": "^6.22.0",
64 | "babel-preset-react-hmre": "^1.1.1",
65 | "babel-preset-stage-0": "^6.5.0",
66 | "babel-register": "^6.9.0",
67 | "compression-webpack-plugin": "^0.3.2",
68 | "css-loader": "^0.26.2",
69 | "enzyme": "^2.8.2",
70 | "eslint": "^3.19.0",
71 | "eslint-config-cheesecakelabs": "^2.0.3",
72 | "extract-text-webpack-plugin": "^2.1.0",
73 | "husky": "^0.13.2",
74 | "identity-obj-proxy": "^3.0.0",
75 | "jest": "^20.0.4",
76 | "jest-junit": "^1.5.1",
77 | "postcss-css-variables": "^0.7.0",
78 | "postcss-import": "^9.1.0",
79 | "postcss-loader": "^1.3.3",
80 | "postcss-nested": "^1.0.0",
81 | "react-addons-test-utils": "^15.5.1",
82 | "react-test-renderer": "^15.5.4",
83 | "redux-logger": "^2.6.1",
84 | "style-loader": "^0.14.1",
85 | "stylelint": "^7.10.1",
86 | "stylelint-config-standard": "^16.0.0",
87 | "webpack": "^3.5.5",
88 | "webpack-dev-middleware": "^1.6.1",
89 | "webpack-hot-middleware": "^2.10.0",
90 | "webpack-manifest-plugin": "^1.1.0"
91 | },
92 | "dependencies": {
93 | "@cheesecakelabs/boilerplate": "^0.5.0",
94 | "@cheesecakelabs/fetch": "^2.1.1",
95 | "express": "^4.15.4",
96 | "express-static-gzip": "^0.3.0",
97 | "immutable": "^3.8.1",
98 | "normalize.css": "^7.0.0",
99 | "normalizr": "^3.2.3",
100 | "prop-types": "^15.5.10",
101 | "react": "^15.6.1",
102 | "react-dom": "^15.6.1",
103 | "react-immutable-proptypes": "^2.1.0",
104 | "react-redux": "^5.0.4",
105 | "react-router": "^3.0.5",
106 | "react-router-redux": "^4.0.8",
107 | "redux": "^3.7.2",
108 | "redux-define": "^1.1.1",
109 | "redux-promise-middleware": "^4.3.0",
110 | "redux-thunk": "^2.2.0",
111 | "reselect": "^3.0.1",
112 | "suitcss-components-grid": "^3.0.3",
113 | "suitcss-utils-after": "^1.0.1",
114 | "suitcss-utils-before": "^1.0.1",
115 | "suitcss-utils-offset": "^1.0.0",
116 | "suitcss-utils-size": "^2.0.0"
117 | }
118 | }
119 |
--------------------------------------------------------------------------------
/postcss.config.js:
--------------------------------------------------------------------------------
1 | const webpack = require('webpack')
2 | const autoprefixer = require('autoprefixer')
3 | const postCSSImport = require('postcss-import')
4 | const postCSSNested = require('postcss-nested')
5 | const postCssCssVariables = require('postcss-css-variables')()
6 |
7 | const postCSSAutoprefixer = autoprefixer({ browsers: ['IE 9', 'iOS 7'] })
8 |
9 | const postCssImport = postCSSImport({
10 | addDependencyTo: webpack,
11 | })
12 |
13 | module.exports = {
14 | plugins: [postCssImport, postCSSAutoprefixer, postCSSNested, postCssCssVariables],
15 | }
16 |
--------------------------------------------------------------------------------
/server.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const webpack = require('webpack')
3 | const webpackDevMiddleware = require('webpack-dev-middleware')
4 | const webpackHotMiddleware = require('webpack-hot-middleware')
5 |
6 | const config = require('./webpack.config')
7 | const baseHTML = require('./src/index.html')
8 |
9 | const ip = '0.0.0.0'
10 | const port = process.env.PORT || 3000
11 | const app = express()
12 | const compiler = webpack(config)
13 |
14 | app.use(
15 | webpackDevMiddleware(compiler, {
16 | publicPath: config.output.publicPath,
17 | stats: 'errors-only',
18 | })
19 | )
20 |
21 | app.use(webpackHotMiddleware(compiler))
22 |
23 | // index.html links to 2
20 |
21 |