Vite plugin that reimplements the Next.js API surface — deploy anywhere
V

Vite plugin that reimplements the Next.js API surface — deploy anywhere

Vite plugin that reimplements the Next.js API surface — deploy anywhere

APIJavaScript
8,280 stars
N/A forks
N/A contributors

README

Project documentation from GitHub

Vite Plugin Lets You Run Next.js APIs Anywhere

If you love the developer experience of Next.js but sometimes wish you could deploy your app on any platform, not just Vercel, there's a new tool you should know about. A Vite plugin is quietly changing the game by letting you take the familiar Next.js API routes and rendering patterns with you, wherever you want to host.

Enter vinext—a project from Cloudflare that re-implements the core Next.js API surface on top of Vite. It’s essentially a compatibility layer that lets you write code that feels like Next.js, but build and deploy it as a standard Vite application. This means you’re no longer locked into a specific deployment ecosystem.

What It Does

In short, vinext is a Vite plugin that mimics the way Next.js handles API routes, server-side rendering (SSR), and static site generation (SSG). You structure your project like a Next.js app (think pages/api/ for APIs and getServerSideProps for data fetching), but under the hood, it's powered by Vite's build system.

When you run the build, vinext processes your pages and API routes, outputting a application that can run on Node.js, Cloudflare Workers, or other platforms that support standard JavaScript deployments. It’s not a full clone of Next.js, but it faithfully replicates the parts developers use most.

Why It’s Cool

The clever part here is the focus on developer experience and portability. Many teams have built muscle memory around Next.js's file-based routing and API design. vinext respects that investment while removing the platform constraint. You can keep writing code the same way, but ship it to your own server, a different edge network, or anywhere else that fits your needs.

It’s also built with performance in mind, leveraging Vite’s fast startup and build times. Since it’s plugin-based, it integrates seamlessly into an existing Vite project, meaning you can incrementally adopt this pattern or mix it with other Vite features.

How to Try It

Getting started is straightforward. You can spin up a new project using the template:

npm create vite@latest my-vinext-app -- --template cloudflare-vinext
cd my-vinext-app
npm install
npm run dev

Or, add it to an existing Vite project:

npm install @cloudflare/vite-plugin-vinext

Then, configure your vite.config.js:

import { defineConfig } from 'vite';
import vinext from '@cloudflare/vite-plugin-vinext'; export default defineConfig({ plugins: [vinext()]
});

From there, start creating files in pages/ just like you wo

Did you like this issue?

Join our weekly newsletter

Related Projects

Love discovering amazing projects?

Help us continue bringing you the best open-source discoveries every week.

Back to Projects
Last updated: Feb 26, 2026