patochem
patochem16mo ago

I'm in a similar situation as @niels

I'm in a similar situation as @niels How would be the syntax to use convex together with a State Management library? I mean, how can I query the convex database without using hooks (ie. useQuery)? Couldn't find anything related to that in the doc
9 Replies
patochem
patochemOP16mo ago
Sorry, I hadn't done my homework correctly. The answer is here: https://docs.convex.dev/client/javascript/node
Node.js | Convex Developer Hub
Convex supports point-in-time queries (see
niels
niels16mo ago
So this could then be used for Next.js server-side right? this ConvexHttpClient
patochem
patochemOP16mo ago
Theoretically yes. Although I'm not sure about Authentication On the "react" side, I'm using Clerk, and having followed the steps in the doc, it works well. But now I'm not sure how to proceed on how to get a Token outside of react In your case, on server-side, I guess having something like a "Service Account" or bot user would be great.. but I don't know if it's possible
niels
niels16mo ago
Kinda a deal breaker.. only client side data fetching natively Might just go for Drizzle ORM
patochem
patochemOP16mo ago
yep
CodingWithJamal
CodingWithJamal16mo ago
You can get the auth token from whatever auth provider your using, convex has nothing to do with that. Clerk has functions to pass the auth token to a backend, check the docs
CodingWithJamal
CodingWithJamal16mo ago
https://clerk.com/docs/references/backend/sessions/get-token#get-token @patochem Youc an get the token from clerk and pass it from the client using cookies
getToken() | Clerk
Retrieves a token for a JWT Template that is defined in the Clerk Dashboard.
CodingWithJamal
CodingWithJamal16mo ago
in the http request Convex react hooks only make it easy to work with auth, but if you do something custom it can still be done in convex.
ballingt
ballingt16mo ago
Re
only client side data fetching natively
the client you linked to can be used anywhere and has a setAuth() method for the JWT. It just becomes your job to send in this JWT to the server you're using the client on.

Did you find this page helpful?