maybe icon indicating copy to clipboard operation
maybe copied to clipboard

Migrate from Next.js Pages to App router

Open coltonehrman opened this issue 1 year ago • 6 comments

Not sure if this is a priority or not, but I personally would like to have App router vs Pages.

https://nextjs.org/docs/app/building-your-application/upgrading/app-router-migration#migrating-from-pages-to-app

coltonehrman avatar Jan 14 '24 16:01 coltonehrman

There's an opportunity here to entirely remove the separate server package and usage of tRPC. There's a decent chunk of endpoints, but not a overwhelming amount. A lot of that extra "glue" code between client and server can be removed in the process of moving towards App Router + Server Components + Server Actions.

I noticed, for example, it's using the Pages Router patten of adding getLayout (which was the kind of hacky way of having layouts support before it was a built-in primitive). Now, it probably makes the most sense to incrementally tackle this rather than doing it all at once.

For example, since most of the data fetching here seems to be client-side through custom React hooks, the first step of incremental adoption here would be to make the entry into the application (the top level page) as a Client Component with "use client".

I'm happy to answer questions and possibly even try to assist (or code review) in places here!

leerob avatar Jan 14 '24 17:01 leerob

Hey @leerob stoked to see you here! Would definitely love your input and guidance as things continue to progress.

tmyracle avatar Jan 14 '24 17:01 tmyracle

I migrated our entire turborepo (3 client apps and a server app) in my last company from Next.js pages to app router when it was just released so I would love to take this up. And what could be better than having the opportunity to ask questions directly to @leerob himself 🙏

ExplorerAadi avatar Jan 23 '24 09:01 ExplorerAadi

@ExplorerAadi My suggestion is to open a draft PR and outline your general gameplan on what work you plan on doing. Then others can add comments to that as well as review code changes as you're working on them.

Shpigford avatar Jan 23 '24 13:01 Shpigford

Hey everyone! I've created a draft PR for this, please check it out and drop any suggestions you have.

CodeWithShreyans avatar Jan 23 '24 17:01 CodeWithShreyans

Thanks a lot @Shpigford . I was actually going through the app and noting down the point to plan the upgrade and then raise a better draft request.

ExplorerAadi avatar Jan 24 '24 06:01 ExplorerAadi