Skip to content

etienne-graveyard/deno-vite-react-ssr

Repository files navigation

React SSR running on Deno (powered by Vite)

⚠️ Experimental ⚠️

What is this project

You can think of this as an alternative to Next that runs in Deno instead of Node (maybe I should call this entx 🙃).

How does it work

We use Vite to bundle the App twice:

  • For the browser we remove getServerSideProps exports (and the dependencies used inside)
  • For Deno with the --ssr option

We only use Yarn and node_modules to install vite and its plugins, the app itself uses native ESM imports and importmap.json (like in Deno). This is acheived using a custom plugin in Vite that interact with Deno's cache.

Project status

This is a very early experiment but right now a very basic version getServerSideProps is working. The page is correctly rendered on the server then hydrated by the client. Client side navigation also work (props are fetch from the server with getServerSideProps).

The next steps are:

How to run the project

You need Deno, Node and Yarn installed for developement. Once deployed the app only needs Deno.

  • Install Node's deps with yarn install

Dev mode

  • Start the build with yarn run dev
  • Start the server by runing the VSCode task Run server (you need to have Denon installed)

Note: Hot reloading is not working yet but you don't have to restart the server, just manually refresh the page to see your changes.

Prod

  • Build the app with yarn run build
  • Then deploy the app and run src/server.ts with Deno

About

React with SSR on Deno, powered by Vite ⚡️

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published