0.6.1 • Published 7 months ago

@gun-vue/relay v0.6.1

Weekly downloads
-
License
-
Repository
github
Last release
7 months ago

Gun-Vue: Relay

GitHub (/relay)npmDocs A simple Gun relay peer in Node.js.

This package is part of Gun-Vue: The Peer-to-Peer Web App Toolkit

How to Install

Requirements

Instructions

  1. Create a new Node.js project:
npm init -y
  1. Install the Gun-Vue: Relay package as a dependency:
npm i @gun-vue/relay
  1. Open package.json and add:
"scripts": {
    "start": "node start.js"
  }
  1. Create a start.js script and add:
import relay from "@gun-vue/relay";

relay.init();
  1. Test the relay:
node start.js
Hello wonderful person! :) Thanks for using GUN, please ask for help on http://chat.gun.eco if anything takes you longer than 5min to figure out!
AXE relay enabled!
Server started at http://localhost:8765/gun
Multicast on 233.255.255.255:8765

Options

The relay can be customized with an options object by updating start.js:

relay.init({
	host: "localhost", // Domain or IP address where your relay is hosted (no 'http://')
	port: 8765, // The port your relay will listen on (e.g., 8080)
	store: false, // Use 'true' to enable persistent storage on disk
	path: "public", // Folder to serve static files (e.g., your front-end build)
	showQr: "false", // Render a QR Code Link to the server
});

Alternatively, create a .env file and add the following defaults:

RELAY_HOST="localhost"
RELAY_STORE=false
RELAY_PORT=8765
RELAY_PATH="public"
RELAY_QR=false

Standalone Executable

You can build a standalone executable that bundles Node.js runtime with the relay server. This creates a larger file (≈90MB) but allows for easy distribution and running without Node.js installation.

Building the Executable

  1. Clone the repository and install dependencies:
pnpm install
  1. Browse the /relay/ folder and build the bundled application:
cd relay
pnpm build
  1. Create the platform-specific executable:

For MacOS:

pnpm app:macos

For Windows:

pnpm app:windows

For Linux:

pnpm app:linux

The executable will be created in the dist folder as:

  • MacOS: gun-relay
  • Windows: gun-relay.exe
  • Linux: gun-relay-linux

Running the Executable

Simply double-click the executable or run it from the terminal:

./dist/gun-relay  # MacOS/Linux
.\dist\gun-relay.exe  # Windows

The relay will start with default settings. You can still use environment variables to configure it by creating a .env file in the same directory as the executable.

0.6.1

7 months ago

0.5.2

10 months ago

0.6.0

8 months ago

0.5.1

10 months ago

0.5.0

2 years ago

0.4.2

3 years ago

0.4.1

3 years ago

0.4.0

3 years ago

0.3.8

3 years ago

0.3.7

3 years ago

0.3.6

4 years ago

0.3.0

4 years ago

0.3.5

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.2.1

4 years ago

0.2.0

4 years ago

0.1.7

4 years ago

0.1.6

4 years ago

0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago