Back to stack index

Framework

Next.js

React framework for dashboard-style AI apps.

Short answer

Next.js is an open-source React framework from Vercel for building full web applications, with server rendering, API routes and streaming built in. Many open-source AI products use it for their web interface, including Dify's front end, Langfuse, LobeChat, the Morphic AI search engine and Cal.com. The current release is Next.js 16.4.2, from October 15, 2026, which backported stability fixes after an October security update; Next.js 16.4 turned on Cache Components by default for new projects and expanded tooling that lets AI agents perform upgrades. Next.js is free under the MIT license and runs anywhere Node.js runs, not only on Vercel. For self-hosters, the most important thing to know is that Next.js has had serious security vulnerabilities, including the critical React Server Components flaw disclosed in December 2025, so keeping these apps on patched versions matters more than with most front-end code.

Latest release
Next.js 16.4.2, October 15, 2026
Next.js GitHub
License
MIT
Next.js GitHub
16.4 change
Cache Components on by default for new apps
Next.js blog
Directory projects
Dify, Langfuse, LobeChat, Morphic, Cal.com
Project repositories

Updated October 21, 2026How we evaluate tools

Official site

Directory projects (5)

  • Dify

    Visual builder for RAG apps and agents with deployable API endpoints.

  • Langfuse

    Open LLM engineering hub for traces, prompts, scores, and datasets.

  • LobeChat

    Modern chat shell for running and comparing multiple models locally or via API.

  • Morphic

    Generative UI search experience built on open components.

  • Cal.com

    Cal.com handles bookings, polls, or event tickets on your domain with no per-seat scheduling tax.

Next.js in open-source AI tools: the framework behind Dify, Langfuse, LobeChat and Cal.com in 2026

What Next.js does

Next.js wraps React with the pieces a production web app needs: file-based routing, server-side rendering, static generation, API routes, image optimization, and a build system. Since version 13, its App Router runs React Server Components, which render on the server and send finished HTML and data to the browser, while client components handle interaction. For AI apps this split is natural: the server holds API keys and talks to models and databases, and the client shows the chat.

Which directory projects use it

ProjectWhat it isNext.js role
DifyLLM app and agent platformWeb front end; back end is Python
LangfuseLLM tracing and evaluationFull web app and API
LobeChatMulti-provider chatFull app with server routes for providers
MorphicAI answer engine with searchFull app using the Vercel AI SDK
Cal.comScheduling platform with AI featuresWeb app in a large monorepo

Next.js 16

Next.js 16, released in October 2025, made Turbopack the default bundler for development and builds, introduced Cache Components with an explicit use cache directive, and renamed middleware to proxy. The 16.x line has continued with point releases. Next.js 16.4 enabled Cache Components by default for new projects created with create-next-app, and expanded tooling designed to let AI coding agents run framework upgrades. Next.js 16.4.2, on October 15, 2026, backported stability fixes following an October security update.

For self-hosted AI apps, these versions matter mostly through the projects that use them. Dify, Langfuse and LobeChat each choose when to move to a new Next.js release, and you get the change when you upgrade the project.

Streaming AI responses

Next.js supports streaming at several levels. Route handlers can return a ReadableStream, so a server route can forward a model's token stream directly to the browser. Server components can stream HTML in chunks with React Suspense, which lets a dashboard show its layout instantly while slow queries finish. The Vercel AI SDK's streamText function and useChat hook wrap this into a few lines: the route calls a model and returns a stream, and the hook renders messages as they arrive, including tool calls and their results.

When self-hosting behind a reverse proxy such as Nginx, turn off response buffering for streaming routes, or replies will arrive all at once at the end. This is the most common streaming problem in self-hosted Next.js AI apps.

Self-hosting Next.js

Next.js is MIT-licensed and does not require Vercel. To self-host:

  1. Set output: "standalone" in next.config, which produces a minimal server bundle.
  2. Build in Docker with a multi-stage image and run node server.js.
  3. Put a reverse proxy in front for TLS, and turn off buffering for streaming routes.
  4. If you run several instances, configure a shared cache handler, since the default cache is per-instance on disk.
  5. Serve static assets from a CDN for best performance, though the Node server can serve them.

Features that are easiest on Vercel, such as image optimization at scale, incremental static regeneration across regions and edge middleware, all work self-hosted with some configuration. The Next.js team has published an adapter API so other platforms such as Netlify, Cloudflare and AWS can support the framework fully.

Security

Next.js apps run server code, so framework vulnerabilities can be serious:

DateIssueImpact
March 2025CVE-2025-29927, middleware bypassAttackers could skip middleware-based auth checks with a crafted header
December 2025CVE-2025-55182, React Server ComponentsCritical remote code execution on servers using the App Router
October 2026Security updateFixes followed by the 16.4.2 stability backport

The December 2025 flaw, sometimes called React2Shell, was exploited in the wild within days of disclosure. Self-hosted AI apps often hold model API keys and database credentials on the same server, which makes them attractive targets. Practical steps: subscribe to release notifications for every self-hosted Next.js app you run, upgrade promptly when a security release lands, avoid relying only on middleware for authentication, and keep secrets in environment variables scoped to the server.

Performance and cost

A Next.js server typically uses 150 to 500 MB of memory. Server rendering adds CPU per request compared with a static front end, which matters little for internal tools and more for public, high-traffic apps. On Vercel, Hobby is free for personal, non-commercial use and Pro costs $20 a month plus usage; self-hosting on a small virtual server costs $5 to $20 a month. See the Vercel stack page for details.

Next.js and AI coding tools

Next.js is the default output of many AI app builders and coding agents, including v0, Bolt and Lovable, so a large share of AI-generated web apps are Next.js projects. That has a practical effect: when you ask Claude Code, Codex or Cursor to build a web interface for an AI tool, you will usually get Next.js unless you ask otherwise. Vercel publishes guidance and an MCP server for Next.js documentation to help agents use current APIs, since models trained on older data often produce Pages Router code or outdated patterns.

Common problems when self-hosting Next.js AI apps

SymptomLikely causeFix
Replies appear all at onceProxy bufferingSet proxy_buffering off in Nginx for streaming routes, or send the X-Accel-Buffering: no header
Long agent runs cut offProxy or platform timeoutRaise proxy read timeouts; on serverless hosts, check the maximum function duration
Stale data after updatesCached server componentsCheck the project's cache settings and revalidation; restart to clear the on-disk cache
Login loops behind a proxyWrong public URLSet the app's base URL variable, such as NEXTAUTH_URL, to the public HTTPS address
Build fails in DockerMemory limit during buildGive the build container 4 GB or more, or use the project's prebuilt image

Most of these come from the layer in front of Next.js rather than the framework itself. Langfuse and Dify document recommended proxy settings; follow them before debugging application code.

Alternatives

FrameworkLanguageStrength
Remix / React Router 7TypeScriptWeb-standard data loading, simpler mental model
SvelteKitTypeScript/SvelteSmall bundles; used by Open WebUI
NuxtTypeScript/VueThe Vue equivalent of Next.js
AstroTypeScriptContent sites with islands of interactivity
Vite + React SPATypeScriptNo server rendering; simplest to host

Open WebUI, the most popular Ollama front end, uses SvelteKit rather than Next.js, and LibreChat and AnythingLLM use React single-page apps built with Vite. There is no single right choice; Next.js wins on the number of libraries, examples and hosting options, and on AI SDK integration.

Contributing to Next.js AI projects

Expect a pnpm monorepo, TypeScript throughout, Tailwind or a component library for styles, and Playwright for end-to-end tests. Run the dev server with Turbopack for fast reloads. When changing server components, remember that code runs on the server and cannot use browser APIs, and that anything passed to client components is serialized and visible to users.

Related: React stack, Vercel stack, TypeScript stack, Tailwind CSS stack, Langfuse stack, Stack index.

Frequently asked questions

Why do AI apps use Next.js?

It handles the front end and a server layer in one project. Server routes can call model APIs with secret keys while React components stream the reply to the browser. Server components render data-heavy dashboards quickly, and the Vercel AI SDK integrates directly. It is also the framework most AI coding tools generate by default.

Can I self-host a Next.js app without Vercel?

Yes. Next.js runs on any Node.js server or in Docker using the standalone output mode, which bundles only the files the server needs. Dify, Langfuse and LobeChat all ship Docker images that run Next.js on your own infrastructure.

What was the React Server Components vulnerability?

In December 2025 a critical remote code execution flaw, CVE-2025-55182, was disclosed in React Server Components, affecting Next.js apps using the App Router. Attackers could run code on the server with a crafted request. Patched React and Next.js versions were released, and anyone running an affected app should have upgraded immediately.

Is Next.js required to use the Vercel AI SDK?

No. The AI SDK works with any JavaScript framework and plain Node.js, though its React helpers and documentation examples lean toward Next.js.

How do I update a self-hosted Next.js AI app?

Pull the project's latest release or Docker image, which bundles the patched Next.js version. You rarely update Next.js yourself in someone else's project; you update the project. Watch the project's releases page for security notes.

Sources

  1. Next.js releases
  2. Next.js blog
  3. Self-hosting Next.js
  4. React security advisory, December 2025