A starter boilerplate for a universal web app with the best development experience and a focus on performance and best practices.
A starter boilerplate for a universal web app with the best development experience and a focus on performance and best practices.
A simple but feature rich starter boilerplate for creating your own universal app. It built on the top of React, Redux, React Router and Express. Includes all the hot stuff and modern web development tools such as Redux Toolkit, TypeScript, Webpack, Babel, PostCSS, React Refresh, Jest and React Testing Library. See the “Features” section for other awesome features you can expect.
I will maintain the starter boilerplate and keep all of the technologies on trend. Welcome to join me if you want. Hope you guys love it
If you have built a production web app based on this starter, please open a PR to add it here.
Really cool starter boilerplate with the most popular technologies:
They're several React frameworks today, however this is a DIY oriented start-kit. It shows you how to build a universal web app from scratch and how to test it. If you're new to React or you want a ready-to-go solution, I'd recommend the following alternatives for you:
You can find Docker support version on this branch.
1. You can start by cloning the repository on your local machine by running:
git clone https://github.com/wellyshen/react-cool-starter.git
cd react-cool-starter2. Install all of the dependencies:
yarn3. Start to run it:
yarn build # Building bundle
yarn start # Running production serverNow the app should be running at http://localhost:8080
Note: You can change the port that you want from the
./src/config.
I use cross-env to set and use environment variables across platforms. All of the scripts are listed as following:
yarn |
Description |
|---|---|
dev |
Runs your app on the development server at localhost:3000. HMR will be enabled. |
dev:build |
Bundles server-side files in development mode and put it to the ./public/server. |
start |
Runs your app on the production server only at localhost:8080. |
build |
Bundles both server-side and client-side files. |
build:server |
Bundles server-side files in production mode and put it to the ./public/server. |
build:client |
Bundles client-side files in production mode and put it to the ./public/assets. |
analyze:server |
Visualizes the bundle content of server-side. |
analyze:client |
Visualizes the bundle content of client-side. |
lint |
Lints all .tsx?, .jsx? and .scss files. |
lint:code |
Lints all .tsx? and .jsx? files (With --fix to auto fix eslint errors). |
lint:type |
Runs type checking for .tsx? files. |
lint:style |
Lints all .scss files (With --fix to auto fix stylelint errors). |
lint:format |
Formats all files except the file list of .prettierignore. |
test |
Runs testing. |
test:watch |
Runs an interactive test watcher. |
test:cov |
Runs testing with code coverage reports. |
test:update |
Updates jest snapshot. |
Here is the structure of the app, which serves as generally accepted guidelines and patterns for building scalable apps.
…Concerning the security and performance of Express in production, I already setup some middleware for you:
Note: It's just a basic protected mechanism for your app, you can see the security best practices for more advanced configuration.
Redux Toolkit is the official, opinionated, batteries-included toolset for efficient Redux development. It includes several utility functions that simplify the most common Redux use cases. In a word, we can do more work with less code, start from the tutorial to learn more about it.
Let's see how powerful it is by a simple asynchronous data fetching example:
…React v16.8 introduced a series of Hooks, which let you use state and other React features without writing a class. In the starter boilerplate, you can see how I leverage the benefit of functional components + hook APIs to write a demo with clean code.
This starter use [React Router](h
No open issues yet, or sync has not completed.