GithubHelp home page GithubHelp logo

hhy5277 / reactgo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from reactgo/reactgo

0.0 1.0 0.0 2.47 MB

Your One-Stop solution for a full-stack universal Redux App!

License: MIT License

JavaScript 94.95% CSS 5.05%

reactgo's Introduction

reactGo

Dependency Status devDependency Status Gitter npm version

Deploy

Your One-Stop solution for a full-stack app with ES6/ES2015 React.js featuring universal Redux, React Router, React Router Redux Hot reloading, CSS modules, Express 4.x, and multiple ORMs. ๐Ÿš€

Formerly known as choonkending/react-webpack-node

Demo site: https://demo-reactgo.herokuapp.com/

Features:

  • isomorphic universal Rendering

  • Redux Predictive state containers.

  • Server-side rendering with React Router 3.x. Having server-side rendering allows you to pre-render the initial state of your components when a user (or search engine crawler) requests a page.

  • Integrating Redux with React Router with Redux Simple Router React Router Redux

  • Asynchronous Data Fetching on server-side rendering

  • Server side authentication + Redirecting for components

  • Hot reloading using react-transform-hmr

  • Time travel using Redux-Devtools Chrome Extension

  • Webpack 4 for both development and production bundles. It's (in my opinion) the best bundler for JS, CSS, LESS, images, and lots more!

  • CSS Modules allows for modular and reusable CSS. Say goodbye to conflicts (most of them) and global scope

  • Unit Testing with jsdom, mocha, sinon & enzyme

    • Reducers
    • Components (Enzyme)
    • Synchronous and Asynchronous Actions
  • Express 4.x server with a ton of middleware

  • Mongoose for MongoDB

  • Sequelize for Postgres

  • Procfile to enable deployment to Heroku & Docs on Salt configurations + Deployment for Digital Ocean

Motivation

The motivation is simple: best practices and a wonderful development experience. Our ultimate goal is to provide a boilerplate for building non-trivial applications that are secure, performant and free of bugs. Believing a mixture of React.js, Webpack and Node was the best way to accomplish this, we created react-webpack-node.

react-webpack-node also works great as a learning tool for anyone interested in learning how to implement a large React application, or those who want a modern setup ASAP.

We've had extensive community additions to this boilerplate over time as practices have evolved, and are always interested in hearing new ideas or contributions.

Why Redux

We're really big fans of this implementation of flux for state management. The main principles of having:

  • a single store
  • state being read-only (you have to express an intent to mutate being creating actions)
  • mutations written as pure functions

make it very fun and easy to write predictable code! There's a ton of reasons why, but you should head to the Redux docs to dive in!

Or if you are more of a visual learner watch the free egghead video series narrated by the creator of redux:

  1. Getting Started
  2. Building Idiomatically

Data Flow

A simplistic representation of data flow from server to client is:

Express app.use() receives a request
-> Calls a pre-built webpack file for the server
-> Runs matching of routes in react-router for server
-> Makes async data fetching request
-> Renders Route component to string
-> Construct HTML file (with Meta, Link tags using helmet)
-> Browser receives html file with initial state
-> Client side React.JS kicks in and initializes with given state
-> Continues where it left off
-> Everyone is happy :)

More TBD

Redux DevTools

You will have to install redux devtools extension from here and then everything should just work!

Instructions

Database

We currently support MongoDB and Postgres, as well as the ability to not use any database. Learn about how to configure your app.

Development

Development is a breeze. Once you have installed all your dependencies all the configuration is done for you. using simple The process is outlined here.

Building the application

# Build the application for development
npm run build

# Build the application for production
npm run build:dev

Running the application

# Run in development mode (with hot-reloading)
npm run dev

# Run in production mode
npm start

Unit Tests

Testing with:

  • mocha as the test framework
    • We find all the files we need that have a -test.js suffix in the /app directory.
  • jsdom as my test environment
# Run test once
npm test

# Run in watch mode
npm test:watch

We have unit tests for async (redux) actions, reducers, and stateless components with enzyme.

Deployment

Currently we support Heroku and Digital Ocean and AWS

Roadmap

We have an outline of our roadmap here

Yeoman Generator

If you like using yeoman generators, you could check out this cool yeoman generator by @iiegor!

FAQ

We have assembled an FAQ here

Check out what people have done

We have a list of projects that have been created with this boilerplate. Check them out to see what can be done or to get some inspiration.

How to Contribute:

Best way to keep up to date is check the issues. I really welcome improvements for all aspects of an app.

  1. Any suggestions/improvements/bugs can be in the form of Pull Requests, or creating an issue.
  2. Coding guidelines:

Credits to webpack-server-side-example, example-app, flux-examples, node-express-mongo-demo, hackathon-starter, web-starter-kit, awesome material-ui, alt and iso, react-starter, reap, isomorphic-redux-app and mxstbr/react-boilerplate

Easter Eggs ๐Ÿฅš

This boilerplate has gone through an evolution

React.js -> Facebook Flux -> Alt -> Redux

We have two implementations of universal flux:

  • Redux is on our active master branch
  • Alt (previously implemented) on flux/alt branch. It features iso, react-router and ImmutableJS.

Note: If you have previously used an alt implementation of this repository, please refer to this branch. I will not be updating it as frequently as master, but definitely welcome suggestions!

License

MIT

reactgo's People

Contributors

18601673727 avatar ajihyf avatar alubbe avatar astrobinary avatar avloss avatar benwiley4000 avatar caranicas avatar charlieclark avatar choonkending avatar christiearcus avatar colinlmcdonald avatar danstn avatar davidalee avatar dbburgess avatar ggalansmithee avatar greenkeeperio-bot avatar hsin421 avatar huyphamily avatar iiegor avatar joonhocho avatar jrodl3r avatar mjewell avatar noreemag avatar psimyn avatar sahewat avatar stefanwerw avatar twolfe2 avatar westleyargentum avatar zamiang avatar zerocho avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.