Building for the Edge - Crafting a Next-Gen Framework

Rate this content
Bookmark

Creating a new Vue-based meta-framework from scratch with live coding.

This talk has been presented at Vue.js London 2023, check out the latest edition of this JavaScript Conference.

FAQ

NUXT is a framework built on top of Vue for creating web applications. It integrates best practices and allows for customization. NUXT provides a composable approach, enabling features to be included as needed, and supports server optimization for serverless environments. It's designed to enhance both developer experience and application performance.

Nitro is the new server architecture introduced in NUXT for building web applications. It is designed for the serverless world and edge computing, focusing on high efficiency and low resource utilization. Nitro allows developers to build and deploy applications rapidly with its streamlined framework.

Yes, NUXT is suitable for both server-rendered and static applications. It provides a rich set of features that enhance development even if server-side rendering is not required, such as automatic component imports, type safety, and comprehensive utilities for routing and state management.

NUXT 3 introduces significant changes including a transition from Vue 2 to Vue 3, updates to accommodate breaking changes in dependencies like PostCSS and Webpack, and the adoption of Vite over Webpack. It also features a shift from a singleton design pattern to a more modular and composable architecture.

Pinia is recommended as the state management solution for NUXT in the Vue 3 ecosystem, succeeding VueX. It offers a modern API, improved devtools integration, and is designed to work seamlessly with Vue 3's composition API.

Vite provides a fast development setup with features like instant server start and hot module replacement. Most NUXT developers choose Vite due to its efficiency and the active development of plugins within the ecosystem, enhancing the overall developer experience and application performance.

NUXT has collaborated with the Chrome team to improve web performance, particularly focusing on source mapping and script loading optimizations. These efforts aim to enhance debugging capabilities and ensure that best practices are applied in performance-critical areas.

NUXT supports legacy Vue 2 projects by allowing integration through its architecture, but transitioning to NUXT 3 with Vue 3 is recommended to take full advantage of the latest features and improvements in performance and scalability.

Daniel Roe
Daniel Roe
32 min
12 May, 2023

Comments

Sign in or register to post your comment.
Video Summary and Transcription
NUXT is a framework for building web apps that has undergone significant changes with the introduction of Nitro, a new server. The Talk covers topics such as building a framework with Nitro, rendering a view app, configuring Nitro and Vite, and integrating Nuxt with an existing Vue 2 project. The collaboration between Nuxt and Chrome has resulted in performance improvements, and the future of Nuxt and Nitro looks promising with new ideas and extensions being developed.

1. Introduction to NUXT and Nitro

Short description:

I am a member of the NUXT Core Team and have worked on projects like Magic Regex and Fontane. I helped build Nuxt, a framework for building web apps. We had an opportunity to rethink Nuxt and made significant changes. I want to show off Nitro, our new server, and demonstrate building Nuxt from scratch on top of it.

♪♪ Can move on. So I am a member of the NUXT Core Team, along with a number of other folk here. You've already heard from Lucy. Sebastien's going to speak in a moment, Alex as well. I'm also involved in a number of other projects like Magic Regex, Fontane, which makes your layout shift disappear if you have custom web fonts. Elk, which is a client for Mastodon, and I have a website as well. So feel free to check out any of those that may interest you.

This is my milieu. If you ever message me on Twitter or Discord or whatever, I'm probably sitting at this desk. One of my three cats is probably stopping me from working. I don't know if you've ever experienced that you have changed your priorities for the day based on what your pet is doing, because I 100% have. Like, there are times when I just cannot code because I actually have a cat here. So, the only thing I can do is read through GitHub issues or something like that, but sorry, I'm losing track.

So I helped build Nuxt, which is a framework for building web apps, and it's built on top of Vue, of course. Can I have a show of hands, who here has used Nuxt? Okay. Well, that will skip the next ten slides. So, recently, we had a – well, a couple of years ago. We had a significant opportunity to rethink what Nuxt was about, what we would do with it. I mean, the core philosophy, the idea that you would be able to get started with best practice built in and customize as you went, that was still there, but a lot of things were changing.

So, the move from Vue 2 to Vue 3, there was a breaking change in PostCSS, huge breaking changes in Webpack, at the same time, just as we were about to be all ready to go with Webpack, Evan, for goodness' sake, releases Vite. What was that about? But I'm a big fan, but lots of opportunities to rethink. And alongside those, we had philosophical changes, like moving from a sort of singleton approach where you sort of have everything defined centrally and available to you, to a composable approach where you can actually pull in features that you want and need and actually only those get included in the bundle, an idea that you can actually share logic between components, lots of stuff that really made us think about what we wanted Nuxt to do. And I'm not going to talk about a lot of that, actually. I'm going to focus on the next piece, which we did, which was actually, we think, the server and how it was that we could write a server that would be designed for the serverless world, for a world of edge computing, for a world where you don't necessarily have a Docker container just always on or a server that's just constantly ready to return responses, but maybe you might need to fire something up. We moved, by the way, in Nuxt 2 from 300 milliseconds called Start to five in Nuxt 3, and we moved from 52 meg of bundle size to three in server node modules in Nuxt 2 to Nuxt 3. So there are huge changes we made, but in particular what I want to talk about today is I want to show off Nitro, which is the name we've given to our new server. We've released it so anyone can build on it, and I want to show you what it would look like to build Nuxt from scratch in a few minutes. I want to really very much try and do this, and I apologize as possible I might go into my cue. I'm going to build Nuxt from scratch on top of Nitro, powered by lots and lots of tools, which I'll show you as we go. So here we go.

2. Building a Framework with Nitro

Short description:

Let's dive in and build a framework powered by Nitro. We install Nitro and H3, a server framework like Express. We create a web server that returns a JSON response. We provide type safety on fetches across the app and make it performant. In NUX, the fetch call works isomorphically.

Let's dive in and build a framework powered by Nitro. So the first thing to do, this is an empty repository, basically, nothing much there. I'm going to install Nitro and H3, which is the server framework, a little bit like Express that we built on top of that, and start it.

Okay, so off the top of our head we have a web server that's running. Let's go to local host 3000, nothing there. Let's create a root, foo. Nitro and Nuxt, we have very much the idea that we want to be as minimal as possible and as intuitive as possible. So we can do something like this. And actually, if we hit that endpoint, I'll hit it actually just in this terminal here, which seems to be tiny. If I hit local host, what was that, foo, I get back a JSON response. I've just returned an object. We also as much as possible try and auto-import things, and we do that in a pattern that we started with Nuxt. We provide our own TS config to let your editor know, your IDE know what's available both in terms of, well, in terms of everything that we make available, whether that's type aliases, buffer paths, or making your editor know about what is auto-importable and what isn't. We can also do really cool things like this. Say I, let's see, duplicate this, as another, another handler. I can actually get type safety on fetches across my app, so it knows the routes that exist, it knows the return types for that data, and so I could do something like this and actually get full type safety, and it's quite fun. And what you'll also notice, might not, is that this dollar sign fetch thing, when used in a server context, actually doesn't hit the network layer, it just makes a function call. So it's as much as possible, we're trying to make it as performant as we can. In NUX, as it happens, when you run that fetch call, it will make a request to the server, so it works isomorphically.

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 web framework built on React Router that focuses on web fundamentals, accessibility, performance, and flexibility. It delivers real HTML and SEO benefits, and allows for automatic updating of meta tags and styles. It provides features like login functionality, session management, and error handling. Remix is a server-rendered framework that can enhance sites with JavaScript but doesn't require it for basic functionality. It aims to create quality HTML-driven documents and is flexible for use with different web technologies and stacks.
Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
State management is not limited to complex applications and transitioning to a store offers significant benefits. Pinia is a centralized state management solution compatible with Vue 2 and Vue 3, providing advanced devtools support and extensibility with plugins. The core API of Pinia is similar to Vuex, but with a less verbose version of stores and powerful plugins. Pinia allows for easy state inspection, error handling, and testing. It is recommended to create one file per store for better organization and Pinia offers a more efficient performance compared to V-rex.
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
Watch video: Speeding Up Your React App With Less JavaScript
Mishko, the creator of Angular and AngularJS, discusses the challenges of website performance and JavaScript hydration. He explains the differences between client-side and server-side rendering and introduces Quik as a solution for efficient component hydration. Mishko demonstrates examples of state management and intercommunication using Quik. He highlights the performance benefits of using Quik with React and emphasizes the importance of reducing JavaScript size for better performance. Finally, he mentions the use of QUIC in both MPA and SPA applications for improved startup performance.
Full Stack Documentation
JSNation 2022JSNation 2022
28 min
Full Stack Documentation
Top Content
The Talk discusses the shift to full-stack frameworks and the challenges of full-stack documentation. It highlights the power of interactive tutorials and the importance of user testing in software development. The Talk also introduces learn.svelte.dev, a platform for learning full-stack tools, and discusses the roadmap for SvelteKit and its documentation.
Welcome to Nuxt 3
Vue.js London Live 2021Vue.js London Live 2021
29 min
Welcome to Nuxt 3
Top Content
Nux3 has made significant improvements in performance, output optimization, and serverless support. Nuxt Bridge brings the Nitro engine for enhanced performance and easier transition between Nuxt 2 and Nuxt Read. Nuxt 3 supports Webpack 5, Bytes, and Vue 3. NextLab has developed brand new websites using Docus technology. Nuxt.js is recommended for building apps faster and simpler, and Nuxt 2 should be used before migrating to Nuxt 3 for stability. DOCUS is a new project that combines Nuxt with additional features like content modules and an admin panel.
One Year Into Vue 3
Vue.js London Live 2021Vue.js London Live 2021
20 min
One Year Into Vue 3
Top Content
Vue 3 has seen significant adoption and improvements in performance, bundle size, architecture, and TypeScript integration. The ecosystem around Vue 3 is catching up, with new tools and frameworks being developed. The Vue.js.org documentation is undergoing a complete overhaul. PNIA is emerging as the go-to state management solution for Vue 3. The options API and composition API are both viable options in Vue 3, with the choice depending on factors such as complexity and familiarity with TypeScript. Vue 3 continues to support CDN installation and is recommended for new projects.

Workshops on related topic

Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Featured WorkshopFree
Mikhail Kuznetsov
Mikhail Kuznetsov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
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)
Monitoring 101 for React Developers
React Summit US 2023React Summit US 2023
107 min
Monitoring 101 for React Developers
Top Content
WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 
Workshop level: Intermediate
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Vue.js London Live 2021Vue.js London Live 2021
117 min
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Top Content
Workshop
Daniel Roe
Daniel Roe
We'll build a Nuxt project together from scratch using Nitro, the new Nuxt rendering engine, and Nuxt Bridge. We'll explore some of the ways that you can use and deploy Nitro, whilst building a application together with some of the real-world constraints you'd face when deploying an app for your enterprise. Along the way, fire your questions at me and I'll do my best to answer them.
Going on an adventure with Nuxt 3, Motion UI and Azure
JSNation 2022JSNation 2022
141 min
Going on an adventure with Nuxt 3, Motion UI and Azure
WorkshopFree
Melanie de Leeuw
Melanie de Leeuw
We love easily created and deployed web applications! So, let’s see what a very current tech stack like Nuxt 3, Motion UI and Azure Static Web Apps can do for us. It could very well be a golden trio in modern day web development. Or it could be a fire pit of bugs and errors. Either way it will be a learning adventure for us all. Nuxt 3 has been released just a few months ago, and we cannot wait any longer to explore its new features like its acceptance of Vue 3 and the Nitro Engine. We add a bit of pizzazz to our application with the Sass library Motion UI, because static design is out, and animations are in again.Our driving power of the stack will be Azure. Azure static web apps are new, close to production and a nifty and quick way for developers to deploy their websites. So of course, we must try this out.With some sprinkled Azure Functions on top, we will explore what web development in 2022 can do.