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?

Advanced

Answer

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 Runtime
Real-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.

Common follow-ups: How does runtime choice affect cold start times in a serverless deployment?;Can you switch a route's runtime later without major code changes?