Next.js › Edge Runtime vs Node.js Runtime
What factors should guide the decision between using the Edge Runtime or the Node.js Runtime for a given feature?
AdvancedAnswer
Consider whether the feature needs low latency for a globally distributed audience, whether it depends on Node.js specific packages or file system access, how much memory and execution time it needs, and whether it connects to a database that requires a persistent connection, since these all favor different runtimes.
// Quick, globally distributed checks: Edge Runtime
// Heavy processing, file access, or complex database work: Node.js RuntimeReal-world example A video streaming platform uses the Edge Runtime for authentication checks that need to happen instantly everywhere, but processes video transcoding jobs using the Node.js Runtime because that work needs more memory and native library support.