Skip to content

jmdesiderio/react-web-starter

Repository files navigation

TODO:

  • configure stylelint to scss-lint
  • organize selectors
  • Add flow types
  • Add server side rendering to express
  • implement proper redux-observable fetch calls
  • Extract css on prod build/solidify prod build
  • configure optimal webpack with tree shaking
  • optimize dev error messages (in browser)
  • Optimizing code chunking
  • fix tests so that prod builds
  • add nodemon
  • update all doc
  • add root relative module loading
  • try to make hot module replacement smoother

Future:

  • comb through eslint plugins and rules
  • comb through stylelint rules
  • comb through webpack options

Project Structure

  • components - react components grouped by small pieces of functionality (e.g. Header, Footer)
  • containers - containers used to wrap groups of components (e.g. App, Providers)
  • ducks - redux code using the 'ducks' pattern (e.g. ActionTypes, Reducers, Actions, Epics)
  • elements - groups of react components used in place of html elements. multiple per file since they are typically small (e.g. Button, Img, Field, Input)
  • forms - form groups with validations and submit handlers using redux-form (e.g Login Form, Billing Address Form)
  • static - static files that get copied to root folder on build. need to be registered in index.js within folder (e.g. favicon.ico, .htaccess)
  • styles - base global styles and importable styles in sass (e.g. variables, base)
  • translations - json files that contain all messages across site (e.g. en, de)
  • utils - pure javascript functions to are used to perform repetitive tasks (e.g. request, auth)
  • views - all top level components rendered on a route change. imported in route.js (e.g. Home, About, Contact, Collection)
  • i18n.js - setup the i18n language files and locale data for app
  • index.html - static html page that is served by express. is injected with links to compiled css and js files
  • index.js - entry point for app. does a small amount of config and creation
  • routes.js - contains all routes for the app
  • store.js - configures redux store with reducers, observables, dev tools and hot reloading

Legacy

Start your next react project in seconds
A highly scalable, offline-first foundation with the best DX and a focus on performance and best practices


Created by Max Stoiber and maintained with ❤️ by an amazing team of developers.

Features

Quick scaffolding
Create components, containers, routes, selectors and sagas - and their tests - right from the CLI!
Instant feedback
Enjoy the best DX (Developer eXperience) and code your app at the speed of thought! Your saved changes to the CSS and JS are reflected instantaneously without refreshing the page. Preserve application state even when you update something in the underlying code!
Predictable state management
Unidirectional data flow allows for change logging and time travel debugging.
Next generation JavaScript
Use template strings, object destructuring, arrow functions, JSX syntax and more, today.
Next generation CSS
Write composable CSS that's co-located with your components for complete modularity. Unique generated class names keep the specificity low while eliminating style clashes. Ship only the styles that are on the page for the best performance.
Industry-standard routing
It's natural to want to add pages (e.g. `/about`) to your application, and routing makes this possible.
Industry-standard i18n internationalization support
Scalable apps need to support multiple languages, easily add and support multiple languages with `react-intl`.
Offline-first
The next frontier in performant web apps: availability without a network connection from the instant your users load the app.
SEO
We support SEO (document head tags management) for search engines that support indexing of JavaScript content. (eg. Google)

But wait... there's more!

  • The best test setup: Automatically guarantee code quality and non-breaking changes. (Seen a react app with 99% test coverage before?)
  • Native web app: Your app's new home? The home screen of your users' phones.
  • The fastest fonts: Say goodbye to vacant text.
  • Stay fast: Profile your app's performance from the comfort of your command line!
  • Catch problems: AppVeyor and TravisCI setups included by default, so your tests get run automatically on Windows and Unix.

There’s also a fantastic video on how to structure your React.js apps with scalability in mind. It provides rationale for the majority of boilerplate's design decisions.

Keywords: React.js, Redux, Hot Reloading, ESNext, Babel, react-router, Offline First, ServiceWorker, styled-components, redux-saga, FontFaceObserver

Quick start

  1. Clone this repo using git clone --depth=1 https://github.com/react-boilerplate/react-boilerplate.git
  2. Run npm run setup to install dependencies and clean the git repo.
    We auto-detect yarn for installing packages by default, if you wish to force npm usage do: USE_YARN=false npm run setup
    At this point you can run npm start to see the example app at http://localhost:3000.
  3. Run npm run clean to delete the example app.

Now you're ready to rumble!

If you encounter an error when running yarn run test:watch use brew install watchman

Please note that this boilerplate is production-ready and not meant for beginners! If you're just starting out with react or redux, please refer to https://github.com/petehunt/react-howto instead. If you want a solid, battle-tested base to build your next product upon and have some experience with react, this is the perfect start for you.

Documentation

License

This project is licensed under the MIT license, Copyright (c) 2017 Maximilian Stoiber. For more information see LICENSE.md.