adamjcooperA
Convex Community8mo ago
2 replies
adamjcooper

I’m new to Convex and have some

I’m new to Convex and have some questions about the larger picture of an application that uses Next.js.

Convex describes itself as the missing backend for your frontend. But, given a react frontend, there still seem to be some advantages of using Next.js (eg for SSR or SSG for SEO) that Convex and react alone cannot provide. Am I thinking about that correctly?

But, there is some overlap in concern between Next.js and Convex. For example, I could deploy actions or HTTP APIs to either the Next.JS side or the Convex side.

Which raises an interesting question about auth: which side should be primarily responsible for enforcing it? I tend to think the Next.js side should use and know about the Convex side, but not vice versa. So, that leads me to think that authentication should primarily be the responsibility of the Next.js side.

That said, I do have a strong preference of storing authentication data and user profile data in the Convex database. I have worked in systems before that stored user profile data in an external service like auth0 or clerk, and I dislike it because I cannot include any of that data in a transaction boundary.

What’s unclear to me is how to think about custom authentication when both Next.JS and Convex are in the picture. I would appreciate any general guidance (or correction) to my thinking. Thanks!
Was this page helpful?