OpenNext takes the Next.js build output and converts it into a package that can be deployed to any functions as a service platform. As of now only AWS Lambda is supported.
While Vercel is great, it's not a good option if all your infrastructure is on AWS. Hosting it in your AWS account makes it easy to integrate with your backend. And it's a lot cheaper than Vercel.
Next.js, unlike Remix or Astro, doesn't have a way to self-host using serverless. You can run it as a Node application. This however doesn't work the same way as it does on Vercel.
There have been several attempts to fix this. Broadly falling into two categories; open source framework specific implementations, or closed source SaaS products.
Most of the open source options, like serverless-nextjs (opens in a new tab) are dead. Their implementation can also be specific to the framework they are targeting.
Closed source SaaS products like Amplify (opens in a new tab) have incomplete or incorrect implementations. And because they are closed source, you'll need to file a support ticket to get them updated.
The goal of OpenNext is to create an open source, framework agnostic, serverless adapter for Next.js.
OpenNext is currently built for AWS but we plan to support any functions as a service platform.
OpenNext aims to support all Next.js 13 features. Some features are work in progress. Please open a new issue (opens in a new tab) to let us know!
- App & Pages Router
- API routes
- Dynamic routes
- Static site generation (SSG)
- Server-side rendering (SSR)
- Incremental static regeneration (ISR)
- Image optimization
- NextAuth.js (opens in a new tab)
- Running at edge
- No cold start
- Experimental streaming support