npm package: @openuiai/next
Description: OpenNext.js - A development-focused fork of Next.js with Bun support
Latest version: 16.3.0

<div align="center">
  <a href="https://github.com/openuiai/next.js">
    <img alt="OpenNext.js logo" src="https://raw.githubusercontent.com/openuiai/next.js/production/assets/OpenNext.js.png" height="128">
  </a>
  <h1>OpenNext.js</h1>

<a href="https://github.com/openuiai/next.js"><img alt="Fork status" src="https://img.shields.io/badge/FORK-Self%20Hosted%20First-green.svg?style=for-the-badge&labelColor=000"></a>
<a href="https://www.npmjs.com/package/@openuiai/next"><img alt="NPM version" src="https://img.shields.io/npm/v/@openuiai/next.svg?style=for-the-badge&labelColor=000000"></a>
<a href="https://github.com/openuiai/next.js/blob/production/license.md"><img alt="License" src="https://img.shields.io/npm/l/next.svg?style=for-the-badge&labelColor=000000"></a>
<a href="https://github.com/openuiai/next.js/discussions"><img alt="Join the community on GitHub" src="https://img.shields.io/badge/Join%20the%20community-blueviolet.svg?style=for-the-badge&logo=Next.js&labelColor=000000&logoWidth=20"></a>

</div>

> **This is a modified fork of Next.js optimized for runtime flexibility and self-hosted deployments.**

## Why This Fork?

**Run Next.js anywhere, your way.** This fork removes vendor lock-in and gives you the freedom to choose your runtime and bundler:

- **Bun Runtime** — Run your entire Next.js app on Bun for blazing-fast startup, native TypeScript, and up to 4x faster installs
- **Rspack Bundler** — Drop-in Webpack alternative with significantly faster build times
- **Self-Hosted First** — Optimized for your own infrastructure, not only Vercel
- **Production Ready** — All build processes passing, TypeScript fully supported

---

## Run Next.js on Bun

Drop-in Bun compatibility. No configuration needed—use `bun` instead of `node`:

```bash
bun install          # 4x faster than npm
bun run dev          # Native TypeScript, instant startup
bun run build        # Production builds
bun run start        # Production server on Bun
```

### Why Bun?

| Benefit | What You Get |
|---------|--------------|
| **Instant Startup** | Bun's optimized runtime starts in milliseconds |
| **Native TypeScript** | No transpilation step—run `.ts` files directly |
| **4x Faster Installs** | `bun install` leaves npm/yarn/pnpm in the dust |
| **Lower Memory** | JavaScriptCore engine uses less memory than V8 |
| **Faster Processes** | `Bun.spawn()` outperforms Node.js child_process |

### Full Compatibility

This fork includes a comprehensive adapter layer that makes Next.js work seamlessly on Bun:

- **Automatic Runtime Detection** — Detects Bun/Node.js and optimizes accordingly
- **Process Adapter** — Uses `Bun.spawn()` for all child processes
- **AsyncLocalStorage** — Full support with Bun-specific optimizations
- **Module Loading** — Leverages Bun's native TypeScript support

### Bun Limitations

Transparency matters. Here's what to know:

| Feature | Status | Notes |
|---------|--------|-------|
| Core Next.js | ✅ Full | Pages, App Router, API routes all work |
| AsyncLocalStorage | ✅ Full | Server Actions, rendering context preserved |
| Child Processes | ✅ Full | Uses faster `Bun.spawn()` under the hood |
| Source Maps | ⚠️ Graceful fallback | Stack traces work; programmatic resolution limited |
| node:crypto | ⚠️ Partial | Some methods unavailable; Web Crypto works |
| node:vm | ⚠️ Limited | Edge cases may differ from Node.js |
| Complex IPC | ⚠️ Partial | For heavy IPC, consider Node.js |

---

## Use Rspack Instead of Webpack

Get faster builds with Rspack—a Rust-based Webpack-compatible bundler:

```bash
# Just set the environment variable
NEXT_RSPACK=1 bun run dev
NEXT_RSPACK=1 bun run build
```

Rspack provides significantly faster build times while maintaining Webpack compatibility. Experimental but functional.

---

## Current Status

| Component | Status |
|-----------|--------|
| Build System | ✅ All processes passing |
| Bun Runtime | ✅ Full Bun 1.x support |
| Rspack Bundler | ✅ Experimental, functional |
| TypeScript | ✅ All declaration errors resolved |
| Webpack | ✅ Production-ready (default) |

---

## Documentation

- [PROJECT_STATUS.md](./PROJECT_STATUS.md) — Complete project analysis
- [TODO.md](./TODO.md) — Build testing checklist

## Getting Started

Used by some of the world's largest companies, Next.js enables you to create full-stack web applications by extending the latest React features, and integrating powerful JavaScript tooling for fast builds.

- Visit our [Learn Next.js](https://nextjs.org/learn) course to get started with Next.js.
- Visit the [Next.js Showcase](https://nextjs.org/showcase) to see more sites built with Next.js.

## Documentation

Visit [https://nextjs.org/docs](https://nextjs.org/docs) to view the full documentation.

## Community

The OpenNext.js community can be found on [GitHub Discussions](https://github.com/openuiai/next.js/discussions) where you can ask questions, voice ideas, and share your projects with other people.

Do note that our [Code of Conduct](https://github.com/openuiai/next.js/blob/production/CODE_OF_CONDUCT.md) applies to all community channels. Users are **highly encouraged** to read and adhere to it to avoid repercussions.

## Contributing

Contributions to OpenNext.js are welcome and highly appreciated. However, before you jump right into it, we would like you to review our [Contribution Guidelines](/contributing.md) to make sure you have a smooth experience contributing.

### Good First Issues:

We have a list of **[good first issues](https://github.com/openuiai/next.js/labels/%22good%20first%20issue%22)** that contain bugs that have a relatively limited scope. This is a great place for newcomers and beginners alike to get started, gain experience, and get familiar with our contribution process.

---
## Security

If you believe you have found a security vulnerability in OpenNext.js, we encourage you to **_responsibly disclose this and NOT open a public issue_**.

Please report security issues via [GitHub Security Advisories](https://github.com/openuiai/next.js/security/advisories/new).