Mutation in Convex through NextJS API Routes
Hello, I'm currently working on a NextJS Project where there are multiple riddles where the user will submit their answers. I'm currently evaluating them on the server-side through NextJS 13 API Routes (Route Handlers).
I was wondering how I would create a mutation from NextJS 13 API Routes into Convex to update my DB.
I'm majorly relying on convex real-time for a scoreboard (high-read throughput), but I need the writes to simply just be over HTTP, as I currently validate them through existing NextJS API Routes.
Attached a flow chart of my problem, would love recommendation(s) / resource(s).

5 Replies
It sounds like you want to use the ConvexHttpClient in Next.js to call some mutations.
Thank you! This worked out great!
Dinuma can you share how did you make it work?
@Coffee11 we have simplified the API for this, see docs:
https://docs.convex.dev/client/react/nextjs/server-rendering#server-actions-and-route-handlers
Next.js Server Rendering | Convex Developer Hub
Next.js automatically renders both Client and Server Components on the server
Git it working now thanks !