GUN is a decentralized graph database (or graph synchronization protocol) . Learn how to use the GUN JavaScript API and start writing data to your own peer-to-peer network. https://github.com/amark/gun

#js #database #100SecondsOfCode

🔗 Resources

GUN https://gun.eco/
Bitcoin in 100 Seconds https://youtu.be/qF7dkrce-mQ

 🤓 Install the quiz app

iOS https://itunes.apple.com/us/app/fireship/id1462592372?mt=8
Android https://play.google.com/store/apps/details?id=io.fireship.quizapp

🔥 Watch more with Fireship PRO

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

🎨 My Editor Settings

- Atom One Dark 
- vscode-icons
- Fira Code Font
2024-02-04T05:51:49.954Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
670bd83d-2752-46f4-8e59-500cb1a8c9b1
a226333282015ab412f44f3bc56d7c7683c62e456eacef31fe0d15429d76c0f0
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
Gun.
Js, a decentralized graph database for freedom fighters.
Unlike a centralized database that lives on a server hosted by Big Tech, data in gun is distributed across multiple peers or users through the magic of WebRTC.
An end user like Bob requires a certain graph of data to use your app.
While Alice requires an entirely different one with a few shared data points in between.
Each peer can store the data it needs in the browser's local storage, then sync changes with other peers in the network, a peer might be one of your end users or a relay server that you deploy to make the system more reliable.
That means the entire database is the Union of all graphs on the network, and no one machine controls the entire system.
In other words, it's like a decentralized Firestore where you get real time updates offline mode and the illusion of low latency.
The data itself is managed through a minimal graph API, where each record is a Toad that contains a unique ID or soul, and any other custom data for that entity in plain JavaScript.
Any node on the graph can reference another node, allowing you to create an infinite chain of circular dependencies.
Like, Bob might follow Alice who wrote a post that Bob commented on, which she found offensive, so she banned him.
An individual Node never contains a duplicate of another node, just a reference to it, allowing you to model complex relationships without the need for a schema.
Getting started with Gun.
AS is incredibly easy.
Just install it with NPM into your JavaScript project.
Make a reference to a node with the get method followed by a key for that location, then use put to write data to it.
That'll add a single node to the graph, then we can read it or listen to updates in real time using the on method.
Whenever this node changes on the network, the callback will be fired with the latest data.
We may also want to reference this node in a collection that can be easily queried.
For that, we can create a node called users, then define a mathematical set on it, and add each unique user to that collection.
We can then run a query against it or loop over it, using map to implement our own sorting or filtering logic in JavaScript.
In addition to the database API, it also contains tools for security, encryption, and authorization, allowing you to deploy a production ready database with no single source of truth.
And this has been Gun.
Js in 100 seconds.
If you wanna see a full tutorial on this topic, make sure to let me know in the comments.
I'd really like to put this thing to the test and see how while it scales.
Thanks for watching, and I will see you in the next one.

Speaker 0: Gun. Js, a decentralized graph database for freedom fighters. Unlike a centralized database that lives on a server hosted by Big Tech, data in gun is distributed across multiple peers or users through the magic of WebRTC. An end user like Bob requires a certain graph of data to use your app. While Alice requires an entirely different one with a few shared data points in between.

Each peer can store the data it needs in the browser's local storage, then sync changes with other peers in the network, a peer might be one of your end users or a relay server that you deploy to make the system more reliable. That means the entire database is the Union of all graphs on the network, and no one machine controls the entire system. In other words, it's like a decentralized Firestore where you get real time updates offline mode and the illusion of low latency. The data itself is managed through a minimal graph API, where each record is a Toad that contains a unique ID or soul, and any other custom data for that entity in plain JavaScript. Any node on the graph can reference another node, allowing you to create an infinite chain of circular dependencies.

Like, Bob might follow Alice who wrote a post that Bob commented on, which she found offensive, so she banned him. An individual Node never contains a duplicate of another node, just a reference to it, allowing you to model complex relationships without the need for a schema. Getting started with Gun. AS is incredibly easy. Just install it with NPM into your JavaScript project.

Make a reference to a node with the get method followed by a key for that location, then use put to write data to it. That'll add a single node to the graph, then we can read it or listen to updates in real time using the on method. Whenever this node changes on the network, the callback will be fired with the latest data. We may also want to reference this node in a collection that can be easily queried. For that, we can create a node called users, then define a mathematical set on it, and add each unique user to that collection.

We can then run a query against it or loop over it, using map to implement our own sorting or filtering logic in JavaScript. In addition to the database API, it also contains tools for security, encryption, and authorization, allowing you to deploy a production ready database with no single source of truth. And this has been Gun. Js in 100 seconds. If you wanna see a full tutorial on this topic, make sure to let me know in the comments.

I'd really like to put this thing to the test and see how while it scales. Thanks for watching, and I will see you in the next one.
Gun. Js, a decentralized graph database for freedom fighters. Unlike a centralized database that lives on a server hosted by Big Tech, data in gun is distributed across multiple peers or users through the magic of WebRTC. An end user like Bob requires a certain graph of data to use your app. While Alice requires an entirely different one with a few shared data points in between. Each peer can store the data it needs in the browser's local storage, then sync changes with other peers in the network, a peer might be one of your end users or a relay server that you deploy to make the system more reliable. That means the entire database is the Union of all graphs on the network, and no one machine controls the entire system. In other words, it's like a decentralized Firestore where you get real time updates offline mode and the illusion of low latency. The data itself is managed through a minimal graph API, where each record is a Toad that contains a unique ID or soul, and any other custom data for that entity in plain JavaScript.
firearms
databases
weapons
networking
data management
data
computers
internet
security
Any node on the graph can reference another node, allowing you to create an infinite chain of circular dependencies. Like, Bob might follow Alice who wrote a post that Bob commented on, which she found offensive, so she banned him.
An individual Node never contains a duplicate of another node, just a reference to it, allowing you to model complex relationships without the need for a schema. Getting started with Gun. AS is incredibly easy. Just install it with NPM into your JavaScript project. Make a reference to a node with the get method followed by a key for that location, then use put to write data to it. That'll add a single node to the graph, then we can read it or listen to updates in real time using the on method.
firearms
weapons
Whenever this node changes on the network, the callback will be fired with the latest data. We may also want to reference this node in a collection that can be easily queried. For that, we can create a node called users, then define a mathematical set on it, and add each unique user to that collection.
We can then run a query against it or loop over it, using map to implement our own sorting or filtering logic in JavaScript. In addition to the database API, it also contains tools for security, encryption, and authorization, allowing you to deploy a production ready database with no single source of truth. And this has been Gun. Js in 100 seconds. If you wanna see a full tutorial on this topic, make sure to let me know in the comments. I'd really like to put this thing to the test and see how while it scales. Thanks for watching, and I will see you in the next one.
firearms
measurement
databases
weapons
machine learning
Gun. Js, a decentralized graph database for freedom fighters. Unlike a centralized database that lives on a server hosted by Big Tech, data in gun is distributed across multiple peers or users through the magic of WebRTC. An end user like Bob requires a certain graph of data to use your app. While Alice requires an entirely different one with a few shared data points in between. Each peer can store the data it needs in the browser's local storage, then sync changes with other peers in the network, a peer might be one of your end users or a relay server that you deploy to make the system more reliable. That means the entire database is the Union of all graphs on the network, and no one machine controls the entire system. In other words, it's like a decentralized Firestore where you get real time updates offline mode and the illusion of low latency. The data itself is managed through a minimal graph API, where each record is a Toad that contains a unique ID or soul, and any other custom data for that entity in plain JavaScript. Any node on the graph can reference another node, allowing you to create an infinite chain of circular dependencies. Like, Bob might follow Alice who wrote a post that Bob commented on, which she found offensive, so she banned him. An individual Node never contains a duplicate of another node, just a reference to it, allowing you to model complex relationships without the need for a schema. Getting started with Gun. AS is incredibly easy. Just install it with NPM into your JavaScript project. Make a reference to a node with the get method followed by a key for that location, then use put to write data to it. That'll add a single node to the graph, then we can read it or listen to updates in real time using the on method. Whenever this node changes on the network, the callback will be fired with the latest data. We may also want to reference this node in a collection that can be easily queried. For that, we can create a node called users, then define a mathematical set on it, and add each unique user to that collection. We can then run a query against it or loop over it, using map to implement our own sorting or filtering logic in JavaScript. In addition to the database API, it also contains tools for security, encryption, and authorization, allowing you to deploy a production ready database with no single source of truth. And this has been Gun. Js in 100 seconds. If you wanna see a full tutorial on this topic, make sure to let me know in the comments. I'd really like to put this thing to the test and see how while it scales. Thanks for watching, and I will see you in the next one.
Gun.
gun
Js,
js
a
a
decentralized
decentralized
graph
graph
database
database
for
for
freedom
freedom
fighters.
fighters
Unlike
unlike
a
a
centralized
centralized
database
database
that
that
lives
lives
on
on
a
a
server
server
hosted
hosted
by
by
Big
big
Tech,
tech
data
data
in
in
gun
gun
is
is
distributed
distributed
across
across
multiple
multiple
peers
peers
or
or
users
users
through
through
the
the
magic
magic
of
of
WebRTC.
webrtc
An
an
end
end
user
user
like
like
Bob
bob
requires
requires
a
a
certain
certain
graph
graph
of
of
data
data
to
to
use
use
your
your
app.
app
While
while
Alice
alice
requires
requires
an
an
entirely
entirely
different
different
one
one
with
with
a
a
few
few
shared
shared
data
data
points
points
in
in
between.
between
Each
each
peer
peer
can
can
store
store
the
the
data
data
it
it
needs
needs
in
in
the
the
browser's
browser's
local
local
storage,
storage
then
then
sync
sync
changes
changes
with
with
other
other
peers
peers
in
in
the
the
network,
network
a
a
peer
peer
might
might
be
be
one
one
of
of
your
your
end
end
users
users
or
or
a
a
relay
relay
server
server
that
that
you
you
deploy
deploy
to
to
make
make
the
the
system
system
more
more
reliable.
reliable
That
that
means
means
the
the
entire
entire
database
database
is
is
the
the
Union
union
of
of
all
all
graphs
graphs
on
on
the
the
network,
network
and
and
no
no
one
one
machine
machine
controls
controls
the
the
entire
entire
system.
system
In
in
other
other
words,
words
it's
it's
like
like
a
a
decentralized
decentralized
Firestore
firestore
where
where
you
you
get
get
real
real
time
time
updates
updates
offline
offline
mode
mode
and
and
the
the
illusion
illusion
of
of
low
low
latency.
latency
The
the
data
data
itself
itself
is
is
managed
managed
through
through
a
a
minimal
minimal
graph
graph
API,
api
where
where
each
each
record
record
is
is
a
a
Toad
toad
that
that
contains
contains
a
a
unique
unique
ID
id
or
or
soul,
soul
and
and
any
any
other
other
custom
custom
data
data
for
for
that
that
entity
entity
in
in
plain
plain
JavaScript.
javascript
Any
any
node
node
on
on
the
the
graph
graph
can
can
reference
reference
another
another
node,
node
allowing
allowing
you
you
to
to
create
create
an
an
infinite
infinite
chain
chain
of
of
circular
circular
dependencies.
dependencies
Like,
like
Bob
bob
might
might
follow
follow
Alice
alice
who
who
wrote
wrote
a
a
post
post
that
that
Bob
bob
commented
commented
on,
on
which
which
she
she
found
found
offensive,
offensive
so
so
she
she
banned
banned
him.
him
An
an
individual
individual
Node
node
never
never
contains
contains
a
a
duplicate
duplicate
of
of
another
another
node,
node
just
just
a
a
reference
reference
to
to
it,
it
allowing
allowing
you
you
to
to
model
model
complex
complex
relationships
relationships
without
without
the
the
need
need
for
for
a
a
schema.
schema
Getting
getting
started
started
with
with
Gun.
gun
AS
as
is
is
incredibly
incredibly
easy.
easy
Just
just
install
install
it
it
with
with
NPM
npm
into
into
your
your
JavaScript
javascript
project.
project
Make
make
a
a
reference
reference
to
to
a
a
node
node
with
with
the
the
get
get
method
method
followed
followed
by
by
a
a
key
key
for
for
that
that
location,
location
then
then
use
use
put
put
to
to
write
write
data
data
to
to
it.
it
That'll
that'll
add
add
a
a
single
single
node
node
to
to
the
the
graph,
graph
then
then
we
we
can
can
read
read
it
it
or
or
listen
listen
to
to
updates
updates
in
in
real
real
time
time
using
using
the
the
on
on
method.
method
Whenever
whenever
this
this
node
node
changes
changes
on
on
the
the
network,
network
the
the
callback
callback
will
will
be
be
fired
fired
with
with
the
the
latest
latest
data.
data
We
we
may
may
also
also
want
want
to
to
reference
reference
this
this
node
node
in
in
a
a
collection
collection
that
that
can
can
be
be
easily
easily
queried.
queried
For
for
that,
that
we
we
can
can
create
create
a
a
node
node
called
called
users,
users
then
then
define
define
a
a
mathematical
mathematical
set
set
on
on
it,
it
and
and
add
add
each
each
unique
unique
user
user
to
to
that
that
collection.
collection
We
we
can
can
then
then
run
run
a
a
query
query
against
against
it
it
or
or
loop
loop
over
over
it,
it
using
using
map
map
to
to
implement
implement
our
our
own
own
sorting
sorting
or
or
filtering
filtering
logic
logic
in
in
JavaScript.
javascript
In
in
addition
addition
to
to
the
the
database
database
API,
api
it
it
also
also
contains
contains
tools
tools
for
for
security,
security
encryption,
encryption
and
and
authorization,
authorization
allowing
allowing
you
you
to
to
deploy
deploy
a
a
production
production
ready
ready
database
database
with
with
no
no
single
single
source
source
of
of
truth.
truth
And
and
this
this
has
has
been
been
Gun.
gun
Js
js
in
in
100
100
seconds.
seconds
If
if
you
you
wanna
wanna
see
see
a
a
full
full
tutorial
tutorial
on
on
this
this
topic,
topic
make
make
sure
sure
to
to
let
let
me
me
know
know
in
in
the
the
comments.
comments
I'd
i'd
really
really
like
like
to
to
put
put
this
this
thing
thing
to
to
the
the
test
test
and
and
see
see
how
how
while
while
it
it
scales.
scales
Thanks
thanks
for
for
watching,
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
The speaker explains the concept of a decentralized graph database for freedom fighters, where data is distributed across multiple peers and users through the use of webRTC. The database is a union of all graphs on the network and allows for real-time updates and queries. The speaker also discusses the use of the database in security and authorization, as well as the potential for deploying a production ready database without a single source of truth.
GUN Decentralized Graph DB in 100 Seconds
Gun. Js, a decentralized graph database for freedom fighters. Unlike a centralized database that lives on a server hosted by Big Tech, data in gun is distributed across multiple peers or users through the magic of WebRTC. An end user like Bob requires a certain graph of data to use your app. While Alice requires an entirely different one with a few shared data points in between. Each peer can store the data it needs in the browser's local storage, then sync changes with other peers in the network, a peer might be one of your end users or a relay server that you deploy to make the system more reliable. That means the entire database is the Union of all graphs on the network, and no one machine controls the entire system. In other words, it's like a decentralized Firestore where you get real time updates offline mode and the illusion of low latency. The data itself is managed through a minimal graph API, where each record is a Toad that contains a unique ID or soul, and any other custom data for that entity in plain JavaScript. Any node on the graph can reference another node, allowing you to create an infinite chain of circular dependencies. Like, Bob might follow Alice who wrote a post that Bob commented on, which she found offensive, so she banned him. An individual Node never contains a duplicate of another node, just a reference to it, allowing you to model complex relationships without the need for a schema. Getting started with Gun. AS is incredibly easy. Just install it with NPM into your JavaScript project. Make a reference to a node with the get method followed by a key for that location, then use put to write data to it. That'll add a single node to the graph, then we can read it or listen to updates in real time using the on method. Whenever this node changes on the network, the callback will be fired with the latest data. We may also want to reference this node in a collection that can be easily queried. For that, we can create a node called users, then define a mathematical set on it, and add each unique user to that collection. We can then run a query against it or loop over it, using map to implement our own sorting or filtering logic in JavaScript. In addition to the database API, it also contains tools for security, encryption, and authorization, allowing you to deploy a production ready database with no single source of truth. And this has been Gun. Js in 100 seconds. If you wanna see a full tutorial on this topic, make sure to let me know in the comments. I'd really like to put this thing to the test and see how while it scales. Thanks for watching, and I will see you in the next one.
The speaker explains the concept of a decentralized graph database for freedom fighters, where data is distributed across multiple peers and users through the use of webRTC. The database is a union of all graphs on the network and allows for real-time updates and queries. The speaker also discusses the use of the database in security and authorization, as well as the potential for deploying a production ready database without a single source of truth.