Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsJul 16, 2026·3 min de lecture

OpenNext — Run Next.js on AWS Without Vendor Lock-In

An open-source adapter that packages Next.js applications for deployment on AWS Lambda, CloudFront, and S3, providing a self-hosted alternative to Vercel.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
OpenNext
Commande d'installation directe
npx -y tokrepo@latest install 1d9812f0-80af-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

OpenNext is an open-source adapter that takes a standard Next.js build output and packages it for deployment on AWS infrastructure. It bridges the gap between Next.js features (SSR, ISR, middleware, image optimization) and AWS services (Lambda, CloudFront, S3), giving teams full control over their hosting without sacrificing Next.js capabilities.

What OpenNext Does

  • Converts Next.js build output into AWS-compatible Lambda functions
  • Handles server-side rendering, static generation, and incremental static regeneration on AWS
  • Supports Next.js middleware via CloudFront Functions or Lambda@Edge
  • Provides image optimization through a dedicated Lambda function
  • Manages cache revalidation with SQS or direct invocation patterns

Architecture Overview

OpenNext transforms the Next.js standalone build into a deployment package with three main components: a server function (Lambda) for SSR and API routes, a static asset bucket (S3) for pre-rendered pages and assets, and a CDN distribution (CloudFront) for routing and caching. Middleware runs at the edge via CloudFront Functions. ISR revalidation uses a separate queue-based mechanism to avoid cold-start latency on cache updates.

Self-Hosting & Configuration

  • Add open-next as a dependency to your existing Next.js project
  • Run npx open-next build to generate the AWS deployment package
  • Deploy using SST, CDK, Terraform, or any AWS IaC tool
  • Configure custom domains and SSL certificates through CloudFront
  • Tune Lambda memory, timeout, and concurrency settings per function

Key Features

  • Supports App Router and Pages Router with full SSR/ISR/SSG
  • Next.js middleware runs at the edge with low latency
  • Image optimization without Vercel's proprietary service
  • Works with SST, CDK, Terraform, Pulumi, and raw CloudFormation
  • Active community maintaining compatibility with latest Next.js releases

Comparison with Similar Tools

  • Vercel — seamless Next.js hosting but proprietary and can be expensive at scale
  • Netlify — supports Next.js but with feature gaps in ISR and middleware
  • AWS Amplify Hosting — managed AWS option but slower to adopt new Next.js features
  • Coolify — self-hosted PaaS but not AWS-optimized for Next.js
  • Docker deployment — works but loses edge caching and serverless scaling benefits

FAQ

Q: Does OpenNext support all Next.js features? A: It supports SSR, SSG, ISR, middleware, API routes, image optimization, and App Router. Check the compatibility matrix in the docs for edge cases.

Q: Do I need SST to use OpenNext? A: No. SST is the recommended deployment tool, but OpenNext's build output works with any AWS IaC tool including CDK, Terraform, and Pulumi.

Q: How much does it cost to run Next.js on AWS with OpenNext? A: Costs depend on traffic. For many applications, AWS Lambda and CloudFront are significantly cheaper than equivalent Vercel plans, especially at scale.

Q: Can I migrate from Vercel to OpenNext? A: Yes. OpenNext is designed as a drop-in build step for existing Next.js projects. No code changes are required in most cases.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires