Beam

Next.js Integration

Seamlessly integrate Beam into your Next.js workflow for automatic tunneling.

Installation

Install the Beam CLI and Next.js plugin:

Terminal
npm install @byronwade/beam @byronwade/beam-next --save-dev

Or using bun/pnpm/yarn:

Terminal
pnpm add -D @byronwade/beam @byronwade/beam-next

Configuration

Wrap your next.config.js with the Beam plugin. This will automatically start a tunnel when you run next dev.

next.config.js
1
2
3
4
5
6
7
8
9
10
11
const { withBeam } = require('@byronwade/beam-next');
/** @type {import('next').NextConfig} */
const nextConfig = {
// Your existing config
};
module.exports = withBeam(nextConfig, {
enabled: process.env.NODE_ENV === 'development',
port: 3000 // default
});

Usage

Just run your development server as usual:

Terminal
npm run dev

You will see the Beam tunnel URL in your console output:

Plain Text
1
2
3
4
5
6
▲ Next.js 14.0.0
- Local: http://localhost:3000
- Network: http://192.168.1.5:3000
➜ Beam: Initializing tunnel...
➜ Beam: http://abcdef123456.onion
➜ Beam: http://project-name.local

Persistent Domains

Beam allows you to own your domain identity on the Tor network. By generating a keypair once and reusing it, your .onion address remains the same across restarts.

For Next.js projects, this means you can configure webhooks (e.g. Stripe, GitHub) to point to your stable onion address and never have to update them again during development.

Support & Community

Report Issues
Found a bug or have a feature request?

Open an issue on our GitHub repository to get help from the team and community.

Open GitHub Issue
Documentation
Help us improve our guides.

This documentation is open source. Feel free to contribute updates or fixes.

Edit on GitHub