├── static ├── logo.png ├── header.jpg ├── school.jpg └── screenshot.png ├── .gitignore ├── now.json ├── nodemon.json ├── src ├── client │ ├── dataloading │ │ └── index.js │ ├── reducers │ │ ├── index.js │ │ ├── counter.js │ │ └── github-users.js │ ├── store │ │ ├── index.js │ │ └── createStore.js │ ├── constants.js │ ├── components │ │ ├── BlockContainer │ │ │ └── index.js │ │ ├── Footer │ │ │ └── index.js │ │ ├── Core │ │ │ └── index.js │ │ ├── FadeIn │ │ │ └── index.js │ │ ├── Navbar │ │ │ └── index.js │ │ └── Header │ │ │ └── index.js │ ├── containers │ │ ├── GithubUsers │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── index.js │ │ ├── Counter │ │ │ ├── index.js │ │ │ └── components │ │ │ │ └── index.js │ │ ├── NotFound │ │ │ └── index.js │ │ ├── ServerError │ │ │ └── index.js │ │ ├── Home │ │ │ └── index.js │ │ └── About │ │ │ └── index.js │ ├── index.js │ ├── bundle.js │ ├── actions │ │ └── index.js │ ├── registerServiceWorker.js │ └── app.js └── server │ ├── templates │ ├── index.prod.pug │ └── index.dev.pug │ └── index.js ├── .babelrc ├── .github └── main.workflow ├── .eslintrc ├── LICENSE ├── .all-contributorsrc ├── package.json ├── CODE_OF_CONDUCT.md ├── webpack.config.babel.js ├── CONTRIBUTING.md └── README.md /static/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbhargav5/react-universal-starter/HEAD/static/logo.png -------------------------------------------------------------------------------- /static/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbhargav5/react-universal-starter/HEAD/static/header.jpg -------------------------------------------------------------------------------- /static/school.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbhargav5/react-universal-starter/HEAD/static/school.jpg -------------------------------------------------------------------------------- /static/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/imbhargav5/react-universal-starter/HEAD/static/screenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | 3 | #dist 4 | 5 | tmp 6 | lib 7 | 8 | .DS_Store 9 | package-lock.json 10 | -------------------------------------------------------------------------------- /now.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-universal-starter", 3 | "alias": "react-universal-starter.imbhargav5.com", 4 | "type": "npm", 5 | "version": 1 6 | } 7 | -------------------------------------------------------------------------------- /nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "verbose": true, 3 | "ignore": ["tmp"], 4 | "execMap": { 5 | "js": "-r @babel/register" 6 | }, 7 | "watch": ["src/server"] 8 | } 9 | -------------------------------------------------------------------------------- /src/client/dataloading/index.js: -------------------------------------------------------------------------------- 1 | import { fetchGithubUsers } from "../actions"; 2 | 3 | export const LoadGithubUsers = store => { 4 | return store.dispatch(fetchGithubUsers()); 5 | }; 6 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | "@babel/preset-env", 4 | "babel-preset-imbhargav5", 5 | "@babel/preset-react" 6 | ], 7 | "plugins": ["react-hot-loader/babel", "dynamic-import-webpack"] 8 | } 9 | -------------------------------------------------------------------------------- /src/client/reducers/index.js: -------------------------------------------------------------------------------- 1 | import { combineReducers } from "redux"; 2 | import counter from "./counter"; 3 | import githubUsers from "./github-users"; 4 | 5 | export default combineReducers({ 6 | counter, 7 | githubUsers 8 | }); 9 | -------------------------------------------------------------------------------- /src/client/store/index.js: -------------------------------------------------------------------------------- 1 | import createStore from "./createStore"; 2 | import rootReducer from "../reducers"; 3 | 4 | const preloadedState = window.__PRELOADED_STATE__ || {}; 5 | export default createStore(rootReducer, preloadedState); 6 | -------------------------------------------------------------------------------- /src/client/constants.js: -------------------------------------------------------------------------------- 1 | export const INCREMENT = "INCREMENT"; 2 | export const DECREMENT = "DECREMENT"; 3 | export const FETCHING_GITHUB_USERS = "FETCHING_GITHUB_USERS"; 4 | export const FETCHED_GITHUB_USERS = "FETCHED_GITHUB_USERS"; 5 | export const FETCH_GITHUB_USERS_FAIL = "FETCH_GITHUB_USERS_FAIL"; 6 | -------------------------------------------------------------------------------- /src/client/components/BlockContainer/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | 4 | const Container = styled.div`padding: 1em;`; 5 | const CentredContainer = styled(Container)` 6 | text-align: center; 7 | `; 8 | export { CentredContainer }; 9 | export default Container; 10 | -------------------------------------------------------------------------------- /src/client/reducers/counter.js: -------------------------------------------------------------------------------- 1 | import { INCREMENT, DECREMENT } from "../constants"; 2 | 3 | export default function counter(state = 0, { type }) { 4 | switch (type) { 5 | case INCREMENT: 6 | return state + 1; 7 | case DECREMENT: 8 | return state - 1; 9 | default: 10 | return state; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/server/templates/index.prod.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta(charset="utf-8") 5 | title Summer 6 | link(rel="shortcut icon", type="image/png", href="/logo.png") 7 | link(rel="shortcut icon", type="image/png", href="http://localhost:8888/favicon.png") 8 | != styles 9 | body 10 | #app!=content 11 | -------------------------------------------------------------------------------- /src/client/containers/GithubUsers/index.js: -------------------------------------------------------------------------------- 1 | import { connect } from "react-redux"; 2 | import { fetchGithubUsers } from "../../actions"; 3 | import GithubUsers from "./components"; 4 | 5 | function mapStateToProps(state) { 6 | return { 7 | githubUsers: state.githubUsers 8 | }; 9 | } 10 | const mapDispatchToProps = { 11 | fetchGithubUsers 12 | }; 13 | 14 | export default connect(mapStateToProps, mapDispatchToProps)(GithubUsers); 15 | -------------------------------------------------------------------------------- /src/client/containers/Counter/index.js: -------------------------------------------------------------------------------- 1 | import CounterComponent from "./components"; 2 | import { connect } from "react-redux"; 3 | import { incrementCounter, decrementCounter } from "../../actions"; 4 | 5 | function mapStateToProps(state) { 6 | return { 7 | value: state.counter 8 | }; 9 | } 10 | const mapDispatchToProps = { 11 | incrementCounter, 12 | decrementCounter 13 | }; 14 | 15 | export default connect(mapStateToProps, mapDispatchToProps)(CounterComponent); 16 | -------------------------------------------------------------------------------- /src/server/templates/index.dev.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | meta(charset="utf-8") 5 | title Summer 6 | link(rel="shortcut icon", type="image/png", href="/logo.png") 7 | link(rel="shortcut icon", type="image/png", href="http://localhost:8888/favicon.png") 8 | != styles 9 | body 10 | #app!=content 11 | script(src="http://localhost:8888/vendor.bundle.js", charset="utf-8") 12 | script(src="http://localhost:8888/main.bundle.js", charset="utf-8") 13 | -------------------------------------------------------------------------------- /src/client/components/Footer/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { CentredContainer as Container } from "../BlockContainer"; 4 | import styled from "styled-components"; 5 | 6 | const Text = styled.p` 7 | padding: 1em; 8 | `; 9 | 10 | const Footer = ({ className }) => ( 11 | 12 | 13 | Made with ❤️ by imbhargav5 14 | 15 | 16 | ); 17 | Footer.propTypes = { 18 | className: PropTypes.string 19 | }; 20 | 21 | export default Footer; 22 | -------------------------------------------------------------------------------- /src/client/store/createStore.js: -------------------------------------------------------------------------------- 1 | import { applyMiddleware, compose, createStore } from "redux"; 2 | import ReduxThunk from "redux-thunk"; 3 | 4 | export default function(rootReducer, preloadedState) { 5 | const middlewares = [ReduxThunk]; 6 | const store = createStore( 7 | rootReducer, 8 | preloadedState, 9 | compose( 10 | applyMiddleware(...middlewares), 11 | // redux browser extension 12 | typeof window === "object" && 13 | typeof window.devToolsExtension !== "undefined" 14 | ? window.devToolsExtension() 15 | : f => f 16 | ) 17 | ); 18 | return store; 19 | } 20 | -------------------------------------------------------------------------------- /src/client/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { BrowserRouter } from "react-router-dom"; 3 | // hydrate is responsible for server rendering going forward 4 | import { hydrate as render } from "react-dom"; 5 | import App from "./app"; 6 | import { Provider } from "react-redux"; 7 | import store from "./store"; 8 | import registerServiceWorker from "./registerServiceWorker"; 9 | 10 | render( 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById("app") 17 | ); 18 | 19 | registerServiceWorker(); 20 | 21 | // Hot Module Replacement API 22 | if (module.hot) { 23 | module.hot.accept(); 24 | } 25 | -------------------------------------------------------------------------------- /src/client/components/Core/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import { CentredContainer as Container } from "../BlockContainer"; 4 | import styled from "styled-components"; 5 | 6 | const Inner = styled.div`padding: 1em 0em;`; 7 | const Outer = styled.div` 8 | background-color: #f9f9f9; 9 | padding: 1em 0; 10 | height: 100%; 11 | overflow: auto; 12 | `; 13 | 14 | const Core = ({ className, children }) => ( 15 | 16 | 17 | {children} 18 | 19 | 20 | ); 21 | Core.propTypes = { 22 | className: PropTypes.string, 23 | children: PropTypes.any 24 | }; 25 | 26 | export default Core; 27 | -------------------------------------------------------------------------------- /src/client/components/FadeIn/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | 4 | const FadeIn = styled.div` 5 | opacity: ${props => (props.visible ? "1" : "0")}; 6 | position: relative; 7 | top: ${props => (props.visible ? "0" : "60px")}; 8 | transition: all 1s ease; 9 | `; 10 | 11 | class FadeInWrapper extends Component { 12 | state = { 13 | visible: false 14 | }; 15 | componentDidMount() { 16 | setTimeout(() => { 17 | this.setState({ 18 | visible: true 19 | }); 20 | }, 200); 21 | } 22 | render() { 23 | return ; 24 | } 25 | } 26 | 27 | export default FadeInWrapper; 28 | -------------------------------------------------------------------------------- /src/client/bundle.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | 3 | export default function bundle(getComponent) { 4 | return class AsyncComponent extends React.Component { 5 | static Component = null; 6 | state = { Component: AsyncComponent.Component }; 7 | 8 | componentDidMount() { 9 | if (!this.state.Component) { 10 | getComponent() 11 | .then(module => module.default || module) 12 | .then(Component => { 13 | AsyncComponent.Component = Component; 14 | this.setState({ Component }); 15 | }); 16 | } 17 | } 18 | render() { 19 | const { Component } = this.state; 20 | if (Component) { 21 | return ; 22 | } 23 | return null; 24 | } 25 | }; 26 | } 27 | -------------------------------------------------------------------------------- /src/client/containers/NotFound/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | 4 | const Heading = styled.h1`font-size: 3em;`; 5 | const Message = styled.p` 6 | font-style: italic; 7 | max-width: 80%; 8 | margin: 1em auto; 9 | `; 10 | 11 | const Banner = styled.img` 12 | height: auto; 13 | width: 300px; 14 | max-width: 80%; 15 | margin: auto; 16 | `; 17 | 18 | class NotFoundPage extends Component { 19 | render() { 20 | return ( 21 |
22 | Oops! 23 | This is not the page you are looking for 24 | 25 |
26 | ); 27 | } 28 | } 29 | 30 | export default NotFoundPage; 31 | -------------------------------------------------------------------------------- /src/client/reducers/github-users.js: -------------------------------------------------------------------------------- 1 | import { 2 | FETCHING_GITHUB_USERS, 3 | FETCHED_GITHUB_USERS, 4 | FETCH_GITHUB_USERS_FAIL 5 | } from "../constants"; 6 | 7 | export default function githubUsers( 8 | state = { 9 | isLoading: false, 10 | data: null, 11 | error: null 12 | }, 13 | { type, payload } 14 | ) { 15 | switch (type) { 16 | case FETCHING_GITHUB_USERS: 17 | return { 18 | isLoading: true, 19 | error: null, 20 | data: null 21 | }; 22 | case FETCHED_GITHUB_USERS: 23 | return { 24 | isLoading: false, 25 | error: null, 26 | data: payload.data 27 | }; 28 | case FETCH_GITHUB_USERS_FAIL: 29 | return { 30 | isLoading: false, 31 | data: null, 32 | error: payload.error 33 | }; 34 | default: 35 | return state; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /.github/main.workflow: -------------------------------------------------------------------------------- 1 | workflow "Deploy Master" { 2 | on = "push" 3 | resolves = ["release-master"] 4 | } 5 | 6 | # Filter for master branch 7 | action "master-branch-filter" { 8 | uses = "actions/bin/filter@master" 9 | args = "branch master" 10 | } 11 | 12 | action "yarn-install" { 13 | uses = "borales/actions-yarn@master" 14 | args = "install" 15 | } 16 | 17 | # Deploy, and write deployment to file 18 | action "deploy" { 19 | needs = "yarn-install" 20 | uses = "actions/zeit-now@master" 21 | args = "deploy --no-clipboard --team imbhargav5 > $HOME/$GITHUB_ACTION.txt" 22 | secrets = ["ZEIT_TOKEN"] 23 | } 24 | 25 | # Always create an alias using the SHA 26 | action "alias" { 27 | needs = "deploy" 28 | uses = "actions/zeit-now@master" 29 | args = "alias --team imbhargav5 `cat /github/home/deploy.txt` $GITHUB_SHA" 30 | secrets = ["ZEIT_TOKEN"] 31 | } 32 | 33 | # Requires now.json in repository 34 | action "release-master" { 35 | needs = ["master-branch-filter", "alias"] 36 | uses = "actions/zeit-now@master" 37 | secrets = ["ZEIT_TOKEN"] 38 | args = "alias --team imbhargav5" 39 | } 40 | -------------------------------------------------------------------------------- /.eslintrc: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "node":true, 5 | "es6":true, 6 | "jest":true 7 | }, 8 | "globals": { 9 | "require": true, 10 | "module":true, 11 | "window":true, 12 | "$":true, 13 | "jQuery" : true 14 | }, 15 | "extends": ["eslint:recommended","plugin:react/recommended"], 16 | "parser": "babel-eslint", 17 | "rules": { 18 | "semi": [0], 19 | "no-constant-condition":[2], 20 | "no-undef" : [2], 21 | "no-dupe-args":[2], 22 | "no-unreachable":[1], 23 | "no-cond-assign":[2], 24 | "no-dupe-keys":[1], 25 | "prefer-const":[1], 26 | "no-const-assign":[2], 27 | "no-duplicate-imports":[2], 28 | "no-useless-constructor":[1], 29 | "no-class-assign":[2], 30 | "no-confusing-arrow":[2], 31 | "constructor-super":[2], 32 | "prefer-spread":[1], 33 | "no-lonely-if":[1], 34 | "no-continue":[1], 35 | "no-redeclare":[0], 36 | "comma-dangle":[0], 37 | "no-extra-semi":[0], 38 | "no-console":[0], 39 | "no-mixed-spaces-and-tabs":[0], 40 | }, 41 | "plugins": [ 42 | "react" 43 | ] 44 | } 45 | -------------------------------------------------------------------------------- /src/client/containers/Counter/components/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | 5 | const Button = styled.button` 6 | /* Adapt the colours based on primary prop */ 7 | background: ${props => (props.primary ? "palevioletred" : "white")}; 8 | color: ${props => (props.primary ? "white" : "palevioletred")}; 9 | font-size: 1em; 10 | margin: 1em; 11 | padding: 0.5em 1em; 12 | border: 2px solid palevioletred; 13 | border-radius: 3px; 14 | `; 15 | 16 | class CounterComponent extends Component { 17 | static propTypes = { 18 | value: PropTypes.number, 19 | increment: PropTypes.func, 20 | decrement: PropTypes.func 21 | }; 22 | render() { 23 | return ( 24 |
25 |

26 | {this.props.value} 27 |

28 | 31 | 32 |
33 | ); 34 | } 35 | } 36 | 37 | export default CounterComponent; 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Bhargav Ponnapalli 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/client/containers/ServerError/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | import PropTypes from "prop-types"; 4 | 5 | const Heading = styled.h2`font-size: 2em;`; 6 | const Status = styled.h1` 7 | font-size: 3em; 8 | color: gold; 9 | `; 10 | const Message = styled.p` 11 | font-style: italic; 12 | max-width: 80%; 13 | margin: 1em auto; 14 | `; 15 | 16 | const Banner = styled.img` 17 | height: auto; 18 | width: 300px; 19 | max-width: 80%; 20 | margin: auto; 21 | `; 22 | 23 | class ServerError extends Component { 24 | static propTypes = { 25 | location: PropTypes.object.isRequired 26 | }; 27 | render() { 28 | const { state = {} } = this.props.location; 29 | const { status = 500 } = state; 30 | return ( 31 |
32 | 33 | {status} 34 | 35 | Oops! 36 | 37 | We messed up! Our team of monkeys are on it right now! 38 | 39 | 40 |
41 | ); 42 | } 43 | } 44 | 45 | export default ServerError; 46 | -------------------------------------------------------------------------------- /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "react16-router4-redux-universal", 3 | "projectOwner": "imbhargav5", 4 | "files": [ 5 | "README.md" 6 | ], 7 | "imageSize": 100, 8 | "commit": true, 9 | "contributors": [ 10 | { 11 | "login": "imbhargav5", 12 | "name": "Bhargav Ponnapalli", 13 | "avatar_url": "https://avatars2.githubusercontent.com/u/2936644?v=4", 14 | "profile": "http://github.com/imbhargav5", 15 | "contributions": [ 16 | "code" 17 | ] 18 | }, 19 | { 20 | "login": "tagraha", 21 | "name": "Tirta Nugraha", 22 | "avatar_url": "https://avatars0.githubusercontent.com/u/3034375?v=4", 23 | "profile": "http://www.betotally.com/", 24 | "contributions": [ 25 | "code" 26 | ] 27 | }, 28 | { 29 | "login": "negati-ve", 30 | "name": "Ned.", 31 | "avatar_url": "https://avatars3.githubusercontent.com/u/13253073?v=4", 32 | "profile": "http://Negative.co.in", 33 | "contributions": [ 34 | "doc" 35 | ] 36 | }, 37 | { 38 | "login": "rishabh-327", 39 | "name": "rishabh-327", 40 | "avatar_url": "https://avatars2.githubusercontent.com/u/41268157?v=4", 41 | "profile": "https://github.com/rishabh-327", 42 | "contributions": [ 43 | "code" 44 | ] 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /src/client/actions/index.js: -------------------------------------------------------------------------------- 1 | import fetch from "isomorphic-fetch"; 2 | import { 3 | INCREMENT, 4 | DECREMENT, 5 | FETCHING_GITHUB_USERS, 6 | FETCHED_GITHUB_USERS, 7 | FETCH_GITHUB_USERS_FAIL 8 | } from "../constants"; 9 | 10 | export function incrementCounter() { 11 | return { 12 | type: INCREMENT 13 | }; 14 | } 15 | 16 | export function decrementCounter() { 17 | return { 18 | type: DECREMENT 19 | }; 20 | } 21 | 22 | export function fetchingGithubUsers() { 23 | return { 24 | type: FETCHING_GITHUB_USERS, 25 | payload: {} 26 | }; 27 | } 28 | export function fetchedGithubUsers(data) { 29 | return { 30 | type: FETCHED_GITHUB_USERS, 31 | payload: { 32 | data 33 | } 34 | }; 35 | } 36 | export function fetchGithubUsersFail(error) { 37 | return { 38 | type: FETCH_GITHUB_USERS_FAIL, 39 | payload: { 40 | error 41 | } 42 | }; 43 | } 44 | 45 | export function fetchGithubUsers() { 46 | return (dispatch, getState) => { 47 | const state = getState(); 48 | if (state.githubUsers.data) { 49 | return; 50 | } 51 | dispatch(fetchingGithubUsers()); 52 | return fetch("https://api.github.com/users") 53 | .then(data => data.json()) 54 | .then(data => { 55 | return dispatch(fetchedGithubUsers(data)); 56 | }) 57 | .catch(error => { 58 | return dispatch(fetchGithubUsersFail(error)); 59 | }); 60 | }; 61 | } 62 | -------------------------------------------------------------------------------- /src/client/components/Navbar/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import { Route, Link, Redirect, Switch } from "react-router-dom"; 3 | import styled from "styled-components"; 4 | 5 | const Nav = styled.div` 6 | display: flex; 7 | flex-direction: column; 8 | justify-content: center; 9 | `; 10 | 11 | const NavItem = styled.div` 12 | padding: 10px 10px 10px 0; 13 | margin-right: 5px; 14 | font-size: 1em; 15 | ${StyledLink} { 16 | font-weight: bold; 17 | color: ${props => (props.active ? "#46b0ed" : "#515f71")}; 18 | transition: color 1s ease; 19 | } 20 | `; 21 | 22 | const StyledLink = styled(Link)` 23 | text-decoration: none; 24 | color: inherit; 25 | `; 26 | 27 | const NavLink = ({ to, ...rest }) => ( 28 | { 31 | return ( 32 | 33 | 34 | 35 | ); 36 | }} 37 | /> 38 | ); 39 | 40 | class Navbar extends Component { 41 | render() { 42 | return ( 43 |
44 | 53 |
54 | ); 55 | } 56 | } 57 | 58 | export default Navbar; 59 | -------------------------------------------------------------------------------- /src/client/components/Header/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | import Container from "../BlockContainer"; 5 | import Navbar from "../Navbar"; 6 | 7 | const Outer = styled.div` 8 | background-color: #fff; 9 | padding-bottom: 1em; 10 | `; 11 | 12 | const Inner = styled.div` 13 | text-align: left; 14 | border-bottom: 1px dashed black; 15 | margin-bottom: 1em; 16 | padding: 1em 0; 17 | `; 18 | 19 | const Box = styled.div` 20 | display: flex; 21 | flex-direction: column; 22 | align-items: flex-start; 23 | `; 24 | 25 | const Heading = styled.h1` 26 | color: #303233; 27 | font-size: 2em; 28 | padding: 0; 29 | margin: 0 0 16px; 30 | line-height: 1; 31 | `; 32 | 33 | const Subheading = styled.h3` 34 | color: #515f71; 35 | font-weight: 100; 36 | opacity: 0.7; 37 | padding: 0; 38 | padding-bottom: 4px; 39 | margin: 0; 40 | line-height: 1; 41 | `; 42 | 43 | const BuiltWith = styled.p` 44 | color: #46b0ed; 45 | font-size: 1em; 46 | text-align: left; 47 | margin-bottom: 0; 48 | `; 49 | 50 | const Header = ({ className }) => ( 51 | 52 | 53 | 54 | 55 | React Starter 56 | For the ever evolving front end stack 57 | 58 | 59 | 60 | React 16+, React Router 4+, Webpack 3+ 61 | 62 | 63 | ); 64 | Header.propTypes = { 65 | className: PropTypes.string 66 | }; 67 | export default Header; 68 | -------------------------------------------------------------------------------- /src/client/containers/GithubUsers/components/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import PropTypes from "prop-types"; 3 | import styled from "styled-components"; 4 | 5 | const Avatar = styled.img` 6 | /* Adapt the colours based on primary prop */ 7 | margin: 1em 1em 0; 8 | height: 90px; 9 | width: 90px; 10 | border: 2px solid palevioletred; 11 | border-radius: 50%; 12 | `; 13 | 14 | const User = styled.a` 15 | display: inline-block; 16 | margin-bottom: 1em; 17 | `; 18 | 19 | const UserName = styled.p` 20 | margin-top: 0.5em; 21 | `; 22 | 23 | class GithubUsers extends Component { 24 | static propTypes = { 25 | fetchGithubUsers: PropTypes.func.isRequired, 26 | githubUsers: PropTypes.object.isRequired, 27 | history: PropTypes.object.isRequired 28 | }; 29 | componentDidMount() { 30 | this.props.fetchGithubUsers(); 31 | } 32 | 33 | renderContent() { 34 | const { data, isLoading, error } = this.props.githubUsers; 35 | if (isLoading) { 36 | return

Please wait ...

; 37 | } 38 | if (error) { 39 | return

Fetch failed

; 40 | } 41 | if (Array.isArray(data)) { 42 | return data.map(user => ( 43 | 44 | 45 | {user.login} 46 | 47 | )); 48 | } 49 | return null; 50 | } 51 | render() { 52 | return ( 53 |
54 |

Github Users

55 | {this.renderContent()} 56 |
57 | ); 58 | } 59 | } 60 | 61 | export default GithubUsers; 62 | -------------------------------------------------------------------------------- /src/client/containers/Home/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | 4 | const Heading = styled.h1` 5 | font-size: 3em; 6 | `; 7 | const Subheading = styled.h2` 8 | font-size: 2em; 9 | padding: 1em 0; 10 | `; 11 | class Home extends Component { 12 | render() { 13 | return ( 14 |
15 | React Universal Starter 16 | Made possible with these awesome projects 17 |
18 | Styled components{" "} 24 | React{" "} 30 | Redux{" "} 36 | webpack{" "} 42 | babel{" "} 48 | nodemon 54 |
55 |
56 | ); 57 | } 58 | } 59 | 60 | export default Home; 61 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-universal-starter", 3 | "version": "2.0.0", 4 | "main": "index.js", 5 | "author": "Bhargav Ponnapalli (https://github.com/imbhargav5)", 6 | "license": "MIT", 7 | "scripts": { 8 | "add-contributor": "all-contributors add", 9 | "generate-contributor": "all-contributors generate", 10 | "build": "npm run build:server && npm run build:client", 11 | "build:client": "cross-env NODE_ENV=production webpack --mode production", 12 | "build:server": "cross-env NODE_ENV=production babel src --out-dir tmp/lib", 13 | "prebuild": "npm run clean", 14 | "clean": "rimraf tmp lib", 15 | "dev": "cross-env NODE_ENV=development nodemon --exec babel-node src/server", 16 | "start": "cross-env NODE_ENV=production node tmp/lib/server", 17 | "deploy": "now --team imbhargav5 && now --team imbhargav5 alias" 18 | }, 19 | "dependencies": { 20 | "@babel/core": "7.3.3", 21 | "express": "4.16.4", 22 | "isomorphic-fetch": "2.2.1", 23 | "prop-types": "^15.5.10", 24 | "pug": "^2.0.0-rc.3", 25 | "react": "16.8.2", 26 | "react-dom": "16.8.2", 27 | "react-redux": "^5.0.6", 28 | "react-router": "4.2.0", 29 | "react-router-dom": "4.2.2", 30 | "redux": "4.0.1", 31 | "redux-thunk": "2.3.0", 32 | "styled-components": "4.1.3", 33 | "webpack-hot-middleware": "2.21.2" 34 | }, 35 | "devDependencies": { 36 | "@babel/node": "7.2.2", 37 | "@babel/preset-env": "7.3.1", 38 | "@babel/preset-react": "7.0.0", 39 | "@babel/register": "7.0.0", 40 | "all-contributors-cli": "^4.4.0", 41 | "babel-eslint": "8.2.2", 42 | "babel-loader": "8.0.5", 43 | "babel-plugin-dynamic-import-webpack": "^1.0.1", 44 | "babel-preset-imbhargav5": "3.0.0", 45 | "babel-register": "6.26.0", 46 | "copy-webpack-plugin": "4.5.1", 47 | "cross-env": "^5.2.0", 48 | "eslint-plugin-react": "^7.3.0", 49 | "html-webpack-plugin": "3.0.6", 50 | "html-webpack-pug-plugin": "0.3.0", 51 | "nodemon": "^1.11.0", 52 | "npm-run-all": "^4.0.2", 53 | "react-hot-loader": "next", 54 | "rimraf": "^2.6.1", 55 | "sw-precache-webpack-plugin": "0.11.5", 56 | "uglifyjs-webpack-plugin": "1.2.4", 57 | "webpack": "4.29.4", 58 | "webpack-cli": "3.2.3", 59 | "webpack-dev-middleware": "3.5.2" 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /src/client/containers/About/index.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import styled from "styled-components"; 3 | 4 | const Heading = styled.h1`font-size: 3em;`; 5 | const Lipsum = styled.p` 6 | font-style: italic; 7 | max-width: 80%; 8 | margin: 1em auto; 9 | `; 10 | 11 | class About extends Component { 12 | render() { 13 | return ( 14 |
15 | About 16 | 17 | Leo nullam arcu scelerisque hendrerit consectetur cum ullamcorper a 18 | hac erat turpis ac a hac porttitor suspendisse et a ac tristique. A 19 | eros neque integer fermentum pulvinar ut ullamcorper himenaeos a 20 | taciti commodo a nam nibh vel nunc mi praesent quam duis quam cursus 21 | sociosqu. Dictumst at eros cursus a sed mus cubilia adipiscing 22 | parturient ante hendrerit in litora felis leo. Lacinia vestibulum 23 | adipiscing vehicula etiam tortor maecenas felis vestibulum adipiscing 24 | rhoncus a suspendisse leo scelerisque ultrices elit parturient. 25 | 26 | 27 | Lorem mi tempus turpis quis adipiscing ac ipsum dui convallis dui 28 | class hendrerit ante neque dignissim taciti vestibulum libero 29 | tincidunt. Quis ligula suscipit non euismod ridiculus rhoncus 30 | vestibulum nec consectetur scelerisque imperdiet commodo diam erat 31 | orci dictum sapien malesuada per senectus a adipiscing. At nunc a 32 | vestibulum id adipiscing praesent tristique purus in est a parturient 33 | ullamcorper hac condimentum suspendisse a eget praesent cum in 34 | adipiscing natoque ullamcorper praesent non. Mus a vestibulum 35 | parturient eget nulla duis nunc fusce ipsum eu dapibus vivamus quam 36 | tempus a vestibulum platea maecenas sociis amet facilisis adipiscing 37 | consectetur ullamcorper neque dui nisl. A sem magna litora ad a 38 | condimentum scelerisque dui sociosqu ornare id a posuere dictum ad 39 | habitant netus a pretium nisi a torquent a vestibulum. Condimentum 40 | commodo duis rhoncus commodo a aptent sit ante urna in scelerisque 41 | parturient natoque augue ultricies diam eu ac. 42 | 43 |
44 | ); 45 | } 46 | } 47 | 48 | export default About; 49 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. 6 | 7 | ## Our Standards 8 | 9 | Examples of behavior that contributes to creating a positive environment include: 10 | 11 | * Using welcoming and inclusive language 12 | * Being respectful of differing viewpoints and experiences 13 | * Gracefully accepting constructive criticism 14 | * Focusing on what is best for the community 15 | * Showing empathy towards other community members 16 | 17 | Examples of unacceptable behavior by participants include: 18 | 19 | * The use of sexualized language or imagery and unwelcome sexual attention or advances 20 | * Trolling, insulting/derogatory comments, and personal or political attacks 21 | * Public or private harassment 22 | * Publishing others' private information, such as a physical or electronic address, without explicit permission 23 | * Other conduct which could reasonably be considered inappropriate in a professional setting 24 | 25 | ## Our Responsibilities 26 | 27 | Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. 28 | 29 | Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. 30 | 31 | ## Scope 32 | 33 | This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. 34 | 35 | ## Enforcement 36 | 37 | Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at bhargavponnapalli.5@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. 38 | 39 | Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. 40 | 41 | ## Attribution 42 | 43 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] 44 | 45 | [homepage]: http://contributor-covenant.org 46 | [version]: http://contributor-covenant.org/version/1/4/ 47 | -------------------------------------------------------------------------------- /webpack.config.babel.js: -------------------------------------------------------------------------------- 1 | import webpack from "webpack"; 2 | import path from "path"; 3 | import HtmlWebpackPugPlugin from "html-webpack-pug-plugin"; 4 | import HtmlWebpackPlugin from "html-webpack-plugin"; 5 | import CopyWebpackPlugin from "copy-webpack-plugin"; 6 | import UglifyJSPlugin from "uglifyjs-webpack-plugin"; 7 | import SWPrecacheWebpackPlugin from "sw-precache-webpack-plugin"; 8 | 9 | const env = { 10 | prod: process.env.NODE_ENV !== "development", 11 | dev: process.env.NODE_ENV === "development" 12 | }; 13 | // utilities to add features based on env 14 | const addEntity = (add, entity) => { 15 | return add ? entity : undefined; 16 | }; 17 | const ifProd = entity => addEntity(env.prod, entity); 18 | const ifDev = entity => addEntity(env.dev, entity); 19 | const removeEmpty = array => array.filter(i => !!i); 20 | 21 | const PUBLIC_PATH = env.prod ? "/" : "http://localhost:8888/"; 22 | 23 | // set contentBase 24 | const contentBase = env.prod 25 | ? __dirname + "/tmp/static" 26 | : __dirname + "/src/client"; 27 | 28 | export default { 29 | mode: process.env.NODE_ENV, 30 | entry: removeEmpty([ 31 | ifDev("react-hot-loader/patch"), 32 | ifDev("webpack-hot-middleware/client"), 33 | path.join(__dirname, "src/client/index.js") 34 | ]), 35 | output: { 36 | path: path.join(__dirname, "tmp/static"), 37 | filename: env.prod ? "[name].[chunkhash].js" : "[name].bundle.js" 38 | }, 39 | devtool: env.dev ? "eval-source-map" : "source-map", 40 | module: { 41 | rules: [ 42 | { 43 | test: /\.js$/, 44 | exclude: /node_modules/, 45 | use: ["babel-loader"], 46 | include: path.join(__dirname, "./src/client") 47 | } 48 | ] 49 | }, 50 | plugins: removeEmpty([ 51 | ifDev(new webpack.HotModuleReplacementPlugin()), 52 | ifProd( 53 | new HtmlWebpackPlugin({ 54 | title: "Summer", 55 | filename: "templates/index.pug", 56 | template: path.join(__dirname, "src/server/templates/index.prod.pug") 57 | }) 58 | ), 59 | ifProd(new HtmlWebpackPugPlugin()), 60 | ifProd( 61 | new CopyWebpackPlugin([ 62 | { 63 | from: "static" 64 | } 65 | ]) 66 | ), 67 | ifProd( 68 | new UglifyJSPlugin({ 69 | sourceMap: true 70 | }) 71 | ), 72 | new SWPrecacheWebpackPlugin({ 73 | cacheId: "react-universal-starter", 74 | dontCacheBustUrlsMatching: /\.\w{8}\./, 75 | filename: "service-worker.js", 76 | minify: true, 77 | navigateFallback: PUBLIC_PATH + "index.html", 78 | staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/] 79 | }) 80 | ]), 81 | optimization: { 82 | occurrenceOrder: env.prod ? true : false, 83 | splitChunks: { 84 | cacheGroups: { 85 | commons: { 86 | chunks: "initial", 87 | minChunks: 2, 88 | maxInitialRequests: 5, // The default limit is too small to showcase the effect 89 | minSize: 0 // This is example is too small to create commons chunks 90 | }, 91 | vendor: { 92 | test: /node_modules/, 93 | chunks: "initial", 94 | name: "vendor", 95 | priority: 10, 96 | enforce: true 97 | } 98 | } 99 | } 100 | } 101 | }; 102 | -------------------------------------------------------------------------------- /src/server/index.js: -------------------------------------------------------------------------------- 1 | import path from "path"; 2 | import fs from "fs"; 3 | import React from "react"; 4 | import { renderToString } from "react-dom/server"; 5 | import express from "express"; 6 | import webpack from "webpack"; 7 | import webpackDevMiddleware from "webpack-dev-middleware"; 8 | import webpackHotMiddleware from "webpack-hot-middleware"; 9 | import { StaticRouter as Router } from "react-router"; 10 | import { matchPath } from "react-router-dom"; 11 | import { Provider } from "react-redux"; 12 | import { ServerStyleSheet } from "styled-components"; 13 | import App, { loadData } from "../client/app"; 14 | import createStore from "../client/store/createStore"; 15 | import rootReducer from "../client/reducers"; 16 | 17 | // Environment variables 18 | const isDevelopment = process.env.NODE_ENV === "development"; 19 | 20 | // Create app 21 | const app = express(); 22 | 23 | //set port 24 | const port = process.env.PORT || 8888; 25 | 26 | // set statics 27 | const staticPath = path.join(__dirname, "../../", "static"); 28 | 29 | if (isDevelopment) { 30 | const webpackConfig = require("../../webpack.config.babel.js").default; 31 | const compiler = webpack(webpackConfig); 32 | app.use( 33 | webpackDevMiddleware(compiler, { 34 | logLevel: "warn", 35 | publicPath: webpackConfig.output.publicPath, 36 | historyApiFallback: true 37 | }) 38 | ); 39 | app.use( 40 | webpackHotMiddleware(compiler, { 41 | log: console.log, 42 | heartbeat: 4 * 1000 43 | }) 44 | ); 45 | } 46 | 47 | app.use(express.static(staticPath)); 48 | 49 | // set view engine 50 | app.set("view engine", "pug"); 51 | // set views directory 52 | if (isDevelopment) { 53 | app.set("views", path.join(__dirname, "templates")); 54 | } else { 55 | app.set("views", path.join(__dirname, "../../", "static/templates")); 56 | } 57 | 58 | //Root html template 59 | let indexTemplate = "index.dev.pug"; 60 | if (!isDevelopment) { 61 | indexTemplate = "index"; 62 | } 63 | 64 | const context = {}; 65 | 66 | function render(req, res, err) { 67 | // setting counter initial value to 5 68 | const store = createStore(rootReducer, { 69 | counter: 5 70 | }); 71 | const promises = []; 72 | loadData.some(route => { 73 | // use `matchPath` here 74 | const match = matchPath(req.path, route); 75 | if (match) { 76 | if (route.loadData) { 77 | promises.push(route.loadData(store, match, req.url)); 78 | } 79 | } 80 | return match; 81 | }); 82 | Promise.all(promises).then(() => { 83 | const sheet = new ServerStyleSheet(); 84 | let html = renderToString( 85 | sheet.collectStyles( 86 | 87 | 88 | 89 | 90 | 91 | ) 92 | ); 93 | 94 | html += ` 95 | 98 | `; 99 | const styleTags = sheet.getStyleTags(); 100 | // This renders html as well as a concatenated string list of style tags 101 | res.render(indexTemplate, { 102 | content: html, 103 | styles: styleTags 104 | }); 105 | }); 106 | } 107 | 108 | // add routes 109 | app.get("/throw", (req, res, next) => { 110 | next(new Error("we messed up")); 111 | }); 112 | 113 | app.get("*", (req, res) => { 114 | render(req, res); 115 | }); 116 | 117 | if (isDevelopment) { 118 | app.use(function(err, req, res, next) { 119 | res.status(err.status || 500); 120 | res.redirect("/500"); 121 | }); 122 | } 123 | 124 | // start app 125 | app.listen(port, () => { 126 | console.info( 127 | `🌎 Listening on port ${port} in ${process.env.NODE_ENV} mode on Node ${ 128 | process.version 129 | }.` 130 | ); 131 | if (isDevelopment) { 132 | console.info(`Open http://localhost:8888`); 133 | } 134 | }); 135 | -------------------------------------------------------------------------------- /src/client/registerServiceWorker.js: -------------------------------------------------------------------------------- 1 | // In production, we register a service worker to serve assets from local cache. 2 | 3 | // This lets the app load faster on subsequent visits in production, and gives 4 | // it offline capabilities. However, it also means that developers (and users) 5 | // will only see deployed updates on the "N+1" visit to a page, since previously 6 | // cached resources are updated in the background. 7 | 8 | // To learn more about the benefits of this model, read https://goo.gl/KwvDNy. 9 | // This link also includes instructions on opting out of this behavior. 10 | 11 | const isLocalhost = Boolean( 12 | window.location.hostname === "localhost" || 13 | // [::1] is the IPv6 localhost address. 14 | window.location.hostname === "[::1]" || 15 | // 127.0.0.1/8 is considered localhost for IPv4. 16 | window.location.hostname.match( 17 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ 18 | ) 19 | ); 20 | 21 | export default function register() { 22 | if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { 23 | window.addEventListener("load", () => { 24 | const swUrl = `/service-worker.js`; 25 | 26 | if (!isLocalhost) { 27 | // Is not local host. Just register service worker 28 | registerValidSW(swUrl); 29 | } else { 30 | // This is running on localhost. Lets check if a service worker still exists or not. 31 | checkValidServiceWorker(swUrl); 32 | } 33 | }); 34 | } 35 | } 36 | 37 | function registerValidSW(swUrl) { 38 | navigator.serviceWorker 39 | .register(swUrl) 40 | .then(registration => { 41 | registration.onupdatefound = () => { 42 | const installingWorker = registration.installing; 43 | installingWorker.onstatechange = () => { 44 | if (installingWorker.state === "installed") { 45 | if (navigator.serviceWorker.controller) { 46 | // At this point, the old content will have been purged and 47 | // the fresh content will have been added to the cache. 48 | // It's the perfect time to display a "New content is 49 | // available; please refresh." message in your web app. 50 | console.log("New content is available; please refresh."); 51 | } else { 52 | // At this point, everything has been precached. 53 | // It's the perfect time to display a 54 | // "Content is cached for offline use." message. 55 | console.log("Content is cached for offline use."); 56 | } 57 | } 58 | }; 59 | }; 60 | }) 61 | .catch(error => { 62 | console.error("Error during service worker registration:", error); 63 | }); 64 | } 65 | 66 | function checkValidServiceWorker(swUrl) { 67 | // Check if the service worker can be found. If it can't reload the page. 68 | fetch(swUrl) 69 | .then(response => { 70 | // Ensure service worker exists, and that we really are getting a JS file. 71 | if ( 72 | response.status === 404 || 73 | response.headers.get("content-type").indexOf("javascript") === -1 74 | ) { 75 | // No service worker found. Probably a different app. Reload the page. 76 | navigator.serviceWorker.ready.then(registration => { 77 | registration.unregister().then(() => { 78 | window.location.reload(); 79 | }); 80 | }); 81 | } else { 82 | // Service worker found. Proceed as normal. 83 | registerValidSW(swUrl); 84 | } 85 | }) 86 | .catch(() => { 87 | console.log( 88 | "No internet connection found. App is running in offline mode." 89 | ); 90 | }); 91 | } 92 | 93 | export function unregister() { 94 | if ("serviceWorker" in navigator) { 95 | navigator.serviceWorker.ready.then(registration => { 96 | registration.unregister(); 97 | }); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | When contributing to this repository, please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a code of conduct, please follow it in all your interactions with the project. 7 | 8 | ## Pull Request Process 9 | 10 | 1. Ensure any install or build dependencies are removed before the end of the layer when doing a 11 | build. 12 | 2. Update the README.md with details of changes to the interface, this includes new environment 13 | variables, exposed ports, useful file locations and container parameters. 14 | 3. Increase the version numbers in any examples files and the README.md to the new version that this 15 | Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/). 16 | 4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you 17 | do not have permission to do that, you may request the second reviewer to merge it for you. 18 | 19 | ## Code of Conduct 20 | 21 | ### Our Pledge 22 | 23 | In the interest of fostering an open and welcoming environment, we as 24 | contributors and maintainers pledge to making participation in our project and 25 | our community a harassment-free experience for everyone, regardless of age, body 26 | size, disability, ethnicity, gender identity and expression, level of experience, 27 | nationality, personal appearance, race, religion, or sexual identity and 28 | orientation. 29 | 30 | ### Our Standards 31 | 32 | Examples of behavior that contributes to creating a positive environment 33 | include: 34 | 35 | * Using welcoming and inclusive language 36 | * Being respectful of differing viewpoints and experiences 37 | * Gracefully accepting constructive criticism 38 | * Focusing on what is best for the community 39 | * Showing empathy towards other community members 40 | 41 | Examples of unacceptable behavior by participants include: 42 | 43 | * The use of sexualized language or imagery and unwelcome sexual attention or 44 | advances 45 | * Trolling, insulting/derogatory comments, and personal or political attacks 46 | * Public or private harassment 47 | * Publishing others' private information, such as a physical or electronic 48 | address, without explicit permission 49 | * Other conduct which could reasonably be considered inappropriate in a 50 | professional setting 51 | 52 | ### Our Responsibilities 53 | 54 | Project maintainers are responsible for clarifying the standards of acceptable 55 | behavior and are expected to take appropriate and fair corrective action in 56 | response to any instances of unacceptable behavior. 57 | 58 | Project maintainers have the right and responsibility to remove, edit, or 59 | reject comments, commits, code, wiki edits, issues, and other contributions 60 | that are not aligned to this Code of Conduct, or to ban temporarily or 61 | permanently any contributor for other behaviors that they deem inappropriate, 62 | threatening, offensive, or harmful. 63 | 64 | ### Scope 65 | 66 | This Code of Conduct applies both within project spaces and in public spaces 67 | when an individual is representing the project or its community. Examples of 68 | representing a project or community include using an official project e-mail 69 | address, posting via an official social media account, or acting as an appointed 70 | representative at an online or offline event. Representation of a project may be 71 | further defined and clarified by project maintainers. 72 | 73 | ### Enforcement 74 | 75 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 76 | reported by contacting the project team at bhargavponnapalli.5@gmail.com. All 77 | complaints will be reviewed and investigated and will result in a response that 78 | is deemed necessary and appropriate to the circumstances. The project team is 79 | obligated to maintain confidentiality with regard to the reporter of an incident. 80 | Further details of specific enforcement policies may be posted separately. 81 | 82 | Project maintainers who do not follow or enforce the Code of Conduct in good 83 | faith may face temporary or permanent repercussions as determined by other 84 | members of the project's leadership. 85 | 86 | ### Attribution 87 | 88 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 89 | available at [http://contributor-covenant.org/version/1/4][version] 90 | 91 | [homepage]: http://contributor-covenant.org 92 | [version]: http://contributor-covenant.org/version/1/4/ 93 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-universal-starter 2 | [![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors) 3 | 4 | The popular front end stack today is changing fast with React, react-router and webpack releasing newer versions. This is a starter app aimed to demonstrate how to integrate `babel@7`, `react@16`,`react-router@4` and `webpack@4`. 5 | 6 | 7 | Styled components React Redux webpack babel nodemon 8 | 9 | ## [Link](https://react-universal-starter.now.sh) 10 | 11 | ## Screenshot 12 | 13 | Screenshot 14 | 15 | ## Features 16 | 17 | This project comes with the following features 18 | 19 | - [x] React 16 20 | - [x] React Router 4 21 | - [x] Webpack 3 22 | - [x] Babel 23 | - [x] Server rendering 24 | - [x] Redux integration 25 | - [x] Dynamic imports 26 | - [x] Chunk splitting 27 | - [x] Styled components 28 | - [x] Nodemon 29 | 30 | ## Installation 31 | 32 | ```bash 33 | git clone git@github.com:imbhargav5/react-universal-starter.git 34 | cd react-universal-starter 35 | npm install 36 | ``` 37 | 38 | ## Usage 39 | 40 | To run app in **dev** mode 41 | 42 | ```bash 43 | npm run dev 44 | ``` 45 | 46 | The app should be running on `http://localhost:8888/` 47 | 48 |
49 | 50 | To run app in **production** mode 51 | 52 | ```bash 53 | npm build 54 | npm start 55 | ``` 56 | The app should be running on `http://localhost:8888/` 57 | 58 |
59 | 60 | To clean and rebuild 61 | 62 | ```bash 63 | npm run build 64 | ``` 65 | 66 | ## Available build scripts 67 | 68 | | `npm run