Skip to content

Files

Latest commit

 

History

History
 
 

hydration

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

A Fullstack Rendering (SSR, CSR and Hydration) Example Based-on Bun

This is a Bun 1.0-based variation of the fullstack rendering exampled illustrated in https://vanjs.org/ssr. Compared to the Node.js based implementation illustrated there, here are notable differences:

  • 🚀🚀🚀 Everything becomes extremely fast!
  • Much cleaner package.json, as the Bun runtime can do most of the work. Here are all the dependencies (the devDependencies of bun is not necessary if bun is installed globally. We include it so that the code can be previewed with CodeSandbox):
  "dependencies": {
    "mini-van-plate": "^0.5.3",
    "vanjs-core": "^1.2.6"
  },
  "devDependencies": {
    "bun": "^1.0.0",
    "bun-types": "^1.0.1"
  }
  • No script files (.sh files) needed.
  • The src/server.ts file is a few lines shorter than the Node.js based one, primarily thanks to the elimination of external dependencies.
  • The minified bundle of client .js file is slightly larger (3.0kB vs. 2.6kB). This is because as a new bundler and minifier, Bun has less size optimization options compared to terser.

You can preview the app via CodeSandbox.