[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-3469":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":16,"forks30d":16,"starsTrendScore":16,"compositeScore":18,"rankGlobal":10,"rankLanguage":10,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":10,"pushedAt":10,"updatedAt":24,"readmeContent":25,"aiSummary":26,"trendingCount":16,"starSnapshotCount":16,"syncStatus":27,"lastSyncTime":28,"discoverSource":29},3469,"react-redux-universal-hot-example","erikras\u002Freact-redux-universal-hot-example","erikras","A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform","",null,"JavaScript",12099,2468,323,357,0,1,70.6,"MIT License",false,"master",true,[],"2026-06-12 04:00:18","# ⚠️ DO NOT USE THIS!! ⚠️\n\nOnce upon a time, this repo helped a lot of people, but it's _waaaay_ out of date. It's now more of a historical artifact of what React development looked like in 2015.\n\n# React Redux Universal Hot Example\n\n[![build status](https:\u002F\u002Fimg.shields.io\u002Ftravis\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fmaster.svg?style=flat-square)](https:\u002F\u002Ftravis-ci.org\u002Ferikras\u002Freact-redux-universal-hot-example)\n[![Dependency Status](https:\u002F\u002Fdavid-dm.org\u002Ferikras\u002Freact-redux-universal-hot-example.svg?style=flat-square)](https:\u002F\u002Fdavid-dm.org\u002Ferikras\u002Freact-redux-universal-hot-example)\n[![devDependency Status](https:\u002F\u002Fdavid-dm.org\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fdev-status.svg?style=flat-square)](https:\u002F\u002Fdavid-dm.org\u002Ferikras\u002Freact-redux-universal-hot-example#info=devDependencies)\n[![react-redux-universal channel on discord](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdiscord-react--redux--universal%40reactiflux-brightgreen.svg?style=flat-square)](https:\u002F\u002Fdiscord.gg\u002F0ZcbPKXt5bZZb1Ko)\n[![Demo on Heroku](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdemo-heroku-brightgreen.svg?style=flat-square)](https:\u002F\u002Freact-redux.herokuapp.com)\n[![PayPal donate button](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fdonate-paypal-brightgreen.svg?style=flat-square)](https:\u002F\u002Fwww.paypal.com\u002Fcgi-bin\u002Fwebscr?cmd=_s-xclick&hosted_button_id=E2LK57ZQ9YRMN)\n\n---\n\n## About\n\nThis is a starter boilerplate app I've put together using the following technologies:\n\n* ~~Isomorphic~~ [Universal](https:\u002F\u002Fmedium.com\u002F@mjackson\u002Funiversal-javascript-4761051b7ae9) rendering\n* Both client and server make calls to load data from separate API server\n* [React](https:\u002F\u002Fgithub.com\u002Ffacebook\u002Freact)\n* [React Router](https:\u002F\u002Fgithub.com\u002Frackt\u002Freact-router)\n* [Express](http:\u002F\u002Fexpressjs.com)\n* [Babel](http:\u002F\u002Fbabeljs.io) for ES6 and ES7 magic\n* [Webpack](http:\u002F\u002Fwebpack.github.io) for bundling\n* [Webpack Dev Middleware](http:\u002F\u002Fwebpack.github.io\u002Fdocs\u002Fwebpack-dev-middleware.html)\n* [Webpack Hot Middleware](https:\u002F\u002Fgithub.com\u002Fglenjamin\u002Fwebpack-hot-middleware)\n* [Redux](https:\u002F\u002Fgithub.com\u002Frackt\u002Fredux)'s futuristic [Flux](https:\u002F\u002Ffacebook.github.io\u002Freact\u002Fblog\u002F2014\u002F05\u002F06\u002Fflux.html) implementation\n* [Redux Dev Tools](https:\u002F\u002Fgithub.com\u002Fgaearon\u002Fredux-devtools) for next generation DX (developer experience). Watch [Dan Abramov's talk](https:\u002F\u002Fwww.youtube.com\u002Fwatch?v=xsSnOQynTHs).\n* [React Router Redux](https:\u002F\u002Fgithub.com\u002Freactjs\u002Freact-router-redux) Redux\u002FReact Router bindings.\n* [ESLint](http:\u002F\u002Feslint.org) to maintain a consistent code style\n* [redux-form](https:\u002F\u002Fgithub.com\u002Ferikras\u002Fredux-form) to manage form state in Redux\n* [lru-memoize](https:\u002F\u002Fgithub.com\u002Ferikras\u002Flru-memoize) to speed up form validation\n* [multireducer](https:\u002F\u002Fgithub.com\u002Ferikras\u002Fmultireducer) to combine single reducers into one key-based reducer\n* [style-loader](https:\u002F\u002Fgithub.com\u002Fwebpack\u002Fstyle-loader), [sass-loader](https:\u002F\u002Fgithub.com\u002Fjtangelder\u002Fsass-loader) and [less-loader](https:\u002F\u002Fgithub.com\u002Fwebpack\u002Fless-loader) to allow import of stylesheets in plain css, sass and less,\n* [bootstrap-sass-loader](https:\u002F\u002Fgithub.com\u002Fshakacode\u002Fbootstrap-sass-loader) and [font-awesome-webpack](https:\u002F\u002Fgithub.com\u002Fgowravshekar\u002Ffont-awesome-webpack) to customize Bootstrap and FontAwesome\n* [react-helmet](https:\u002F\u002Fgithub.com\u002Fnfl\u002Freact-helmet) to manage title and meta tag information on both server and client\n* [webpack-isomorphic-tools](https:\u002F\u002Fgithub.com\u002Fhalt-hammerzeit\u002Fwebpack-isomorphic-tools) to allow require() work for statics both on client and server\n* [mocha](https:\u002F\u002Fmochajs.org\u002F) to allow writing unit tests for the project.\n\nI cobbled this together from a wide variety of similar \"starter\" repositories. As I post this in June 2015, all of these libraries are right at the bleeding edge of web development. They may fall out of fashion as quickly as they have come into it, but I personally believe that this stack is the future of web development and will survive for several years. I'm building my new projects like this, and I recommend that you do, too.\n\n## Installation\n\n```bash\nnpm install\n```\n\n## Running Dev Server\n\n```bash\nnpm run dev\n```\n\nThe first time it may take a little while to generate the first `webpack-assets.json` and complain with a few dozen `[webpack-isomorphic-tools] (waiting for the first Webpack build to finish)` printouts, but be patient. Give it 30 seconds.\n\n### Using Redux DevTools\n\n[Redux Devtools](https:\u002F\u002Fgithub.com\u002Fgaearon\u002Fredux-devtools) are enabled by default in development.\n\n- \u003Ckbd>CTRL\u003C\u002Fkbd>+\u003Ckbd>H\u003C\u002Fkbd> Toggle DevTools Dock\n- \u003Ckbd>CTRL\u003C\u002Fkbd>+\u003Ckbd>Q\u003C\u002Fkbd> Move DevTools Dock Position\n- see [redux-devtools-dock-monitor](https:\u002F\u002Fgithub.com\u002Fgaearon\u002Fredux-devtools-dock-monitor) for more detailed information.\n\nIf you have the \n[Redux DevTools chrome extension](https:\u002F\u002Fchrome.google.com\u002Fwebstore\u002Fdetail\u002Fredux-devtools\u002Flmhkpmbekcpmknklioeibfkpmmfibljd) installed it will automatically be used on the client-side instead.\n\nIf you want to disable the dev tools during development, set `__DEVTOOLS__` to `false` in `\u002Fwebpack\u002Fdev.config.js`.  \nDevTools are not enabled during production.\n\n## Building and Running Production Server\n\n```bash\nnpm run build\nnpm run start\n```\n\n## Demo\n\nA demonstration of this app can be seen [running on heroku](https:\u002F\u002Freact-redux.herokuapp.com), which is a deployment of the [heroku branch](https:\u002F\u002Fgithub.com\u002Ferikras\u002Freact-redux-universal-hot-example\u002Ftree\u002Fheroku).\n\n## Documentation\n\n* [Exploring the Demo App](docs\u002FExploringTheDemoApp\u002FExploringTheDemoApp.md) is a guide that can be used before you install the kit.\n* [Installing the Kit](docs\u002FInstallingTheKit\u002FInstallingTheKit.md) guides you through installation and running the development server locally.\n* [Adding Text to the Home Page](docs\u002FAddingToHomePage\u002FAddingToHomePage.md) guides you through adding \"Hello, World!\" to the home page.\n* [Adding A Page](docs\u002FAddingAPage\u002FAddingAPage.md) guides you through adding a new page.\n* [React Tutorial - Converting Reflux to Redux](http:\u002F\u002Fengineering.wework.com\u002Fprocess\u002F2015\u002F10\u002F01\u002Freact-reflux-to-redux\u002F), by Matt Star\n   If you are the kind of person that learns best by following along a tutorial, I can recommend Matt Star's overview and examples.\n\n\n## Explanation\n\nWhat initially gets run is `bin\u002Fserver.js`, which does little more than enable ES6 and ES7 awesomeness in the\nserver-side node code. It then initiates `server.js`. In `server.js` we proxy any requests to `\u002Fapi\u002F*` to the\n[API server](#api-server), running at `localhost:3030`. All the data fetching calls from the client go to `\u002Fapi\u002F*`.\nAside from serving the favicon and static content from `\u002Fstatic`, the only thing `server.js` does is initiate delegate\nrendering to `react-router`. At the bottom of `server.js`, we listen to port `3000` and initiate the API server.\n\n#### Routing and HTML return\n\nThe primary section of `server.js` generates an HTML page with the contents returned by `react-router`. First we instantiate an `ApiClient`, a facade that both server and client code use to talk to the API server. On the server side, `ApiClient` is given the request object so that it can pass along the session cookie to the API server to maintain session state. We pass this API client facade to the `redux` middleware so that the action creators have access to it.\n\nThen we perform [server-side data fetching](#server-side-data-fetching), wait for the data to be loaded, and render the page with the now-fully-loaded `redux` state.\n\nThe last interesting bit of the main routing section of `server.js` is that we swap in the hashed script and css from the `webpack-assets.json` that the Webpack Dev Server – or the Webpack build process on production – has spit out on its last run. You won't have to deal with `webpack-assets.json` manually because [webpack-isomorphic-tools](https:\u002F\u002Fgithub.com\u002Fhalt-hammerzeit\u002Fwebpack-isomorphic-tools) take care of that.\n\nWe also spit out the `redux` state into a global `window.__data` variable in the webpage to be loaded by the client-side `redux` code.\n\n#### Server-side Data Fetching\n\nThe [redux-async-connect](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fredux-async-connect) package exposes an API to return promises that need to be fulfilled before a route is rendered. It exposes a `\u003CReduxAsyncConnect \u002F>` container, which wraps our render tree on both [server](https:\u002F\u002Fgithub.com\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fblob\u002Fmaster\u002Fsrc\u002Fserver.js) and [client](https:\u002F\u002Fgithub.com\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fblob\u002Fmaster\u002Fsrc\u002Fclient.js). More documentation is available on the [redux-async-connect](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fredux-async-connect) page.\n\n#### Client Side\n\nThe client side entry point is reasonably named `client.js`. All it does is load the routes, initiate `react-router`, rehydrate the redux state from the `window.__data` passed in from the server, and render the page over top of the server-rendered DOM. This makes React enable all its event listeners without having to re-render the DOM.\n\n#### Redux Middleware\n\nThe middleware, [`clientMiddleware.js`](https:\u002F\u002Fgithub.com\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fblob\u002Fmaster\u002Fsrc\u002Fredux\u002Fmiddleware\u002FclientMiddleware.js), serves two functions:\n\n1. To allow the action creators access to the client API facade. Remember this is the same on both the client and the server, and cannot simply be `import`ed because it holds the cookie needed to maintain session on server-to-server requests.\n2. To allow some actions to pass a \"promise generator\", a function that takes the API client and returns a promise. Such actions require three action types, the `REQUEST` action that initiates the data loading, and a `SUCCESS` and `FAILURE` action that will be fired depending on the result of the promise. There are other ways to accomplish this, some discussed [here](https:\u002F\u002Fgithub.com\u002Frackt\u002Fredux\u002Fissues\u002F99), which you may prefer, but to the author of this example, the middleware way feels cleanest.\n\n#### Redux Modules... *What the Duck*?\n\nThe `src\u002Fredux\u002Fmodules` folder contains \"modules\" to help\nisolate concerns within a Redux application (aka [Ducks](https:\u002F\u002Fgithub.com\u002Ferikras\u002Fducks-modular-redux), a Redux Style Proposal that I came up with). I encourage you to read the\n[Ducks Docs](https:\u002F\u002Fgithub.com\u002Ferikras\u002Fducks-modular-redux) and provide feedback.\n\n#### API Server\n\nThis is where the meat of your server-side application goes. It doesn't have to be implemented in Node or Express at all. This is where you connect to your database and provide authentication and session management. In this example, it's just spitting out some json with the current time stamp.\n\n#### Getting data and actions into components\n\nTo understand how the data and action bindings get into the components – there's only one, `InfoBar`, in this example – I'm going to refer to you to the [Redux](https:\u002F\u002Fgithub.com\u002Fgaearon\u002Fredux) library. The only innovation I've made is to package the component and its wrapper in the same js file. This is to encapsulate the fact that the component is bound to the `redux` actions and state. The component using `InfoBar` needn't know or care if `InfoBar` uses the `redux` data or not.\n\n#### Images\n\nNow it's possible to render the image both on client and server. Please refer to issue [#39](https:\u002F\u002Fgithub.com\u002Ferikras\u002Freact-redux-universal-hot-example\u002Fissues\u002F39) for more detail discussion, the usage would be like below (super easy):\n\n```javascript\nlet logoImage = require('.\u002Flogo.png');\n```\n\n#### Styles\n\nThis project uses [local styles](https:\u002F\u002Fmedium.com\u002Fseek-ui-engineering\u002Fthe-end-of-global-css-90d2a4a06284) using [css-loader](https:\u002F\u002Fgithub.com\u002Fwebpack\u002Fcss-loader). The way it works is that you import your stylesheet at the top of the `render()` function in your React Component, and then you use the classnames returned from that import. Like so:\n\n```javascript\nrender() {\nconst styles = require('.\u002FApp.scss');\n...\n```\n\nThen you set the `className` of your element to match one of the CSS classes in your SCSS file, and you're good to go!\n\n```jsx\n\u003Cdiv className={styles.mySection}> ... \u003C\u002Fdiv>\n```\n\n#### Alternative to Local Styles\n\nIf you'd like to use plain inline styles this is possible with a few modifications to your webpack configuration.\n\n**1. Configure Isomorphic Tools to Accept CSS**\n\nIn `webpack-isomorphic-tools.js` add **css** to the list of style module extensions\n\n```javascript\n    style_modules: {\n      extensions: ['less','scss','css'],\n```\n\n**2. Add a CSS loader to webpack dev config**\n\nIn `dev.config.js` modify **module loaders** to include a test and loader for css\n\n```javascript\n  module: {\n    loaders: [\n      { test: \u002F\\.css$\u002F, loader: 'style-loader!css-loader'},\n```\n\n**3. Add a CSS loader to the webpack prod config**\n\nYou must use the **ExtractTextPlugin** in this loader. In `prod.config.js` modify **module loaders** to include a test and loader for css\n\n```javascript\n  module: {\n    loaders: [\n      { test: \u002F\\.css$\u002F, loader: ExtractTextPlugin.extract('style-loader', 'css-loader')},\n```\n\n**Now you may simply omit assigning the `required` stylesheet to a variable and keep it at the top of your `render()` function.**\n\n```javascript\nrender() {\nrequire('.\u002FApp.css');\nrequire('aModule\u002Fdist\u002Fstyle.css');\n...\n```\n\n**NOTE** In order to use this method with **scss or less** files one more modification must be made. In both `dev.config.js` and `prod.config.js` in the loaders for less and scss files remove \n\n1. `modules`\n2. `localIdentName...`\n\nBefore:\n```javascript\n{ test: \u002F\\.less$\u002F, loader: 'style!css?modules&importLoaders=2&sourceMap&localIdentName=[local]___[hash:base64:5]!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' },\n```\nAfter:\n```javascript\n{ test: \u002F\\.less$\u002F, loader: 'style!css?importLoaders=2&sourceMap!autoprefixer?browsers=last 2 version!less?outputStyle=expanded&sourceMap' },\n```\n\nAfter this modification to both loaders you will be able to use scss and less files in the same way as css files.\n\n#### Unit Tests\n\nThe project uses [Mocha](https:\u002F\u002Fmochajs.org\u002F) to run your unit tests, it uses [Karma](http:\u002F\u002Fkarma-runner.github.io\u002F0.13\u002Findex.html) as the test runner, it enables the feature that you are able to render your tests to the browser (e.g: Firefox, Chrome etc.), which means you are able to use the [Test Utilities](http:\u002F\u002Ffacebook.github.io\u002Freact\u002Fdocs\u002Ftest-utils.html) from Facebook api like `renderIntoDocument()`.\n\nTo run the tests in the project, just simply run `npm test` if you have `Chrome` installed, it will be automatically launched as a test service for you.\n\nTo keep watching your test suites that you are working on, just set `singleRun: false` in the `karma.conf.js` file. Please be sure set it to `true` if you are running `npm test` on a continuous integration server (travis-ci, etc).\n\n## Deployment on Heroku\n\nTo get this project to work on Heroku, you need to:\n\n1. Remove the `\"PORT\": 8080` line from the `betterScripts` \u002F `start-prod` section of `package.json`.\n2. `heroku config:set NODE_ENV=production`\n3. `heroku config:set NODE_PATH=.\u002Fsrc`\n4. `heroku config:set NPM_CONFIG_PRODUCTION=false`\n  * This is to enable webpack to run the build on deploy.\n\nThe first deploy might take a while, but after that your `node_modules` dir should be cached.\n\n## FAQ\n\nThis project moves fast and has an active community, so if you have a question that is not answered below please visit our [Discord channel](https:\u002F\u002Fdiscord.gg\u002F0ZcbPKXt5bZZb1Ko) or file an issue.\n\n\n## Roadmap \n\nAlthough this isn't a library, we recently started versioning to make it easier to track breaking changes and emerging best practices. \n\n* [Inline Styles](docs\u002FInlineStyles.md) - CSS is dead\n\n## Contributing\n\nI am more than happy to accept external contributions to the project in the form of feedback, bug reports and even better - pull requests :) \n\nIf you would like to submit a pull request, please make an effort to follow the guide in [CONTRIBUTING.md](CONTRIBUTING.md). \n \n---\nThanks for checking this out.\n\n– Erik Rasmussen, [@erikras](https:\u002F\u002Ftwitter.com\u002Ferikras)\n","该项目是一个基于Express、React、Redux、Webpack和react-transform的通用Web应用启动模板。它实现了前后端同构渲染，支持从独立API服务器加载数据，并集成了Babel、ESLint等工具来提高开发效率与代码质量。此外，通过使用Redux进行状态管理及React Router实现路由功能，该模板还提供了热更新等开发者友好特性。尽管项目已不再维护且技术栈相对老旧，但对于想要了解2015年左右React生态下全栈Web应用架构的学习者来说，仍具有一定的参考价值。",2,"2026-06-11 02:54:37","top_language"]