logoalt Hacker News

twodaveyesterday at 2:27 PM1 replyview on HN

Next is an ok choice (IMO), but there are definitely some things Next does that you want to be aware of up front.

* It wants to be your back-end. If you have a separate back-end, get ready to write back-end auth code twice, and probably in 2 different languages, and some brittle proxy code that will break the next time the Next guys decide they want to change how middleware works (again).

* The maintainers aren't particularly helpful. Having built a couple sites using Next, many of our questions ended up being answered with some variation of, "You're holding it wrong," but it was clear they just didn't want to support our (and other users' submitting issues) scenarios.

* Whether you are on Vercel or not, the team behind Next is very motivated to get you onto Vercel. You can expect their technical choices to go more towards that path. This is at odds with the goals of this project. Coupled with the above, expect to have little to no agency to raise issues and have them solved beyond simple/obvious bug fixes, even after you've invested your project into their platform.

* Next really struggles in situations where your users are your customers' customers, and your customers want something more white-labeled. As soon as this bleeds into the arena of using custom domains per customer and such, some of the advantages of Next start to become disadvantages.

Many of the pieces Next offers are sort of optional, but if you don't fit their idea of how a piece (such as auth via next-auth or their take on server-side components) should work, you're left to solve on your own. It's not the end of the world to have to implement your own auth flow with oidc-client, but it can be a little risky and my brain doesn't hold onto OIDC or OAuth2 so every time I implement an auth flow from scratch I end up having to look up how it should work.

That said, if you end up having to deal with more than a couple of the above things, Next moves from an ok choice for the project to a poor choice.


Replies

moh_quzyesterday at 3:25 PM

This is really helpful context, thanks for writing it out.

You’re right that Next wants to be your backend and thats exactly why I kept the real backend separate in Go.

The Go backend handles all auth, billing, database, everything.

Next is just a frontend that calls the API. So if Next keeps changing things or pushes too hard toward Vercel, you swap it out. The backend doesnt care.

The white-label / custom domain point is interesting, hadnt thought about that edge case. Good to keep in mind.

Honestly the backend is the important part here. The frontend is just one way to consume it