My experience with astro
Aug 8, 2024
I work as a developer in a small digital agency based in Greece, where we specialize in creating websites and mobile apps tailored to our customers' needs. Our team has experience working with various technologies, including Next.js, React, and vanilla JavaScript, particularly in WordPress websites. However, about nine months ago, our agency decided to take a risk and adopt Astro for our web development projects, particularly those requiring exceptional SEO performance. Here’s why we made that choice and how it has impacted our work.
What is Astro?
Astro is a modern web framework that focuses on building fast, content-driven websites. Unlike many traditional frameworks that emphasize client-side rendering, Astro embraces server-side rendering (SSR) by default, allowing developers to create highly optimized, SEO-friendly web pages with minimal client-side JavaScript. This makes it an excellent choice for projects where performance and SEO are top priorities.
The Transition from Next.js to Astro
Before adopting Astro, our go-to stack was Next.js combined with React. We also relied heavily on vanilla JavaScript, HTML, and SCSS for our WordPress-based projects. While this stack served us well, we noticed certain limitations, particularly when it came to optimizing websites for SEO and performance. We needed a solution that would allow us to build faster, more efficient websites without compromising on the developer experience.
Astro stood out to us because of its strong focus on server-side rendering and content-driven development.
Rediscovering Vanilla JavaScript
One of the most interesting aspects of working with Astro is the return to a more traditional development style. In our previous projects with Next.js and React, we became accustomed to using features like useState
, useRef
, and other hooks that are essential in SPA frameworks. However, with Astro, we found ourselves relying more on vanilla JavaScript, especially since many of the complexities of managing state and side effects are not needed for the majority of our projects.
This experience has been both challenging and rewarding. For me personally, it meant revisiting and deepening my understanding of vanilla JavaScript—something I hadn’t focused on much since starting my career, as frameworks were already dominating the scene. The beauty of Astro is that it allows us to write clean, efficient JavaScript for more complex features when needed, without the overhead that comes with a full-fledged framework like React.
Flexibility with SPA When Needed
Although Astro encourages a server-side, content-first approach, it doesn’t lock you into this paradigm. If your project requires interactivity or a specific part of your website needs to behave like an SPA, Astro allows you to easily integrate React, Vue, or other frameworks into specific components. For example, we’ve successfully used React within Astro for features like user login systems, where client-side interactivity is essential.
This flexibility has been a game-changer for us, allowing us to enjoy the benefits of Astro's performance optimizations without sacrificing the dynamic capabilities that SPAs offer.
The Benefits: SEO, Developer Experience, and Beyond
Since adopting Astro, we’ve noticed significant improvements in our project outcomes, particularly in SEO. The server-side rendering approach ensures that our content is easily discoverable by search engines, leading to better rankings and more organic traffic for our clients. The leaner, faster websites we’re able to produce with Astro have also led to higher user engagement and satisfaction.
Moreover, the developer experience has been surprisingly pleasant. The learning curve for Astro is gentle, especially for those familiar with JavaScript and HTML. My colleagues and I appreciate the simplicity and elegance of Astro, as it allows us to focus more on writing clean, maintainable code rather than dealing with the complexities often associated with SPAs.
As a result of these positive experiences, we’ve started incorporating Astro into more of our projects. Our clients have been thrilled with the results, and we’re excited to continue exploring the possibilities with this powerful framework.