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)
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
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.
Do you agree? Let us know down below!
As always, happy coding from your friends at Codesphere, the swiss army knife every development team needs!