🏗🏗🏗 Work in progress 🏗🏗🏗
pnpm servepnpm prebuildpnpm build:server
# or
pnpm build:clientpnpm buildpnpm formatpnpm lint- express + static: ~1.5mb
- fastify + @fastify/static: ~750kb
- @tinyhttp/app + sirv: ~220kb
NOTE: Unfortunately, this table doesn't contains benches for tinyhttp
Choose your fighter ¯\_(ツ)_/¯
There are two main entry points in the src folder: client and server
src/
├── app
│ ├── \_template
│ │ └── base.tsx
│ ├── app.routing.tsx
│ └── app.tsx
├── client.tsx // 1
└── server.tsx // 2
client.tsxentry useshydratefunction to bypass most rendering work when loading in the browser. Otherwise it's just your react projectindex.tsx.server.tsxentry contains server which:- Serves static assets via
sirv - Maps application
routesto the server routes. - Renders components via
renderToStringand template from_templates.
- Serves static assets via
With the new jsx transform you don't need to import React in every file where you want to use jsx. With esbuild you could inject import React from 'react' in file using re-export a.k.a shim. Think about it as workaround that helps expose built-in API during build.
You could move app.routing.tsx to the App component like this.