I am needing a little bit more detail in support of this question: Explain data revalidation in Next JS 13
I am using the new next js 13 app directory features for data fetching; as the Next JS 13 documentation states, in the section titled 'Fetching Data on the Server' on this page :
Whenever possible, we recommend fetching data on the server.
The documentation talks about how the new data fetching techniques, like server actions and route handlers, allow client component to communicate with the server to fetch data, rather than fetching it directly in the client. Server actions and route handlers are used for creating dedicated APIs with direct access to a database; however, I am using Supabase, and Supabase generates an API for me to communicate with the database.
As a result, I am debating if it makes sense for me to do my Supabase API calls on a server action or route handler, or (since the Supabase API is already hosted on a supabase server) if a client side api call is fine.
Specifically regarding Next JS advise to fetch data on the server, then call the generated api (server action or route handler), I am a little confused; while server actions and router handlers CAN make api calls for me, is this even necessary? Since I am making a call to a dedicated API route that is served elsewhere RATHER than a direct database call, why not just make the call from the client (example fetch api or react query, just directly in a client component). How would this be different than calling a server action or route handler, since these are just generating apis to be called from the client anyway?