chikara-chan/react-isomorphic-boilerplate
์๊ฐ
๐ ์๋ฒ ์ฌ์ด๋ ๋ ๋๋ง ์น ์ฑ์ ๋ง๋ค๊ธฐ ์ํ ๋ฒ์ฉ React ๋ํ ๋ณด์ผ๋ฌํ๋ ์ดํธ์ ๋๋ค.
์น ๋ฐ ์ฑ ๊ฐ๋ฐ์ธก์ ๋ ์คํ ์ฆ๊ฐ
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- ๊ธฐ๋ก ์์ง ์ค
์๋ก ๊ฒน์น๋ ๊ธฐ๊ฐ์ ์์ฆ๊ฐ๋์ด๋ฉฐ ์ผ๋ณ ํฉ๊ณ๊ฐ ์๋๋๋ค. ์ธก์ ๊ฐ์ด ์์ผ๋ฉด ๋น์ ๋ก๋๋ค. ์คํ๋ ๊ด์ฌ๋๋ฅผ ๋ํ๋ด๋ฉฐ ํ์ง์ ๋ณด์ฅํ์ง ์์ต๋๋ค.
README.md
OriginalReact Isomorphic Boilerplate
An universal React isomorphic boilerplate for building server-side render web app.
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
- React
- React Router
- Redux
- Redux+
- Sass
- PostCSS
- CSS Modules
- Koa
- Koa+
- Webpack
- Webpack+
- Babel
- Babel+
- ESLint
- Hot Module Replacement
- Code Splitting
- Database
- Test Framework
Getting Started
- Require Node.js v6 or later.
npm installto install dependencies and devDependencies.npm run devto start up the development environment.npm run buildto compile and bundle the client and server files.npm startto 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
๊ด๋ จ ํ๋ก์ ํธ ์ดํด๋ณด๊ธฐ
๋ถ๋ฌ์ค๋ ์คโฆ