- create-react-app as base and
react-scriptswithout ejecting; - express as a server;
- stream rendering because it's fast;
- react-app-rewired for improving base
react-scripts; - TypeScript as a main language for client and server;
❯ git clone git@github.com:awinogradov/cra-ssr-boilerplate.git react-ssr
❯ cd react-ssr
❯ npm i
❯ npm startPoint your browser to http://localhost:3000/.
react-scripts uses webpack-dev-server for incremental building and HMR, it works fine and the only one way to use it with SSR it's proxy. webpack-dev-server compiles all static files, but Express renders html on the different port. It's the reason why we need to use the proxy for static files and ws to webpack-dev-server from Express.
❯ npm run build❯ npm run start:productionPoint your browser to http://localhost:3000/.