TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/outray-tunnel/outray/llms.txt
Use this file to discover all available pages before exploring further.
@outray/next plugin starts an OutRay tunnel when your Next.js development server boots, printing a public URL alongside the local one — no CLI commands required.
The tunnel only activates when
NODE_ENV=development. It is a no-op in production builds.Setup
Wrap your Next.js config
Import
withOutray and wrap your existing config object in next.config.ts:next.config.ts
Configuration
Pass options as the second argument towithOutray:
next.config.ts
Options
| Option | Type | Default | Description |
|---|---|---|---|
subdomain | string | — | Request a specific subdomain. Requires authentication. |
customDomain | string | — | Use a custom domain configured in the OutRay dashboard. |
apiKey | string | process.env.OUTRAY_API_KEY | API key for authentication. |
serverUrl | string | wss://api.outray.dev/ | OutRay server WebSocket URL. Change this only for self-hosted instances. |
enabled | boolean | process.env.OUTRAY_ENABLED !== "false" | Enable or disable the tunnel. |
silent | boolean | false | Suppress all tunnel status logs. |
local | boolean | false | Enable LAN access via mDNS (.local domain) for devices on the same network. |
onTunnelReady | (url: string) => void | — | Called when the tunnel is established. |
onLocalReady | (info: LocalInfo) => void | — | Called when LAN access is available. |
onError | (error: Error) => void | — | Called when the tunnel encounters an error. |
onClose | () => void | — | Called when the tunnel connection closes. |
onReconnecting | () => void | — | Called when the tunnel is attempting to reconnect. |
Environment variables
| Variable | Description |
|---|---|
OUTRAY_API_KEY | API key for authentication — fallback for the apiKey option. |
OUTRAY_SUBDOMAIN | Subdomain to request — fallback for the subdomain option. |
OUTRAY_SERVER_URL | Server WebSocket URL — fallback for the serverUrl option. |
OUTRAY_ENABLED | Set to "false" to disable the tunnel without removing the plugin. |
NODE_ENV | The tunnel only starts when this is development. |
PORT | The port your Next.js dev server runs on. Defaults to 3000. |
Examples
Custom subdomain
Reserve a consistent URL for your project:next.config.ts
Custom domain
Use a domain you’ve configured in the OutRay dashboard:next.config.ts
LAN access
Enable mDNS so other devices on your local network can reach the dev server:next.config.ts
Callbacks
React to tunnel lifecycle events:next.config.ts
Silent mode
Suppress all console output and handle the URL yourself:next.config.ts
Composing with other plugins
withOutray is a standard Next.js config wrapper and composes normally:
next.config.ts
TypeScript
The package exportsOutrayPluginOptions for typed configuration:
next.config.ts
OutrayPluginOptions interface:
Compatibility
- Next.js: 13.x, 14.x, 15.x
- Routers: App Router and Pages Router
- Bundlers: webpack and Turbopack
The tunnel is started during the webpack configuration phase, which runs even when using Turbopack.
Troubleshooting
Tunnel not starting- Confirm you’re running
next dev(notnext buildornext start). - Check that
OUTRAY_ENABLEDis not set to"false". - Verify the
PORTvariable matches your dev server port.
- Run
outray loginto authenticate, or setOUTRAY_API_KEY.
- The plugin reconnects automatically on connection loss.
- Confirm the server URL is correct (default:
wss://api.outray.dev/).