12 Replies
Not sure I follow, you use client for some things, server for others. If all of your app’s code can run in the browser and you don’t need a database, you may not need convex. But that’s pretty unlikely to be the case with any app. You’ll need authentication, user data, application data, protected logic that needs to run on the server, etc.
This is true no matter what framework or static site generator you’re using. Not specific to Next.
yeah whats the benefit of using next js with convex if convex can handle all the server side items? do real time queries even work with SSR?
yeah im referring to apps that use convex as a backend to handle auth, data, etc
Convex News
Announcing Convex 1.8
Happy New Year! At Convex we’re kicking the year off with another release!
Highlights:
* New simpler API for loading and preloading data from Convex in Next.js server-side
* Team usage breakdown by function on dashboard
convex/nextjs for Next.js
A new entrypoint in the convex package provides an
Ah I see what you mean - the only tough part is specifically using Server Components, where Convex data isn’t reactive. As you can see in the announcement Lee linked, preloadQuery can now be used server side data fetching while retaining reactivity.
Hey, just wanted to double check - we won't have reactivity if we are using preloadQuery on the server components?
preloadQuery does retain reactivity
Next.js Server Rendering | Convex Developer Hub
Next.js automatically renders both Client and Server Components on the server
Yap, sorry, just read your previous message again and noticed the end) I was just confused because I read docs (which you sent) but I think message didn't mention it🫣
No problem! It’s a bit confusing seeing the preloadQuery docs followed by server component docs that say server component fetching is not reactive, but that section is speaking to fetching without preloading queries.
I have one more question which is might be very dummy but still (sorry for stealing this thread for own questions) - in the docs it says that fetchQuery/fetchMutation and etc using HTTP client under the hood, will those calls calculated as queries/mutations inside pricing plan or as actions? Because if you want to create HTTP api with Convex - you need to use actions (as far as I understood) and not queries, so I was always confused with that moment inside docs for server components.
I'm just curios because in my case the app has client portal and own http api (all based on Convex), so I would assume that if Convex calculates server fetches as http actions - it would be better for me to use as much client components as possible in order to save money (so that way web portal can use queries limit and api can use actions hours)
But again, might dummy topic, sorry about that.
yeah sorry there are two things called HTTP so it's a bit confusing. fetchQuery and fetchMutation use the built-in http api for functions https://docs.convex.dev/http-api/ which is in contrast to the Websocket api used by useQuery/useMutation in React.
HTTP actions https://docs.convex.dev/functions/http-actions are separate, have different pricing, and you are only using them if you have an http.js/http.ts file and are using the .convex.site url.
Convex HTTP API | Convex Developer Hub
Connecting to Convex directly with HTTP
HTTP Actions | Convex Developer Hub
HTTP actions allow you to build an HTTP API right in Convex!
Thank you!