zidZ
Convex Community2y ago
15 replies
zid

Curious how convex team architects around their userId when using Clerk

Im playing around with Next 13/14 (my app is currently in 12).
In doing so, im seeing if i can more efficiently fetch
userId
.

For context, my setup is Convex + Clerk + NextJS.

Thus far (Next 12), I've always used the
userId
generated by convex from my
users
table.
But given the fact that I can fetch Clerk's
userId
on the server, I'm trying to think of the pros/cons of trying to use Clerks userId instead. The main drawback is switching from the db.get(userId) to db.query...unique(), which I think is technically more costly even with an index applied. Then there's convex's prefetching api, where I can gain access to convex serverside. To my understanding, the primary drawback to this is that we're. losing out on convex core guarantees, but if it's just the userId we're fetching, then I assume this should be fine.

All of this to say, given that I'm venturing into a new paradigm with Next 13/14, I would love the opinions from the Convex team on how they handle this and perhaps how to think about this in general. Thank you in advance as always
Was this page helpful?