Fresh: a new full stack web framework for Deno

Rate this content
Bookmark
SlidesGithubProject website

Fresh is a web framework based on Deno and Web standards built to run on the edge

FAQ

Fresh is a full-stack web framework that runs on Deno. It is server-side rendered and supports just-in-time rendering on the edge. Fresh provides out-of-the-box TypeScript support, uses an Islands architecture for client interactivity, and requires no configuration to get started.

To install Fresh, run the following command in your terminal: 'deno run -A -R https://fresh.deno.dev' followed by the name of your project. This installation process is typically quick and straightforward.

Deno is a runtime for JavaScript, TypeScript, and WebAssembly that uses the V8 engine. It is designed for the web and can also be used to create command-line interfaces. Deno includes built-in utilities like a linter, code formatter, test runner, and supports both node.js and npm interoperability.

Key features of Fresh include no build step required, server-side rendering, support for static files, dynamic routing, data fetching, middleware, custom error pages, and styling options. It also utilizes the Islands architecture for enhancing client-side interactivity.

Islands architecture in Fresh refers to a design pattern where only specific parts of a web page (islands) are interactive, while the rest remains static. This approach enhances performance by loading JavaScript only for the interactive components, reducing the overall amount of JavaScript delivered to the client.

Fresh allows for styling using TWIN, a server-side rendered implementation of Tailwind CSS. Alternatively, developers can use standard CSS or add a build step for other CSS pre-processors. Fresh aims to support more server-side rendered styling solutions in the future.

In Fresh, data fetching can be handled through handler routes or hybrid routes. Handler routes involve exporting a function that takes a request and context as arguments and returns a response. Hybrid routes combine the functionalities of API handlers and server-side rendering by using functions named after HTTP verbs in the 'handler' object.

Fresh enables developers to define custom error pages, such as a custom 404 page. These pages can access special props related to the error, and for dynamic routes, the 'context.renderNotFound' method can be used to render these custom error pages when a page does not exist.

Fresh adheres to web standards by utilizing features like import maps, fetch API, and more, aligning closely with modern web development practices. Additionally, Deno, which Fresh is built upon, participates in the WinterCG to collaborate on API interoperability for JavaScript runtimes.

Nick Taylor
Nick Taylor
24 min
17 Apr, 2023

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Today's Talk introduces Fresh, a full-stack web framework for Deno, and covers its features, such as static files, routes, and data-fetching. It also discusses middleware, error pages, and styling options. The Talk explains the Islands architecture used by Fresh to enable client interactivity. The demo showcases the use of hybrid routes and islands components, and resources for Fresh, Deno, Preact, TypeScript, and web standards are provided.

1. Introduction

Short description:

Today we're going to talk about FRESH, a full-stack web framework for Deno. I work at Netlify. I'm from Montreal, Quebec, Canada. If you're looking for me online, I'm at NikkieTOnline pretty much everywhere. If you want to know more about me, visit IAmDeveloper.com. I also stream on Twitch and have a YouTube channel.

Hi, everyone. Today we're going to talk about FRESH, a full-stack web framework for Deno. Before we get started, a little bit about me. As mentioned, I work at Netlify. I'm from Montreal, Quebec, Canada. If you're looking for me online, I'm at NikkieTOnline pretty much everywhere. If you want to know a little more about me, you can visit my website at IAmDeveloper.com. I also stream on Twitch, so if that's something you're interested in, you can check out IAmDeveloper.live. I also have a YouTube channel that you can check at YouTube.IAmDeveloper.com. I am also not a big fan of spiders.

2. Introduction to Fresh and Deno

Short description:

Today we're going to cover what Fresh is, discuss web standards, and dig into the features of Fresh. Deno is a runtime for JavaScript, TypeScript, and WebAssembly (Wasm) that uses V8. It has built-in linter, code formatter, test runner, and interoperability with Node.js and npm. Deno follows web standards and is part of the WinterCG, a community group for API interoperability. To install Fresh, use the command 'deno run-A-R https://fresh.deno.dev project-name' and choose options like Tailwind and VS Code integration. Start Fresh with 'deno task start' in the project's root folder.

Alright, so what are we going to cover today? We're going to go over what Fresh is. We're going to discuss web standards, and then we'll dig into the features of Fresh. After that, there'll be a short demo, and then we can move on to questions and comments.

Alright, let's get to it. So, what is Fresh? Well, hold on. First, we need to talk about Deno. So what is Deno? Deno is a runtime for JavaScript, TypeScript and WebAssembly, or Wasm, that uses V8. For the web, it runs on the Edge. You can also use Deno to create command line interfaces, i.e. CLI's. It's got a built-in linter, there's a built-in code formatter, a built-in test runner, there's node.js interoperability via node specifiers, and there's also npm interoperability via npm specifiers and CDNs.

Alright, let's talk web standards. So, Deno uses web standards. For example, import maps, fetch, request, and response. Like the little drawing over there says, just look it up on MDN. Great docs, but also that's pretty much what you'll need to reference most of the time if you're working with fresh. As part of web standards, Deno is a part of the WinterCG. Web Interoperable Runtimes Community Group. It's a space to collaborate on API interoperability for JavaScript runtimes. Feel free to read more about the WinterCG at wintercg.org.

All right, so where were we? Assuming that you have Deno installed, getting fresh installed is pretty quick. You can just run the command that you see on the slide deck here. So that's deno run-A-R and then https://fresh.deno.dev and the name of your project. That was a lot to say. All right. The installation is pretty quick and you have a couple of options. You can choose Tailwind for Styles, go with VS Code integration via the Deno VS Code extension, and that's pretty much it. We'll go more into the styling story a little later in the talk. To start Fresh, we go into the root folder of the project in a shell and run Deno task start. We won't get into it in this talk, but Deno has a built-in task runner that you can configure via a deno.json file.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Building Better Websites with Remix
React Summit Remote Edition 2021React Summit Remote Edition 2021
33 min
Building Better Websites with Remix
Top Content
Remix is a new web framework from the creators of React Router that helps you build better, faster websites through a solid understanding of web fundamentals. Remix takes care of the heavy lifting like server rendering, code splitting, prefetching, and navigation and leaves you with the fun part: building something awesome!
Speeding Up Your React App With Less JavaScript
React Summit 2023React Summit 2023
32 min
Speeding Up Your React App With Less JavaScript
Top Content
Too much JavaScript is getting you down? New frameworks promising no JavaScript look interesting, but you have an existing React application to maintain. What if Qwik React is your answer for faster applications startup and better user experience? Qwik React allows you to easily turn your React application into a collection of islands, which can be SSRed and delayed hydrated, and in some instances, hydration skipped altogether. And all of this in an incremental way without a rewrite.
Full Stack Documentation
JSNation 2022JSNation 2022
28 min
Full Stack Documentation
Top Content
Interactive web-based tutorials have become a staple of front end frameworks, and it's easy to see why — developers love being able to try out new tools without the hassle of installing packages or cloning repos.But in the age of full stack meta-frameworks like Next, Remix and SvelteKit, these tutorials only go so far. In this talk, we'll look at how we on the Svelte team are using cutting edge web technology to rethink how we teach each other the tools of our trade.
SolidJS: Why All the Suspense?
JSNation 2023JSNation 2023
28 min
SolidJS: Why All the Suspense?
Top Content
Solid caught the eye of the frontend community by re-popularizing reactive programming with its compelling use of Signals to render without re-renders. We've seen them adopted in the past year in everything from Preact to Angular. Signals offer a powerful set of primitives that ensure that your UI is in sync with your state independent of components. A universal language for the frontend user interface.
But what about Async? How do we manage to orchestrate data loading and mutation, server rendering, and streaming? Ryan Carniato, creator of SolidJS, takes a look at a different primitive. One that is often misunderstood but is as powerful in its use. Join him as he shows what all the Suspense is about.
From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
We all love GraphQL, but it can be daunting to get a server up and running and keep your code organized, maintainable, and testable over the long term. No more! Come watch as I go from an empty directory to a fully fledged GraphQL API in minutes flat. Plus, see how easy it is to use and create directives to clean up your code even more. You're gonna love GraphQL even more once you make things Redwood Easy!
RedwoodJS: The Full-Stack React App Framework of Your Dreams
React Summit Remote Edition 2021React Summit Remote Edition 2021
43 min
RedwoodJS: The Full-Stack React App Framework of Your Dreams
Top Content
Tired of rebuilding your React-based web framework from scratch for every new project? You're in luck! RedwoodJS is a full-stack web application framework (think Rails but for JS/TS devs) based on React, Apollo GraphQL, and Prisma 2. We do the heavy integration work so you don't have to. We also beautifully integrate Jest and Storybook, and offer built-in solutions for declarative data fetching, authentication, pre-rendering, logging, a11y, and tons more. Deploy to Netlify, Vercel, or go oldschool on AWS or bare metal. In this talk you'll learn about the RedwoodJS architecture, see core features in action, and walk away with a sense of wonder and awe in your heart.

Workshops on related topic

Building WebApps That Light Up the Internet with QwikCity
JSNation 2023JSNation 2023
170 min
Building WebApps That Light Up the Internet with QwikCity
Featured WorkshopFree
Miško Hevery
Miško Hevery
Building instant-on web applications at scale have been elusive. Real-world sites need tracking, analytics, and complex user interfaces and interactions. We always start with the best intentions but end up with a less-than-ideal site.
QwikCity is a new meta-framework that allows you to build large-scale applications with constant startup-up performance. We will look at how to build a QwikCity application and what makes it unique. The workshop will show you how to set up a QwikCitp project. How routing works with layout. The demo application will fetch data and present it to the user in an editable form. And finally, how one can use authentication. All of the basic parts for any large-scale applications.
Along the way, we will also look at what makes Qwik unique, and how resumability enables constant startup performance no matter the application complexity.
Back to the Roots With Remix
React Summit 2023React Summit 2023
106 min
Back to the Roots With Remix
Featured Workshop
Alex Korzhikov
Pavlik Kiselev
2 authors
The modern web would be different without rich client-side applications supported by powerful frameworks: React, Angular, Vue, Lit, and many others. These frameworks rely on client-side JavaScript, which is their core. However, there are other approaches to rendering. One of them (quite old, by the way) is server-side rendering entirely without JavaScript. Let's find out if this is a good idea and how Remix can help us with it?
Prerequisites- Good understanding of JavaScript or TypeScript- It would help to have experience with React, Redux, Node.js and writing FrontEnd and BackEnd applications- Preinstall Node.js, npm- We prefer to use VSCode, but also cloud IDEs such as codesandbox (other IDEs are also ok)
Building a Hyper Fast Web Server with Deno
JSNation Live 2021JSNation Live 2021
156 min
Building a Hyper Fast Web Server with Deno
WorkshopFree
Matt Landers
Will Johnston
2 authors
Deno 1.9 introduced a new web server API that takes advantage of Hyper, a fast and correct HTTP implementation for Rust. Using this API instead of the std/http implementation increases performance and provides support for HTTP2. In this workshop, learn how to create a web server utilizing Hyper under the hood and boost the performance for your web apps.
Learn Fastify One Plugin at a Time
Node Congress 2021Node Congress 2021
128 min
Learn Fastify One Plugin at a Time
Workshop
Matteo Collina
Matteo Collina
Fastify is an HTTP framework for Node.js that focuses on providing a good developer experience without compromising on performance metrics. What makes Fastify special are not its technical details, but its community which is wide open for contributions of any kind. Part of the secret sauce is Fastify plugin architecture that enabled developers to write more than a hundred plugins.This hands-on workshop is structured around a series of exercises that covers from basics "hello world", to how to structure a project, perform database access and authentication.

https://github.com/nearform/the-fastify-workshop
Let AI Be Your Docs
JSNation 2024JSNation 2024
69 min
Let AI Be Your Docs
Workshop
Jesse Hall
Jesse Hall
Join our dynamic workshop to craft an AI-powered documentation portal. Learn to integrate OpenAI's ChatGPT with Next.js 14, Tailwind CSS, and cutting-edge tech to deliver instant code solutions and summaries. This hands-on session will equip you with the knowledge to revolutionize how users interact with documentation, turning tedious searches into efficient, intelligent discovery.
Key Takeaways:
- Practical experience in creating an AI-driven documentation site.- Understanding the integration of AI into user experiences.- Hands-on skills with the latest web development technologies.- Strategies for deploying and maintaining intelligent documentation resources.
Table of contents:- Introduction to AI in Documentation- Setting Up the Environment- Building the Documentation Structure- Integrating ChatGPT for Interactive Docs