Skip to content
Bo edited this page Jun 5, 2022 · 62 revisions

image

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Quickstart guides - Start creating apps with GUN in a few lines


INSTALLATION: https://github.com/amark/gun/wiki/Installation
API: https://github.com/amark/gun/wiki/API

GETTING STARTED on GitHub Wiki https://github.com/amark/gun/wiki/Getting-Started-(v0.3.x)

GETTING STARTED on GUN website (with interactive tutorials) https://gun.eco/docs/

How to run a node - Deploy a GUN relay server everywhere

GUN can be used in browsers, NodeJS, and mobile.


Basically

const GUN = require('gun');
const server = require('http').createServer().listen(8080);
const gun = GUN({web: server});

With require

const http = require('http')
const Gun = require('gun')

// Uncomment for ES6, and remove requires above
// import http from 'http'
// import Gun from 'gun'

const server = http.createServer()

const host = 'localhost'
const port = 8080

var gun = Gun({
  web: server,
  peers: ['https://relayname.providername.com/gun']
})

server.listen(8080, () => {
  console.log(
    'Server started on port ' + port + ' with /gun',
  )
  gun.get('test').on(data => console.log(data))
})

Without require

If you want to use import instead of require, just update your package.json file with "type":"module" right after "main":
Making your code ES6 makes life a lot easier when it comes to needing async/await.
You can just await anywhere without needing an async function

import http from 'http'
import Gun from 'gun'

const server = http.createServer()

const host = 'localhost'
const port = 8080

var gun = Gun({
  web: server,
  peers: ['https://relayname.providername.com/gun']
})

server.listen(8080, () => {
  console.log(
    'Server started on port ' + port + ' with /gun',
  )
  gun.get('test').on(data => console.log(data))
})

Browser

https://github.com/amark/gun/wiki/Browser

Node

https://github.com/amark/gun/wiki/Node---HTTP

Server with basic example (gun in action)

https://github.com/amark/gun/wiki/Server-with-basic-example-(gun-in-action)

1-Click Deploy

https://www.heroku.com/deploy/?template=https://github.com/amark/gun

Local-Desktop-Gun-Relay-(Windows,-Linux,-MAC)

https://github.com/amark/gun/wiki/Local-Desktop-Gun-Relay-(Windows,-Linux,-MAC)

Android

https://github.com/amark/gun/wiki/Android

Raspberry Pi

https://github.com/amark/gun/wiki/RaspberryPi

Gun Relay Donation Tool - Taking the dev 1-click-deploy and turning it into a consumer 1-click deploy!

https://github.com/amark/gun/wiki/Gun-Relay-Donation-Tool

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Clone this wiki locally