• Stars
    star
    614
  • Rank 73,061 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Back end web app services over WebRTC.

Browser-to-browser networking built on WebTorrent. Web service bug-out bag. Messageboard demo. Bugout demo.

  • Easily send messages directly between browsers.
  • Write servers that run in a browser tab.
  • Host backend services without a VPS, domain or SSL cert.
  • Easy to deploy & "self-hosted" servers by leaving a browser tab open.
  • Client-server over WebRTC instead of HTTPS.

The old way:

The new way:

Bugout is a humble attempt to re-decentralize the web a little.

This is a functional prototype. It's pre-alpha quality software. It will allow people to connect directly to your browser from outside your network. Be careful.

Demos | Install | Use | API documentation | Server boilerplate | Deploy headless

Demos

Install

Using npm:

npm i bugout

Script tag:

<script src="https://chr15m.github.io/bugout/bugout.min.js"></script>

Clojurescript:

:install-deps false
:npm-deps {"bugout" "chr15m/bugout"}
:foreign-libs [{:file "node_modules/bugout/docs/bugout.min.js"
		:provides ["cljsjs.bugout"]
		:global-exports {cljsjs.bugout Bugout}}]

(:require [cljsjs.bugout :as Bugout])

Use

var Bugout = require("bugout");

To create a Bugout server that runs in a browser tab:

var b = new Bugout();

// get the server address (public key hash) to share with clients
// this is what clients will use to connect back to this server
alert(b.address());

// register an API call the remote user can make
b.register("ping", function(address, args, callback) {
  // modify the passed arguments and reply
  args.hello = "Hello from " + b.address();
  callback(args);
});

// save this server's session key seed to re-use
localStorage["bugout-server-seed"] = b.seed;

// passing this back in to Bugout() means the
// server-public-key stays the same between reloads
// for example:
// b = new Bugout({seed: localStorage["bugout-server-seed"]});

To start a client connection specify the server's public key to connect to (b.address() from the server):

var b = new Bugout("server-public-key");

// wait until we see the server
// (can take a minute to tunnel through firewalls etc.)
b.on("server", function(address) {
  // once we can see the server
  // make an API call on it
  b.rpc("ping", {"hello": "world"}, function(result) {
    console.log(result);
    // {"hello": "world", "pong": true}
    // also check result.error
  });
});

// save this client instance's session key seed to re-use
localStorage["bugout-seed"] = JSON.stringify(b.seed);

Both clients and servers can interact with other connected clients:

// receive all out-of-band messages from the server
// or from any other another connected client
b.on("message", function(address, message) {
  console.log("message from", address, "is", message);
});

// broadcast an unecrypted message to all connected clients
b.send({"hello": "all!"});

// send an encrypted message to a specific client
b.send(clientaddress, "Hello!");

// whenever we see a new client in this swarm
b.on("seen", function(address) {
  // e.g. send a message to the client we've seen with this address
});

// you can also close a bugout channel to stop receiving messages etc.
b.close();

Note that you can connect to a generic peer-to-peer swarm without a server by simply using a non-public-key identifier which can be any string as long as it's the same for every client connecting:

var b = new Bugout("some shared swarm identifier");

Boilerplate

The quick-start boilerplate server in a single HTML file will quickly get you up and running with your own Bugout server.

Options

See the API documentation for options.

Turn on debug logging

localStorage.debug = "bugout";

Deploy

Bugout servers can deployed and run inside of browser tabs on long running PCs but you can also deploy them "headless" more like traditional servers. There are a couple of ways of doing that as follows:

Headless browser server

Bugout launcher is a nodejs based helper script to launch and run your Bugout servers from the command line using a headless browser instance.

Nodejs

Check out the nodejs demo for an example of running a Bugout service under Node. Note that the wrtc library is not that stable at the time of writing and running Bugout in headless Chrome or Firefox seems to work better. Bugout servers running inside nodejs obviously won't have access to browser facilities like localStorage.

Stay updated

Subscribe at bugout.network for updates and new releases.

The FAMGA virus

Infected with the FAMGA virus everybody's eating brains. Time to grab yr bugout box & hit the forest.

More Repositories

1

DoodleCSS

A simple hand drawn HTML/CSS theme
HTML
1,049
star
2

flk

A LISP that runs wherever Bash is
Shell
498
star
3

slingcode

personal computing platform
Clojure
410
star
4

sitefox

Node + cljs backend web framework
Clojure
290
star
5

awesome-clojure-likes

Curated list of Clojure-like programming languages.
184
star
6

rogule.com

A dungeon a day keeps the Balrog away
JavaScript
177
star
7

gitnonymous

Make pseudonymous Git commits over Tor
Shell
176
star
8

PodSixNet

Lightweight multiplayer network library for python games
Python
165
star
9

motionless

Generate static sites with code.
JavaScript
78
star
10

dirc

p2p IRC-inspired self-hosted web chat.
Clojure
77
star
11

blender-hylang-live-code

Live-coding Blender with Hy(lang)
Hy
69
star
12

jsGameSoup

Make games with Javascript.
JavaScript
66
star
13

roguelike-browser-boilerplate

A boilerplate for browser based Roguelike game development
JavaScript
62
star
14

PdDroidParty

Run Pure Data DSP patches on Android - native GUIs emulated.
Java
62
star
15

minimal-stylesheet

CSS to get a web app up and running
HTML
60
star
16

twiiit.com

A redirecting proxy for Nitter
JavaScript
55
star
17

build-decentralized-web-app

Build a decentralized web chat in 15 minutes
HTML
52
star
18

SyncJams

Network-synchronised metronome and state dictionary for music applications.
Pure Data
45
star
19

pd-ws

Websocket communication for Pure Data.
HTML
43
star
20

svg-flipbook

SVG flipbook animation with layers
Clojure
40
star
21

speccy

eight-bit algorave livecoding in clojurescript
Clojure
39
star
22

dreamtime

Peer-to-peer for shell scripts.
JavaScript
38
star
23

aish

Shell script one-liners right in your terminal prompt
Shell
23
star
24

webrtc-signaling-mesh

Decentralized signaling for WebRTC
Clojure
23
star
25

tweetfeast.com

Twitter sentiment analysis SaaS
JavaScript
23
star
26

ntpl

Manipulate and render HTML in Python
Python
22
star
27

frock

Clojure-flavoured PHP
PHP
22
star
28

aSid

Moog-like synth for Commodore 64
C
16
star
29

catch-all-errors

Catch all JavaScript errors and post them to your server
JavaScript
16
star
30

roguelike-celebration-2021

Talk: Building Juicy Minimal Roguelikes in the Browser
HTML
14
star
31

drillbit

Algorave drill-n-bass-ish music generator.
Hy
13
star
32

livereload.net

Browser live-reloading web dev tool
Clojure
11
star
33

lolPd

Tiny wrist-saving DSL for Pure Data.
Pure Data
11
star
34

pd-acid-core

303-style acid instrument for Pure Data.
11
star
35

PocketSync

App to sync pocket operator devices
HTML
11
star
36

media-remote

Reverse engineered S*ny "Android Media Remote" for nodejs
JavaScript
11
star
37

makesprite

Make game sprites with image generators
Clojure
11
star
38

create-sitefox-nbb

Get a ClojureScript + sitefox + nbb server with one command
Clojure
11
star
39

juice-it

CSS game juice animations
CSS
10
star
40

c64core

retrocompute aesthetics twitter bot
Clojure
10
star
41

hexadecimal-die

OpenSCAD script to generate a sixteen sided "spherical cap" style hexadecimal die.
OpenSCAD
10
star
42

ball-smash-dungeon

ball physics roguelike
Clojure
9
star
43

create-shadowfront

Quickly bootstrap ClojureScript + shadow-cljs + Reagent
JavaScript
7
star
44

bitcoin-random-oracle

Use the Bitcoin network as an entropy source.
Python
7
star
45

graphviz-livecoder

Live-code Graphviz
Makefile
7
star
46

sitefox-payments

Stripe subscriptions for Sitefox sites
Clojure
7
star
47

blockhead

A collection of Pure Data abstractions styled after rjlib.
Pure Data
7
star
48

speedy-spa

Fast loading material SPA test in LISP
CSS
7
star
49

algotracker

Algorithmic module tracker generator
JavaScript
6
star
50

motion

svg + react motion graphic experiments
Clojure
6
star
51

jqDeclare

jQuery plugin for React-style declarative UIs.
HTML
6
star
52

pd-algobreaks-core

Pure Data patches for making procedural breakbeats.
Pure Data
6
star
53

autotracker

Ben Russell's autotracker extended
Python
5
star
54

htabuilder

LISP to MS Windows HTA app experiment
JavaScript
5
star
55

marcus

Index and search browser bookmarks from the command line.
Hy
5
star
56

itwriter

Write Impulse Tracker modules with JavaScript
JavaScript
5
star
57

scittle-claude-ai

Prompt Claude AI for ClojureScript & Reagent web app artifacts.
HTML
5
star
58

pocketoperations.com

source code to this website
HTML
4
star
59

bitcoin-notebook

Reproduceable blockchain queries for science.
Python
4
star
60

GarageAcidLab

Pure Data patches and scripts that were used to create the squeakyshoecore records as well as the Android app.
Pure Data
4
star
61

riceprioritization.com

A web app to prioritize your options
Clojure
4
star
62

Infinite8BitPlatformer

User-created-content pixel-aesthetic multiplayer game.
Python
4
star
63

808-thing

Pure Data 808 rc-patches wrapper thing.
Pure Data
4
star
64

pd-net-sync

Utilities for synchronising the timing and data of Pure Data patches on a network.
Pure Data
4
star
65

cljs-ultralight

Utilities for making small ClojureScript UI artifacts
Clojure
4
star
66

michaelsoftproject.com

Simple online Gantt chart planner
JavaScript
4
star
67

pd-midi-guis

Abstractions for doing midi-learn buttons and faders in Pure Data.
Pure Data
3
star
68

sssad

Frank Barknect's sssad (state saving) Pure Data abstractions.
Pure Data
3
star
69

tiny-web-game-engine

Tiny game engine for the web
Clojure
3
star
70

reagent-node-render-demo

Demo of rendering a reagent component from nodejs
Clojure
3
star
71

blender-iso-render-bot

Blender script to render isometric sprites
Python
3
star
72

hexatron

Roguelike rendered minimally in three dimensions
Clojure
3
star
73

gba-gpio-tester

Test the GPIO hardware pins on your GBA.
Makefile
3
star
74

liveloops

Console mode audio looping from decades of yore.
C
3
star
75

MonsterVST

Build VST .dlls on Linux, cross compiled for Windows.
C++
3
star
76

cljs-dopeloop

Webaudio utils for dopeloop.ai
Clojure
3
star
77

bootstrappingthis.com

Landing page generator
JavaScript
3
star
78

weeklybeats-2016

Algorithmic rave music 2016
Hy
3
star
79

fugr

Web based RSS feed reader (stalled)
Python
3
star
80

CanOfBeats-droidparty

Procedural hip hop generator for mobile devices.
Pure Data
3
star
81

castpranker.com

Prank your family with chromecast!
HTML
3
star
82

decentral-utils

JavaScript function utils for web decentralization
JavaScript
3
star
83

php-image-paste-upload

PHP page where you can paste images to upload them
PHP
3
star
84

bugout-box

Bugout service manager
Clojure
3
star
85

dorcx

A personal social network built on your email box.
Python
3
star
86

pinfeed

Full-size Pinterest image feed.
HTML
3
star
87

scrypt-hashcash

Scrypt hashcash implementation for node & browsers.
JavaScript
3
star
88

DoodleRogue

A hand drawn roguelike tileset
Makefile
3
star
89

one-million-or-dead

(game) fear and greed and compound interest
Clojure
2
star
90

s-abstractions

A collection of abstractions for the Pure Data patching language
Python
2
star
91

rss-to-newsletter

Web app to turn your RSS feeds into newsletter posts
JavaScript
2
star
92

clojurescript-threejs-playground

Playing with Clojurescript and Three.js with figwheel in between
Clojure
2
star
93

create-sitefox-shadow-fullstack

Bootstrap a full stack Sitefox + shadow-cljs app
Clojure
2
star
94

HypeFrame

HTML5 game boilerplate WIP
JavaScript
2
star
95

emorogue

Roguelikes with emojis
Clojure
2
star
96

algorave-live-rig

Pure Data rig for live mixing algorave
Pure Data
2
star
97

GarageAcidLab-droidparty

Procedural acid for mobile devices.
Pure Data
2
star
98

pdvst-fx

Collection of PdVST music effects
Pure Data
2
star
99

bugout.network

CSS
2
star
100

gnu-linux-in-tiny-places-plug

Talk: GNU/Linux in tiny places (PLUG)
HTML
2
star