/react-production-starter

:key: React boilerplate with isomorphic rendering, async react-router routes, async redux reducers, async data fetching, and code-splitting.

Primary LanguageJavaScriptMIT LicenseMIT

React Production Starter

Build Status

An example react application (master-detail feed) with isomorphic rendering, async react-router routes, async redux reducers, async data fetching, and code-splitting.

Motivation

The file size of isomorphic React apps can quickly get out of hand. Many isomorphic starter kits look awesome to begin with but yield a several megabyte javascript file for the client to download. This project aims to demonstrate some possible solutions.

Under the Hood

Inspiration

Folder Structure:

.
├── /build/                     # The folder for compiled output
├── /node_modules/              # 3rd-party libraries and utilities
├── /src/                       # The source code of the application
│   ├── /components/            # Global React components
│   ├── /middleware/            # Redux middleware (comes with callAPIMiddileware)
│   ├── /routes/                # **React-router routes (i.e. mini-redux-apps)** (:fire:)
│   ├── /server/                # Server
│   |   ├── /api/               # API endpoints
│   |   |   ├── /posts.js       # Posts endpoint
│   |   |   ├── /post.js        # Single Post endpoint
│   |   ├── /fakeDB.js          # Database Stub
│   |   ├── /server.js          # Express app
│   |   └── /index.js           # Server entry point (with babel-register)
│   ├── /client.js              # Client-side entry point
│   ├── /constants.js           # Global constants (action types)
│   ├── /createReducer.js       # Like rootReducer, but async
│   ├── /store.js               # Async store configuration
│   ├── /style.js               # Global style/layout constants
├── /test/                      # Mocha tests (e.g. xxx_spec.js)
├── /coverage/                  # Code coverage data
│── .env                        # **Server-side configuration variables**
│── Procfile                    # Heroku startup commands
│── package.json                # The list of 3rd party libraries and utilities and NPM scripts
│── webpack.config.dev.js       # Webpack Development Configuration File
└── webpack.config.prod.js      # Webpack Production Configuration File

Getting started

git clone https://github.com/jaredpalmer/react-production-starter MyApp
cd MyApp
npm install
npm start

# Open localhost:5000

More docs soon. PRs welcome!