And you're probably wondering what is Nuxt, if you haven't come across it before. It's a progressive framework built on Vue.js. Vue is the rendering layer for the front end, but it's full stack. So it also has a server engine called Nitro, which is now a framework of its own and used by other meta-frameworks as well.
One of the key things for Nuxt is the developer experience. So it's all about making something that is easy to use, that has best practices built in, but doesn't impose a high barrier to entry, but at the same time is configurable and allows you to extend it as you need, as you grow and have different requirements, it should grow with you.
A few years ago, we started to rebuild Nuxt. And one of the things that we worked on that we wanted to do was think about how we could make Nuxt even more magical. And I think magic is a really important characteristic of a framework that I would want to use. I know sometimes it can be used in a pejorative sense, but I think magic is something that we want in terms of developer experience. And for me, it's really these two qualities. It's about reducing friction, keeping you in a single context, and about reducing distraction. So, adopting a more minimalistic principle.
So, wherever you switch context, if you're a developer and you're writing code, ideas are flowing through you and out, if there's something that stops you from that, whether that's you have to go to the documentation to find out something, or you need to check in another part of your project to understand whether you can do what you're trying to do, that is going to slow you down and create a feeling of frustration. And the same is true, I think, with distraction. So, when you find yourself having to maintain complex bundler configuration or to repeat code over and over again, even when you open a new component and you see 20 lines of imports at the top before you even see the code that you want to look at, all of that, I think, can get in the way of flow, state, something that makes you feel productive and to enjoy and flourish in what you're doing. And so I think magic is one of the things that we can do, can provide us framework offers that can dramatically improve the experience of developers.
So, when we came, as I was saying, to rebuild Nuxt from the ground up, for us, it was about thinking, how can we use TypeScript to make this kind of magic? Because building the framework, writing it in TypeScript is pretty much table stakes. But what could we do if we aimed to have TypeScript built in at a much more core level for the framework itself to be TypeScript native? And I came up with these four different possibilities, and you might have others, and more might go to me later. But I thought these would be helpful guide to go through. And the first is that it has to be designed to be the source of truth in a project. The framework needs to be designed for inference, so it takes best advantage of TypeScript to do what it can do. It needs to be designed for augmentation. And it needs to be designed to reveal all of the truth of the project as much as possible to the end user. So, what do I mean? First, designed as a source of truth. So, the moment you clone a new project in any framework, often you'll find that there's a page in the documentation called using with TypeScript. And in this page, there's then a tsConfig. And you can go to the page and copy and paste it into your project. Or maybe you have a template where it's already there. And from that moment on, your TypeScript config starts to diverge from the reality of the library.
Comments