/node-react-boilerplate

node + react boilerplate (supports both js and typescript, react-scripts based client and express server with socket.io in the same repository, folder for shared code, ready for heroku)

Primary LanguageTypeScript

node + react boilerplate

Good for:

  • fresh start of node back + react front app
  • migration from es2015 js code to typescript

Supports both ts and js. Allows mixed imports: js from ts, ts from js.

Absolute path imports starting with 'server/', 'src/', see sample code.

Express and heroku support.

React app, based on react-scripts, with mustache templates for preloaded server values.

Socket.io support.

src/shared and server/shared are same, server/shared is the symlink

Please, be careful.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app. Be sure to run yarn build before. Open http://localhost to view it in the browser.

yarn r-start

Runs the react app in dev mode. Open http://localhost:3000 to view it in the browser. The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test

Launches mocha tests.

yarn r-test

Launches the react test runner in the interactive watch mode.
See the section about running tests for more information.

yarn build

Builds the react app and the server app.

yarn r-build

Builds the react app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.