Use of Next JS Server Actions in a project
Hello everyone! would like to get your thoughts on this.
I am working on a next js web app project, using prisma and postgresql (planetscale ). But later would like to build a react native app version of it. can I use server actions for the web app And api for the react native or is it better to use api routes for both ?
i have read mixed opinions about this, and some suggest using GraphQL, or tRPC. Would like to get your thoughts on this
5 Replies
I’m pretty interested in the responses too because I see a lot of debate not even using server actions because of the complexity.
You can use your main api routes as tRPC endpoints. These will have your main functionality and logic. Then, your server actions can become like middlewares, that can internally call other multiple procedures if needed. For react native, still use just tRPC
This is how I try to do it
thanks for your suggestion. makes sense!
I have a repo with this implemented at least once: https://github.com/dBianchii/kodix-turbo
GitHub
GitHub - dBianchii/kodix-turbo
Contribute to dBianchii/kodix-turbo development by creating an account on GitHub.
This used to have react native. But not anymore