Fresh: an extremely fast and simple web framework from Deno
A Fresh framework
With Deno being that different from Node, Next.js just isn't fit to run it. So the obvious conclusion is that you need a dedicated framework for it and hence the solution to that, Fresh. Starting fresh (no pun intended) instead of refitting an existing framework does have its benefits though, you’re free to choose whatever approach you think is best and with Fresh that is: keep it absolutely minimal. Basically every single time I do an overview of a new framework or library I focus on the features it has, but here I'm going to do the opposite and focus on what Fresh does not have:
- No build step: unlike other frameworks, which focus on speeding up their build step, Fresh doesnt have one at all. Fresh builds can be deployed to the edge instantly via Deno Deploy.
- No configuration: Works instantly out of the box and you can get right to writing code.
- No typescript compiler: Pretty much an extension of the above, Fresh provides TypeScript support out of the box just like Deno itself, so no compiler is needed.
What does it have?
How does that make sense? Well the usual approach with frameworks is focusing on what some other framework does inefficiently and improving a bit on that. With Fresh the approach is different: keep everything at an absolute minimum to get peak performance and reduce stress on the client. It's basically made of two core parts:
Routes: These contain a handler and a component (either or both) and take care of how your app responds to requests. Handlers are functions called for every request to the route, which then send a response with whatever is needed to the client. The component is a template, a server-side rendered JSX element which can receive props to determine what exactly needs to be rendered.