Fresh – Is this new Javascript framework the Node-killer
The time has come once again to evaluate a new Javascript framework…but wait. This isn’t your run of the mill React clone with slight variations promising to change everything.
Fresh is a Deno-based web framework that sends no javascript to the client by default. All of the bulk rendering and computation can operate on the server, and the client only needs to render small islands of UI.
For those who don’t know, Deno is a runtime for Javascript built by the original creator of NodeJS as a solution to a lot of the problems with the original Node. While the ecospace is still quite underdeveloped, Fresh might just be the framework that puts Deno on the map.
Fresh Architecture
The two main parts of a Fresh application are routes and islands.
Routes are the way in which your web app responds to different requests. This can mean serving a response as part of an API, or serving HTML for your front end.
Islands are isolated preact (effectively a more lightweight version of React) components that are rendered on the client side. You can serve these to the client via routes. Fresh automatically handles the updating of Islands to minimize client load times.
You can create new routes and islands by creating files in the /routes and /islands folders respectively.
Since the bulk of processing is done on the server-side, Fresh can load pages considerably faster than most frameworks that use Client-Side rendering and even many Server Side Rendering(Since Fresh doesn’t ship the whole rendering infrastructure to the client)
Demo Application
Want to play around with a demo? First install Deno, and then create a demo project with:
deno run -A -r https://fresh.deno.dev my-project-name
And then run the project with:
deno task start
Our Review
Working with Fresh felt incredibly lightweight and simple compared to most of the new frameworks that we’ve tried for the blog.
The routing/island system is incredibly intuitive and solves a lot of the bloating issues that make web frameworks undesirable. I fully plan to use Fresh for some projects in the future.
Obviously, the biggest challenge when working with Fresh is the size of the Deno ecosystem, but Fresh honestly seems like a big enough step in the right direction to warrant putting up with the growing pains of Deno.
If enough people feel the way we do about it, it might just get enough people into the Deno ecosystem to finally kill Node.