Best way to fetch, create and update data in Next.js 13 App router

What is the most typesafe way to fetch or mutate data?

Should I use route handlers to create my own api? Should I use server actions?

Would you recommend using "pingdotgg/zact" for server actions?

I'm just curios but can I use server actions to get data from database?
Solution
- You run DB queries inside a server component.
- zact is not supported, use https://github.com/TheEdoRan/next-safe-action instead
GitHub
Type safe and validated Server Actions in your Next.js (App Router) project. - GitHub - TheEdoRan/next-safe-action: Type safe and validated Server Actions in your Next.js (App Router) project.
GitHub - TheEdoRan/next-safe-action: Type safe and validated Server...
Was this page helpful?