• Stars
    star
    657
  • Rank 68,589 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌟 An universal React isomorphic boilerplate for building server-side render web app.

React Isomorphic Boilerplate

An universal React isomorphic boilerplate for building server-side render web app.

dependencies Status devDependencies Status PRs Welcome npm

Introduction

This repository is an universal React isomorphic boilerplate for developer to quickly build a super fast and powerful web app that can be rendered both on the client and on the server using the most cutting-edge technology. Compared to others, this boilerplate has more pithily and more elegant configuration file based on environment variables, one for development, one for production. In addition, the directory structure is organized corresponding to mvc principle aim at the best practice.

Technology Stack

Getting Started

  • Require Node.js v6 or later.
  • npm install to install dependencies and devDependencies.
  • npm run dev to start up the development environment.
  • npm run build to compile and bundle the client and server files.
  • npm start to deploy the production server.

What's included

react-isomorphic-boilerplate/                // root directory
β”œβ”€β”€ build/                                   // webpack config directory
β”‚     β”œβ”€β”€ webpack.dev.config.js                 // config for webpack when run development bundle
β”‚     └── webpack.prod.config.js                // config for webpack when run production bundle
β”œβ”€β”€ client/                                  // client directory
β”‚     β”œβ”€β”€ about/                                // `about` module
β”‚     β”œβ”€β”€ common/                               // `common` module
β”‚     β”œβ”€β”€ home/                                 // `home` module
β”‚     β”œβ”€β”€ shared/                               // shared module
β”‚     β”œβ”€β”€ explore/                              // `explore` module
β”‚     β”œβ”€β”€ index.js                              // client entry file
β”‚     └── routes.js                             // client route config
β”œβ”€β”€ dist/                                    // bundle output directory
β”‚     β”œβ”€β”€ client/                               // the client side output directory
β”‚     └── server/                               // the server side output directory
β”œβ”€β”€ server/                                  // server directory
β”‚     β”œβ”€β”€ controllers/                          // controllers in server
β”‚     β”œβ”€β”€ middlewares/                          // custom middlewares in server
β”‚     β”œβ”€β”€ models/                               // models in server
β”‚     β”œβ”€β”€ routes/                               // routes in server
β”‚     β”œβ”€β”€ app.js                                // create koa instance in server
β”‚     β”œβ”€β”€ server.dev.js                         // entry file in development mode
β”‚     └── server.prod.js                        // entry file in production mode
β”œβ”€β”€ views/                                   // views directory
β”‚     β”œβ”€β”€ dev/                                  // output files generated by tpl in development mode
β”‚     β”œβ”€β”€ prod/                                 // output files generated by tpl in production mode
β”‚     └── tpl                                   // templates injected by html-webpack-plugin
β”œβ”€β”€ .editorconfig                            // uniform the text editor behavior
β”œβ”€β”€ .eslintignore                            // which paths should be omitted from linting
β”œβ”€β”€ .eslintrc.json                           // specific rules for eslint
β”œβ”€β”€ .gitattributes                           // uniform the new line perform behavior
β”œβ”€β”€ .gitignore                               // ignore the specific files when using git
β”œβ”€β”€ LICENSE                                  // license information
β”œβ”€β”€ package.json                             // npm entry file
β”œβ”€β”€ README.md                                // just what you see now
└── yarn.lock                                // lock file autogenerated by yarn

Why Isomorphic

SEO

An application that can only run in the client-side cannot serve HTML to crawlers, so it will have poor SEO by default. Web crawlers function by making a request to a web server and interpreting the result. but if the server returns a blank page, it’s not of much value. There are workarounds, but not without jumping through some hoops.

Performance

By the same token, if the server doesn’t render a full page of HTML but instead waits for client-side JavaScript to do so, users will experience a few critical seconds of blank page or loading spinner before seeing the content on the page. There are plenty of studies showing the drastic effect a slow site has on users, and thus revenue.

Maintainability

While the ideal case can lead to a nice, clean separation of concerns, inevitably some bits of application logic or view logic end up duplicated between client and server, often in different languages. Common examples are date and currency formatting, form validations, and routing logic. This makes maintenance a nightmare, especially for more complex apps.

Problem exists yet

FOUC

It happens when run in development mode. This is caused by deprecated using extract-text-webpack-plugin in development for getting a seamless hmr experience.(Why deprecated? See this Issue) If you are not an OCD, go ahead, ignore it.

Mismatch

It happens also when run in development mode. This is caused by when you update the react component code and reload the page, the markup generated mismatches that on server render. However, once you restart the server, the checksum will be valid. So it is harmless, ignore it also.

Links

http://www.jianshu.com/p/0ecd727107bb

License

MIT

More Repositories

1

react-laser-beam

β˜„οΈ Customized loading progress component for React.
JavaScript
36
star
2

el-table-plus

πŸ›΄ A high-level table component, integrating el-table and el-pagination of Element UI.
JavaScript
33
star
3

babel-plugin-react-scope-binding

πŸ– Babel plugin for React component to take event handler to bind context automatically.
JavaScript
21
star
4

react-power

πŸ”₯ Command line toolkit includes full-featured scripts powered by React ecosystem.
JavaScript
4
star
5

frontend-playground

πŸŽ‰πŸŽ‰πŸŽ‰ Canvas and CSS is a playground for the front end web.
JavaScript
3
star
6

invincible

βš“οΈ A series of miscellaneous functional JavaScript utility library.
JavaScript
3
star
7

awesome-angularjs

angularjs、requirejs、sass、grunt、bower、nodejs => front-end infrastructure
JavaScript
3
star
8

full-stack-javascript

β˜•οΈβ˜•οΈβ˜•οΈ Good developers who are familiar with the entire stack know how to make life easier for those around them.
JavaScript
3
star
9

stml

🍳🍳🍳 Super Type Markup Language - Lightweight JavaScript template engine.
JavaScript
2
star
10

react-redux-starter

A web application configure based on react、redux and webpack
JavaScript
2
star
11

layout

🍭🍭🍭 A tiny responsive css framework merely include normalize and grid system based on Bootstrap 4.0.0-alpha-5.
CSS
1
star
12

spring

PlayPlane online supermarket β€” based on Spring、Struts and Hibernate
Java
1
star
13

react-flux-gulp-starter

a web application configure based on react、flux、gulp and webpack
JavaScript
1
star
14

nodejs-project

A server integrated with express、mongodb and ejs
JavaScript
1
star