All Projects โ†’ mrtnbroder โ†’ universal-react-webpack-boilerplate

mrtnbroder / universal-react-webpack-boilerplate

Licence: other
unireact - quickly bootstrap your universal react-app

Programming Languages

javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to universal-react-webpack-boilerplate

gulp-sass-bootstrap-boilerplate
โฐ๐Ÿ“Œ Boilerplate with gulp.js, Sass, Babel, and Browsersync.
Stars: โœญ 24 (-11.11%)
Mutual labels:  browsersync, babeljs
babel-plugin-transform-react-qa-classes
Add component's name in `data-qa` attributes to React Components
Stars: โœญ 41 (+51.85%)
Mutual labels:  react-components
jest-puppe-shots
A Jest plugin for creating screenshots of React components with a little help of Puppeteer
Stars: โœญ 86 (+218.52%)
Mutual labels:  react-components
weblocks
This fork was created to experiment with some refactorings. They are collected in branch "reblocks".
Stars: โœญ 80 (+196.3%)
Mutual labels:  server-side-rendering
lerna-starter
Simple React UI Development environment boilerplate to develop, test and publish your React components.
Stars: โœญ 55 (+103.7%)
Mutual labels:  react-components
useSSE
use Server-Side Effect โœจin React SSR app
Stars: โœญ 106 (+292.59%)
Mutual labels:  server-side-rendering
react-crud-icons
57 SVG icons for CRUD applications, packaged as a React component with light & dark themes and tooltip.
Stars: โœญ 19 (-29.63%)
Mutual labels:  react-components
lundium
React UI library for fast web development.
Stars: โœญ 24 (-11.11%)
Mutual labels:  react-components
kaonjs
Kaon.js is a react isomorphic app solution. It contains webpack build, hot reloading, code splitting and server side rendering.
Stars: โœญ 21 (-22.22%)
Mutual labels:  server-side-rendering
animation-wrapper-view
Declarative animations with imperative controls for RN/RNW.
Stars: โœญ 53 (+96.3%)
Mutual labels:  react-components
antony-nuxt
๐Ÿ‘ Codes that Power ouorz.com | A Tiny Little Nuxt.js + WP REST API App ๅšๅฎขๅ‰็ซฏ
Stars: โœญ 21 (-22.22%)
Mutual labels:  server-side-rendering
ylem
Add Observable View-Models to React components
Stars: โœญ 42 (+55.56%)
Mutual labels:  react-components
fyndiq-ui
Library of reusable web frontend components for Fyndiq
Stars: โœญ 39 (+44.44%)
Mutual labels:  react-components
react-ssr-starter
๐Ÿ”ฅ โš›๏ธ A React boilerplate for a universal web app with a highly scalable, offline-first foundation and our focus on performance and best practices.
Stars: โœญ 40 (+48.15%)
Mutual labels:  server-side-rendering
tailwind-antd-react-kit
UI Components and helpers for frontend development using Tailwind + Ant Design and React.js
Stars: โœญ 27 (+0%)
Mutual labels:  react-components
react-ssr-hydration
Example of React Server Side Rendering with Styled Components and Client Side Hydration
Stars: โœญ 15 (-44.44%)
Mutual labels:  server-side-rendering
jwt-session
JwtSession is a PHP session replacement. Instead of use FileSystem, just use JWT TOKEN. The implementation follow the SessionHandlerInterface.
Stars: โœญ 42 (+55.56%)
Mutual labels:  stateless-components
node-amazon
E-commerce website done in Node, and Angular 11 (SSR)
Stars: โœญ 48 (+77.78%)
Mutual labels:  server-side-rendering
Stardust
๐ŸŽจTiller Design System
Stars: โœญ 19 (-29.63%)
Mutual labels:  react-components
react-cool-virtual
๐Ÿ˜Ž โ™ป๏ธ A tiny React hook for rendering large datasets like a breeze.
Stars: โœญ 1,031 (+3718.52%)
Mutual labels:  server-side-rendering

unireact

Build Status dependency badge devDependency Status

unireact is an universal react boilerplate that features an awesome dev environment with hot-reload, a lean dependency tree and the ability to quickly bootstrap your own applications.

Table of Contents

Get started

Install dependencies

$ npm i

Then start development with

$ npm run dev

Production Build

Build the production version with

$ npm run build

Then run the production server with

$ npm start

Development Flow

  • webpack-dev-server serves the client lib with hot-reload enabled
  • webpack watches src/server for changes and compiles to _tmp/server/
  • nodemon watches for server rebuilds and automatically restarts when a change happened.

Hot Reloading

Please note that hot reloading only works when your top-level component is a react class component. Hot reloading of stateless components at the top doesn't work yet as react-hmr is not able to figure out if your function returns a react element.

Dependencies

unireact is depending several libraries to handle things like async actions, routing, state management etc. Please get to each of them first when you have questions about how to work with them.

Features

Hot Reload

Speed up your development workflow with webpack's awesome Hot Module System. Using babel-transform-hmr you can write your react components and have them updated in an instant without the need to reload your page.

(Note: stateless react components require a full page-reload. webpack takes care of that though.)

ES2015/16 with Babel

You can start writing ES 2015/16 within the src directory, as everything in there will be transpiled with babel. Currently included is the preset for es2015 (allows jsx syntax) and stage-0 (async/await).

Ecosystem

Directory Structure

.
โ”œโ”€โ”€ config
โ”‚   โ”œโ”€โ”€ config.js           # holds environment variables and some basic configurations like the host, port etc. used by express or webpack-dev-server
โ”‚   โ””โ”€โ”€ paths.js            # build paths for webpack but also for the entire app
โ”œโ”€โ”€ src
โ”‚   โ”œโ”€โ”€ client              # code that only lives on the client
โ”‚   โ”‚   โ””โ”€โ”€ index.jsx       # renders the react app and has some dev stuff
โ”‚   โ”œโ”€โ”€ shared              # shared code between the client and the server
โ”‚   โ”‚   โ”œโ”€โ”€ actions         # redux actions
โ”‚   โ”‚   โ”œโ”€โ”€ constants       # redux constants
โ”‚   โ”‚   โ”œโ”€โ”€ reducers        # redux reducers
โ”‚   โ”‚   โ”œโ”€โ”€ stores          # redux store configuration
โ”‚   โ”‚   โ”œโ”€โ”€ utils           # utils (e.g. WebAPIUtil)
โ”‚   โ”‚   โ””โ”€โ”€ routes          # view routes (server + client router)
โ”‚   โ”œโ”€โ”€ server              # server side stuff
โ”‚   โ”‚   โ”œโ”€โ”€ middlewares     # middlewares for express (you may want to add your api endpoints here)
โ”‚   โ”‚   โ””โ”€โ”€ index.js        # starts the express server
โ”‚   โ””โ”€โ”€ views               # contains all the views, e.g. the frontpage
โ”‚       โ”œโ”€โ”€ root.jsx        # root handler that renders all children
โ”‚       โ””โ”€โ”€ html.jsx        # renders the <html> page on the server
โ”œโ”€โ”€ webpack
โ”‚   โ”œโ”€โ”€ index.js                    # used by webpack-dev-server to serve the client and server when developing
โ”‚   โ”œโ”€โ”€ webpack.client.config.js    # client-side webpack configuration
โ”‚   โ”œโ”€โ”€ webpack.config.js           # shared webpack configuration between server and client
โ”‚   โ””โ”€โ”€ webpack.server.config.js    # server-side webpack configuration
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ index.js      # starts the production server (you need to run `npm run build` first)
โ”œโ”€โ”€ package.json

Component Structure

To make components shareable and contained, components that need to expose their state within a reducer should follow this structure:

โ”œโ”€โ”€ components # pure components *only*
โ”‚   โ”œโ”€โ”€ image.jsx # pure component that renders the product image
โ”‚   โ”œโ”€โ”€ price.jsx # pure component that renders the product price
โ”‚   โ””โ”€โ”€ product.jsx # pure component that renders the product page
โ”œโ”€โ”€ actions
โ”‚   โ”œโ”€โ”€ productActions.js # actions only used within this directory
โ”œโ”€โ”€ constants
โ”‚   โ”œโ”€โ”€ productConstants.js # constants only used within this directory
โ”œโ”€โ”€ reducers
โ”‚   โ”œโ”€โ”€ index.js # exports all reducers within this directory, so we can easily import it by our root reducer
โ”‚   โ””โ”€โ”€ products.js # reducer only used by products.jsx
โ””โ”€โ”€ products.jsx # this is our container component that imports from components

When following this structure, you makes things easier to reason about and your component stays contained. It will only ever reach out to whats inside this directory and not touch anything else.

When other components need to interact with your local state, you should move your actions and reducers one level up (until they reach the top level lib directory).

Credits

Thanks go out to kriasoft and the team of este as I took some inspiration from these awesome guys!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].