DEV Community

Cover image for Life after Next.js: A New and Sunny Start
Felipe Stanzani
Felipe Stanzani

Posted on

Life after Next.js: A New and Sunny Start

A few weeks ago, I posted about my decision to move away from Next.js and the reasons behind that choice. Since projects can't just halt, I couldn't dwell too long on my decision. I had to consider several requirements for my new stack, including:

  • Using React as the frontend library.
  • Support for Server-Side Rendering (SSR).
  • Server-side functions.
  • Middleware support.
  • Enough flexibility to integrate libraries like React-Hook-Form and Axios.
  • A caching mechanism independent of the REST library.

Initially, I was torn between Remix and TanStack Start. However, Remix lacks middleware support, which would necessitate significant architectural changes and a less ideal way to manage route access. Furthermore, in recent weeks, the Remix project announced a substantial shift in direction for its V3 version. While this new direction appears very promising, it would eventually mean I'd have to rewrite everything again, and that's definitely not something I want.

TanStack Start, on the other hand, is currently in beta. Yet, it meets all my project's requirements and is built on Vite, making the project far more flexible and independent. Beyond what I've already outlined, the TanStack libraries have an excellent reputation, and this point deserves a small digression:

Utah probably isn't the first place you'd pick to catch a tan, but if your name is Tanner and you have a good sense of humor, you might just call your TypeScript library stack "TanStack." This textual detour is about him: Tanner Linsley is a programmer renowned for his profound commitment to the open-source community, developer experience, and type safety. TanStack libraries are used by hundreds of thousands of developers and adopted by everyone from startups to Fortune 500 giants. This alone lends significant credibility to TanStack Start, which, at least for me, weighs heavily in my decision for a long-term project.

Getting back on track, despite its beta status, the development team is now focused on stabilizing the framework rather than building new features, so no breaking changes are expected anymore.

Still, you might argue that adopting a beta framework for my project carries a high risk, and I agree. However, there are other valid points to consider for my project's current stage. As I've already explained, including in the previous post, going with a no-framework approach would demand a massive effort. Staying with Next.js under Vercel's grip was out of the question. This left me with Remix, which I've already discarded, and TanStack Start, which was my choice. And here's the unexpected upside for me: working with a beta framework also has its advantages.

As soon as I ran into the first development hurdles, I was directed to the TanStack Discord server. There, numerous developers exchange information and answer questions about the libraries. The project's own developers actively respond to queries, report bugs, ask for new issues to be opened, etc. Even Jack Herrington is there, participating actively!

So what? Instead of dealing with a black box and poor documentation, I'm tracking improvements in real-time, witnessing some problems being resolved as I develop my own project, and gaining a deeper understanding of how the framework itself works.

Speaking of documentation, that's another thing that genuinely surprised me. Last week, the project team removed Vinxi from the project, meaning it's now solely based on Vite, which was already planned. On the same day this version was released, all the website documentation was updated, and even a dozen example projects available on the site were already updated. These guys are truly working hard and with great dedication.

If you ask me: should I transition my production project, the one paying my bills, to TanStack Start at its current stage? My recommendation is: use Angular. If you want to build almost everything from scratch, you can use this. But if you have a project that will still take a few months to be ready, and you want the opportunity to see a framework being refined in its final stages, TanStack Start will undoubtedly be an excellent choice.

In my career, I've dealt with .Net 2.0, and believe me, that was far from a mature project, yet it was widely sold and adopted. The big difference is that before, I waited for Microsoft's good graces to fix the many issues – and anyone who used a MasterPage knows what I'm talking about – and now I have access to the code. If the project were to die (which I don't believe will happen), I'd have a project based on Vite and my own framework.

The transition so far has been quite smooth, and the TanStack Start website itself provides a very instructive guide for those, like me, migrating from Next.js.

Regarding internationalization, unfortunately, nothing pleases me as much as next-intl – for which I even created a VSCode extension. To replace it, I ended up adopting i18next, which comes closest, but it still lacks a canonical configuration solution or specific documentation for TanStack Start. So, Discord users have provided temporary solutions for now.

Another point that greatly interests me now is replacing react-hook-form with TanStack Forms, which is quite similar. I've been using shadcn/ui's form component for a while, which is based on react-hook-form. I hope a new implementation based on TanStack Forms emerges and has a good level of compatibility with the current implementation. If I have enough time, I might implement this solution and make it available on GitHub.

It's important to emphasize that despite being developed by the same team that builds the entire suite of TanStack libraries, one of TanStack Start's principles is that you are not obliged to use any of them. It's an independent framework. Do you want to use react-hook-form? Use it. Don't want to use TanStack Query? It's not even a dependency. Want to host on Vercel? Go for it. Want to put it on a Raspberry Pi hidden behind your wardrobe? Go right ahead! You are FREE.

More than just sharing my experience, I invite you to explore the project, participate, build your own projects based on TanStack Start, and contribute however you can.

If you're also moving away from Next.js or starting a new project, what are your thoughts on TanStack Start? If you've chosen another stack, share your solution in the comments! Best regards to all!

Originally posted in my blog, Memory Leak

Top comments (0)