I have a lot of business logic that needs to live on the backend
You are not _required_ to use that feature, but if you choose to use it, _that_ is where you'd do all your standard DB connections and returning JSON responses.
You can connect to any database via a tunnel (cloudflare, ...) Or directly with certificate/credentials ( your DB server should allow only connection from the network where you host nextjs)