Chaoming-L / vortex-react

πŸš€ A React starter kit. Redux or Mobx, React-Router-dom, Webpack3, all is in.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vortex-react

Build Status JavaScript Style Guide license

Get start with React, Redux, RR4, Webpack3 πŸš€

2017/8/29 checkout branch mobx to see the version mobx instead of redux!

δΈ­ζ–‡

Table of Contents

Feature

  • React
  • ES6 + Babel
  • Webpack3
  • Redux
  • React-Router-Dom
  • Reactstrap + Bootstrap^4.0.0-alpha.6 (UI)
  • Sass
  • Eslint
  • Express

Get Start

Before the start, we recommend you read these documentation.

You can try ES6 and JSX in Babel REPL.

We recommend node 6.x + npm 5.x + yarn ^0.27.5。

Installation

git clone https://github.com/yuthelloworld/vortex-react.git <my-project-name>
cd <my-project-name>
yarn  # Install project dependencies (or `npm install`)

Running

yarn start  # Start the development server (or `npm start`)

Scripts

yarn <script> Description
start Serves your app at http://localhost:3000
build Builds the application to ./dist
lint Lints the project for potential errors
lint:fix Lints the project and fixes all correctable errors

Project Structure

File Tree

.
β”œβ”€β”€ build                    # All build-related code
β”œβ”€β”€ public                   # Static public assets (not imported anywhere in source code)
β”œβ”€β”€ server                   # Express application that provides webpack middleware
β”‚   └── main.js              # Server application entry point
β”œβ”€β”€ src                      # Application source code
β”‚   β”œβ”€β”€ index.html           # Main HTML page container for app
β”‚   β”œβ”€β”€ main.js              # Application rendering
β”‚   β”œβ”€β”€ normalize.js         # Browser normalization and polyfills
β”‚   β”œβ”€β”€ components           # Global Reusable Components
β”‚   β”œβ”€β”€ layouts              # Components that dictate major page structure
β”‚   β”‚   └── PageLayout       # Components that dictate major page structure
β”‚   β”œβ”€β”€ routes               # Components that dictate major page structure
β”‚   β”‚   β”œβ”€β”€ index.js         # Main application routes with store
β”‚   β”‚   β”œβ”€β”€ Home             # Fractal route
β”‚   β”‚   β”‚   β”œβ”€β”€ index.js     # Route definitions and async split points
β”‚   β”‚   β”‚   β”œβ”€β”€ assets       # Assets required to render components
β”‚   β”‚   β”‚   β”œβ”€β”€ components   # Presentational React Components
β”‚   β”‚   β”‚   └── routes **
β”‚   β”‚   └── Counter
β”‚   β”‚       β”œβ”€β”€ index.js
β”‚   β”‚       β”œβ”€β”€ container    # Container component
β”‚   β”‚       β”œβ”€β”€ modules      # redux module(reducers/constants/actions)
β”‚   β”‚       └── routes **
β”‚   β”œβ”€β”€ store                # Redux store
β”‚   β”‚   β”œβ”€β”€ createStore.js   # Create store
β”‚   β”‚   └── reducers.js      # Reducers
β”‚   └── styles               # Style sheet
└── tests                    # Unit tests

Data Flow

redux

Logic

vortex-react


Live Development

We use webpack-dev-middleware and webpack-hot-middleware for server and HMR 。

We recommend using Redux DevTools Chrome Extension.


Deploy

Use nginx to proxy static web to start this app。Point at ~/dist/index.html.See more。

This is an exmaple in ubuntu:

  • Install nginx:
sudo apt-get install nginx
  • Configure:
sudo vi /etc/nginx/sites-available/default
  • Copy the flowing to configure:
server{
  listen 8001;
  server_name 127.0.0.1;  //server Ip
  location / {
    proxy_pass http://127.0.0.1:3000;
  }
}
sudo service nginx restart

// cd your root file
yarn start

Code Style

Refrence airbnb/javascript、Javascript Standard Style and standard-react,we set up .eslintrc

More

Welcome PRs and issues!

About

πŸš€ A React starter kit. Redux or Mobx, React-Router-dom, Webpack3, all is in.

License:MIT License


Languages

Language:JavaScript 96.5%Language:CSS 2.8%Language:HTML 0.7%