React Router 7 apps can now be deployed to Edge Functions
November 10, 2025
React Router 7 apps on Netlify are deployed to Serverless Functions by default. Now, you can choose to deploy your app to Edge Functions instead, bringing your page renders, data loaders, and actions closer to your users while lowering cold start times.
How to use it
- Ensure you’re on version 7.9.0 or later of React Router:
npm install react-router@latest @react-router/node@latest @react-router/dev@latest- Update to the latest version of the Netlify React Router plugin:
npm install @netlify/vite-plugin-react-router@latest- Enable the new
edgeoption in yourvite.config.ts(or.js):
export default defineConfig({ plugins: [ reactRouter(), netlifyReactRouter({ edge: true }), // <- deploy to Edge Functions netlify(), ],})- Finally, create a file at
app/entry.server.tsx(or.jsx) containing this single line:
export { default } from 'virtual:netlify-server-entry'On your next deploy, page renders, loaders, and actions will all run in an edge function.
When to use it
Choose Edge Functions when:
- You need minimal latency for your globally distributed users (edge functions run on the node closest to the user)
- You need to optimize cold starts (initialization is faster with the slim Deno edge runtime)
- Your data loaders and actions make requests to databases and APIs that are also globally distributed, or none at all
- You need to support very large request or response bodies (Serverless Functions have a 6 MB limit)
Choose Serverless Functions when:
- Your data loaders and actions make requests to databases or APIs that are centrally located (canceling out much of the benefit of edge compute)
- Your server-side code is CPU-intensive (Serverless Functions run on more powerful machines)
- You need longer execution times (Functions allow up to 30s clock time, while Edge Functions are limited to 50ms CPU time)
- You cannot use Edge Functions due to their runtime constraints or limitations
Next steps
- Create a new React Router 7 project with our template
- Read the Netlify React Router plugin docs for more details on deploying to the edge