The Future of Next.js Pages Router #56655
-
Hello, I've been working on completing and maintaining the products at the company I'm currently with, using the page router. I find great joy in creating products through the page router and, additionally, I'm excited about the possibility of server-side rendering (SSR). Utilizing features like getServersideProps allows for sufficient implementation of server-side actions. However, as I migrate to the app router this time, I have some concerns. Firstly, given the substantial volume of products I develop and the fact that I work with a small team, the most realistic thought that came to my mind is, "Will this page router soon be deprecated, no longer supported?" I should stick to the main point, but it seems I've added a bit of my opinion. I'm curious about the future of the page router in the current situation. Will it truly disappear or be deprecated later on? Or is there a parallel route where both app router and page router can be used? I'm interested in that future. It will help me decide whether I should work overtime or not 🤣 |
Beta Was this translation helpful? Give feedback.
Replies: 11 comments 18 replies
-
I have the same quetion and i would understand about future page router |
Beta Was this translation helpful? Give feedback.
-
I think it's really important that this question is answered even for projects migrating to app router. Realistically it's going to take me awhile to fully migrate from pages to app router. I would like to know if the long term plan is to push everyone to app router or to support both pages and app router. Even if pages router isn't actively developed moving forward, will it still get bug fixes? |
Beta Was this translation helpful? Give feedback.
-
Same concern. Any developer in Next could answer? @timneutkens @ijjk |
Beta Was this translation helpful? Give feedback.
-
I would also like to know if page routing will be kept for years to come or not. I don't like that App Router forces a node backend. |
Beta Was this translation helpful? Give feedback.
-
Bump on this question. I share similar concerns. |
Beta Was this translation helpful? Give feedback.
-
I think there are scenarios that page router is better and kinda the only option, like using the same code for web pages and mobile app with Capacitor.js. |
Beta Was this translation helpful? Give feedback.
-
👋 Hey, sorry I didn't see this discussion until now! In short, we're committed to supporting the Pages Router for many years in the future. And then maybe longer even. We believe backwards compatibility is incredibly important, which is why the same features from Next.js 1.0 work in Next.js 14 today (through the Pages Router). You don't have to move to the App Router. We believe it has features that are beneficial, of course, but all new things take time to mature and bring the community along for the ride. If you're not wanting to try things out just yet, no worries at all. Further, we're still making Next.js improvements that apply to both routers, like adding Turbopack (through Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
@leerob, I have faith in Vercel's ability to maintain backward compatibility. I've been building on top of Next.js for the past 4 years, and while the advancements are impressive, not all apps require the app router or React Server Components (RSC). Many developers, including myself, don't feel the need for server-side rendering except for SEO pages. Mixing frontend and backend logic is still crucial for many use cases. While some see a return to a PHP-like environment as beneficial, others, like me, do not. For the first time in years, I'm consistently exploring alternatives to Next.js. The concept of server-side rendering in 2024 feels outdated given the advancements in average internet speeds and hardware capabilities of modern devices. If this were 2014, I would be fully onboard with server-side rendering. While RSC makes sense for SEO-heavy consumer platforms like e-commerce and marketplaces, it doesn't seem necessary for SaaS or business applications. I hope the Vercel team gives equal importance to both the page router and the app router. The page router should not be treated as a second-class citizen, with significant features being rolled out only for the app router. Thanks. |
Beta Was this translation helpful? Give feedback.
-
Hello @leerob I have been working on a full upgrade from the pages directory to the app directory for a couple of months now, and I feel the app router is bringing more complexity and risk to my team’s product. Let me explain. Our project is a fully statically page router generated website (using getStaticProps and getStaticPaths) based on Strapi CMS. With webhooks, we have the ability to revalidate pages. One trick we found was to generate static files for layouts (such as Header, Footer, Translations, etc.) to avoid API consumption when rebuilding or revalidating each page. It worked well, and the app directory looks like a solution to stop using static files and replace this system via Next.js tags. However, with the current system, the CMS can be shut down and the website will still work. Our app is also running on three different Azure instances, so we use Azure Bus to display messages to trigger revalidation on our Next.js app. The flow is not bad: We create/edit a page, send a message to the Azure Bus, our Next.js app reads it and triggers res.revalidate(path), it calls the CMS, and then the page is now live and updated on all three instances (no need to visit). Today, with the app directory, I don't understand why the revalidation is based on the "next visit" of the page to trigger, which causes a major problem for me. In my previous scenario, if I edit the page and my webhook invalidates the cache, if the CMS shut down one of that instance has never been visited, some users will see a 404 page while others will see the cached page. In pages dir, if the CMS is down on revalidation, it will show a previous page version and not a 404. I feel this "visitor" dependency is problematic today because it create a sort of "time depedency" of the pages. Am I the only one thinking this risk? I feel like the risk is really minor, but It exist now |
Beta Was this translation helpful? Give feedback.
-
Is there an official response: Which is better, app router vs page router? Is there accurate data to support the explanation? |
Beta Was this translation helpful? Give feedback.
-
I dont understand why this question can exists. You can just answer it yourself. You should just put your perspective on vercel's point of view don't just see it from yours. First you should know page router is mostly client component and app router mostly for server components For Vercel, static site (client) features doesn't bring much money than server/backend features. People who use nextjs with page router mostly just wants to export static site without server component, Vercel spent a lot of money for nextjs. Of course they want to make it more hard for people to use nextjs outside vercel and wants to force feature that makes a lot of money for them (server components) https://www.epicweb.dev/why-i-wont-use-nextjs Just imagine you spent large budget for nextjs, but all people just use it to export static page and host it on netlify (main competitor). How would you feel? If you can answer this question then you can grasp the concept of their decision making process. this concept mostly align with all past decision they took. So you can already make a prediction what will they do next. Even big company like Chatgpt move out from nextjs recently. |
Beta Was this translation helpful? Give feedback.
👋 Hey, sorry I didn't see this discussion until now!
In short, we're committed to supporting the Pages Router for many years in the future. And then maybe longer even. We believe backwards compatibility is incredibly important, which is why the same features from Next.js 1.0 work in Next.js 14 today (through the Pages Router).
You don't have to move to the App Router. We believe it has features that are beneficial, of course, but all new things take time to mature and bring the community along for the ride. If you're not wanting to try things out just yet, no worries at all.
Further, we're still making Next.js improvements that apply to both routers, like adding Turbopack (through
next de…