A react ssr🚀 project boilerplate with full typescript, vite, eslint, stylelint, husky, lint-staged, commitlint support. NO combined UI library or style library, especially built for those who always want to choose eject
and keep things under control. Read Wiki for more details.
Note the react ssr version
react-vite-ssr
is not default branch.
git clone https://github.com/EverSeenTOTOTO/browser-app-boilerplate.git my-project -b react-vite-ssr --depth 1
cd my-project
yarn
Check
vue-vite-ssr
for a vue similar version. A real project use this boilerplate can be found here, which usevite
+react
+react-dom
+react-dom-router
+mobx
+mui
.
-
dev:
make dev
-
build:
make build
-
Why makefile, not npm scripts?
I found
yarn clean && yarn build && yarn start
so annoying. -
Can I use this project for production?
Production use of this project is possible, but will require advanced refactoring and optimization due to many implementation details.
-
My git hooks not working?
Try
make prepare
to reinstall husky hooks. -
What's the difference from official vite ssr demo?
The biggest difference is we take
render
function defined inindex.server.ts
as a middleware, and still useViteDevServer
for development. The official demo however use theirserver.js
as dev server, and regardViteDevServer
as a middleware (setserver.middlewareMode
).
+ /
+ config/
- vite.dev.ts # client dev config
- vite.prod.ts # clientApp build config
- vite.server.ts # server build config
- vite.serverEntry.ts # serverApp build config
+ src/
+ server/
- index.ts # server entry
- main.ts
- index.server.tsx # serverApp entry
- index.client.tsx # clientApp entry