1 - Introduction
Quick crash course
If you prefer a quick crash course, view this free video on my YouTube channel.
AI-Generated Transcript
In this very first video, I just want to talk a little bit about what makes Astro special.
Now, I'm assuming if you're watching this video, and especially if you've purchased the course, that you don't need a lot of convincing. But still, I think it's important just to verify why this is worth our time.
Astro is a versatile modern web framework for creating fast, content-focused websites. At least, that's how it started. But the team just pushes updates at an unbelievable speed.
The thing I love most about Astro is it starts simple, as in, you're just writing HTML, CSS, and JavaScript. And that's exactly what it feels like. But very quickly, you've got this progressive power where you can add additional layers of complexity as you need them, but it's kind of like just-in-time complexity. Rather than giving everything you could ever possibly use and shipping that to the client, like single-page applications, instead what you do is just use the platform. You use the web, and then when you need more complexity, you can selectively grab it when you need it. And it gets complex. You can do middleware. You can have dynamic JSON endpoints. There's a bunch of really cool stuff you can do with Astro.
Now, there's five particular reasons why I think Astro stands out, and why it might be the best choice for your next project.
First of all, it's content-focused. Most web developers that are building sites are building content-focused sites. That's not to say that people aren't building apps. Of course, they are. But a lot of sites are content-focused. And even if you have an app, you almost always also have some kind of content. That's the majority of what you're building. Astro is specifically designed for content-rich websites, like marketing sites and blogs, portfolios, documentation sites, anything like that. Now, this is one of the important differences to understand about Astro. Astro's unique focus on content lets Astro make trade-offs and deliver unmatched performance features that wouldn't make sense for other, more application-focused web frameworks to implement.
Secondly, it's server-first. What I mean by that is that Astro prioritizes server rendering. That can either be ahead of time for the build, or actually using server-side rendering. Now, this results in a faster website performance compared to client-side rendering. Now, that doesn't mean you can't run client-side code. It's just that Astro ships no client-side JavaScript by default. And the separation of concerns is super clear. Anything in the front matter section of an Astro file is run on build or on the server. Anything below that is then run on the client. Now, it gets a little bit more complex or powerful than that, in that you can actually pull in basically any UI framework you want. We'll talk about that in a little bit. And then you can hydrate that with JavaScript when you want to, either when it's visible or on page load, or when the site is done loading everything else it needs. That's called Astro Islands.
Now, thirdly, it's fast by default. With Astro, building a slow website is honestly nearly impossible. It combines a content focus with the server-first approach to deliver exceptional performance.
Fourthly, it's easy to use. I've mentioned this already a few times, but you don't need to be an expert to use Astro. If you know how to write HTML, CSS, and JavaScript, Astro is the perfect place to start. However, if you know more and you have more complex needs, it supports a bunch of things, like the popular UI component frameworks like we've already talked about, like React, and Preact, and Svelte, and Vue, and much more. It also offers its own .astro UI language, which is easy to learn and has features borrowed from other UI frameworks.
Finally, and fifthly, it's fully-featured but flexible. Astro comes with all the essential features for website development, including component syntax, routing, asset handling, build processes, bundling, and data fetching. Additionally, it offers more than 100 integrations for extending its capabilities and supports various UI frameworks using that Astro syntax.
Now, I hope you can tell that I'm a big fan of Astro, and I think you will be too once you start building with it. Honestly, I think it should be the default web framework for any modern web developer. Unless you're building super complex front-end apps that require a ton of client-side routing, I don't know why you wouldn't choose Astro, and I hope to convince you of that throughout this course.
This very first module is intended for somebody brand new to frameworks. Now, that's not saying if you've used React or something like that it won't be helpful to you, but just so you know, I've intentionally kind of geared it to that level. We'll talk about the structure of an Astro project, how to use layouts, how to pass content between different components, how to build small components and kind of componentize your builds. We'll talk about CSS, we'll talk about JavaScript, about where stuff is scoped, where items are run, whether it's on server or on the actual client, and I'll drop in a few other items as we go. The ninth and final lesson here will actually build out a custom card component, so you get to put into practice what we've been doing all along.
Now, throughout the time, I'll actually pause and ask you to do things. When I ask you to do that, I'd really encourage you to pause and test your knowledge. I hope as I explain it, it sounds easy, but it's actually you doing it that's what cements that in stone.
Now, finally, before we get going, and this will be the case for all the lessons, if you're ever interested in the finished code for a branch, all you have to do is go to GitHub, grab that code, hit the download button, and then open it up in your code editor. If you ever get stuck, you're welcome to do that.
I'll see you in the next video.