1 | <h1>
|
2 | <a href="http://gundb.io">
|
3 | <img src='https://cldup.com/TEy9yGh45l.svg'
|
4 | width='40%'
|
5 | alt="gun" />
|
6 | </a>
|
7 | </h1>
|
8 |
|
9 | [![npm](https://img.shields.io/npm/dm/gun.svg)](https://www.npmjs.com/package/gun)
|
10 | [![Travis](https://img.shields.io/travis/amark/gun/master.svg)](https://travis-ci.org/amark/gun)
|
11 | [![Gitter](https://img.shields.io/gitter/room/amark/gun.js.svg)](https://gitter.im/amark/gun)
|
12 |
|
13 | GUN is a realtime, distributed, offline-first, graph database engine. Doing **[25M+](https://github.com/amark/gun/wiki/100000-ops-sec-in-IE6-on-2GB-Atom-CPU) ops/sec** in just **~12KB** gzipped.
|
14 |
|
15 | <a href="https://youtu.be/-i-11T5ZI9o" title="1 minute demo of fault tolerance"><img src="http://img.youtube.com/vi/-i-11T5ZI9o/0.jpg" width="425px"></a>
|
16 | <a href="https://youtu.be/-FN_J3etdvY" title="1 minute demo of fault tolerance"><img src="http://img.youtube.com/vi/-FN_J3etdvY/0.jpg" width="425px"></a>
|
17 |
|
18 | > Warning: We're merging 0.5 branch into Master, you may experience some hiccups - please report them!
|
19 |
|
20 | ## Why?
|
21 |
|
22 | - **Realtime** - It may be trivial to get realtime updates with socket.io or something, but what you do not get is *state synchronization*. GUN does this for you out of the box, assuring that two users' simultaneous updates won't concurrently break each other.
|
23 | - **Distributed** - GUN is peer-to-peer by design, meaning you have no centralized database server to maintain or that could crash. This lets you sleep through the night without worrying about database DevOps - we call this "NoDB". From that, you can build decentralized, federated, or centralized apps.
|
24 | - **Offline-first** - GUN works even if your internet or cell reception doesn't. Users can still plug away and save data as normal, and then when the network comes back online GUN will automatically synchronize all the changes and handle any conflicts for you.
|
25 | - **Graph** - Most databases force you to bend over backwards to match their storage constraints. But graphs are different, they let you have any data structure you want. Whether that be traditional tables with relations, document oriented trees, or tons of circular references. You choose.
|
26 |
|
27 | ## Quickstart
|
28 |
|
29 | - Try the [interactive tutorial](http://gun.js.org/think.html) in the browser (**5min** ~ average developer).
|
30 | - Or run the NodeJS examples `npm install gun && cd node_modules/gun && npm start` (**5min** ~ average developer).
|
31 |
|
32 | > **Note:** If you don't have [node](http://nodejs.org/) or [npm](https://www.npmjs.com/), read [this](https://github.com/amark/gun/blob/master/examples/install.sh) first.
|
33 | > If the `npm` command line didn't work, you may need to `mkdir node_modules` first or use `sudo`.
|
34 |
|
35 | - Or write a quick app: ([try now in jsbin](http://jsbin.com/saxewigote/edit?js,console))
|
36 | ```html
|
37 | <script src="http://rawgit.com/amark/gun/master/gun.js"></script>
|
38 | <script>
|
39 | // var Gun = require('gun'); // in NodeJS
|
40 | // var Gun = require('gun/gun'); // in React
|
41 | var gun = Gun();
|
42 |
|
43 | gun.get('mark').put({
|
44 | name: "Mark",
|
45 | email: "mark@gunDB.io",
|
46 | });
|
47 |
|
48 | gun.get('mark').on(function(data, key){
|
49 | console.log("update:", data);
|
50 | });
|
51 | </script>
|
52 | ```
|
53 | ## Support
|
54 |
|
55 | - Help support development: https://www.patreon.com/gunDB !
|
56 | - Ask questions: http://stackoverflow.com/questions/tagged/gun ?
|
57 | - Chat with us: https://gitter.im/amark/gun .
|
58 |
|
59 | ## Documentation
|
60 | - [**A must read crash course on using GUN**](https://github.com/amark/gun/wiki/graphs).
|
61 | - [API reference](https://github.com/amark/gun/wiki/API).
|
62 | - [Introductory Guide](https://github.com/amark/gun/wiki/getting-started-(v0.3.x)).
|
63 | - [What tradeoffs does GUN make](https://github.com/amark/gun/wiki/CAP-Theorem)? It is an AP system, so banking apps aren't a good fit.
|
64 | - [How the Conflict Resolution algorithm works](http://gun.js.org/distributed/matters.html).
|
65 | - Check out and add example code [snippets](https://github.com/amark/gun/wiki/snippets-(v0.3.x)) —including micro-modules— to address specific situations.
|
66 |
|
67 | ## Deploy
|
68 |
|
69 | To quickly spin up a Gun test server for your development team, utilize either [Heroku](http://heroku.com) or [Docker](http://docker.com) or any variant thereof [Dokku](http://dokku.viewdocs.io/dokku/), [Flynn.io](http://flynn.io), [now.sh](https://zeit.co/now), etc. !
|
70 |
|
71 | ### [Heroku](https://www.heroku.com/)
|
72 |
|
73 | [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/amark/gun/tree/0.5)
|
74 |
|
75 | Or:
|
76 |
|
77 | ```bash
|
78 | git clone https://github.com/amark/gun.git
|
79 | cd gun
|
80 | heroku create
|
81 | git push -f heroku HEAD:master
|
82 | ```
|
83 |
|
84 | Then visit the URL in the output of the 'heroku create' step, in a browser.
|
85 |
|
86 | ### [Now.sh](https://zeit.co/now/)
|
87 |
|
88 | ```bash
|
89 | npm install -g now
|
90 | now --npm amark/gun
|
91 | ```
|
92 | Then visit the URL in the output of the 'now --npm' step, in your browser.
|
93 |
|
94 | ### [Docker](https://www.docker.com/)
|
95 |
|
96 | [![Docker Automated buil](https://img.shields.io/docker/automated/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/) [![](https://images.microbadger.com/badges/image/gundb/gun.svg)](https://microbadger.com/images/gundb/gun "Get your own image badge on microbadger.com") [![Docker Pulls](https://img.shields.io/docker/pulls/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/) [![Docker Stars](https://img.shields.io/docker/stars/gundb/gun.svg)](https://hub.docker.com/r/gundb/gun/)
|
97 |
|
98 | Pull from the [Docker Hub](https://hub.docker.com/r/gundb/gun/) [![](https://images.microbadger.com/badges/commit/gundb/gun.svg)](https://microbadger.com/images/gundb/gun). Or:
|
99 |
|
100 | ```bash
|
101 | docker run -p 8080:8080 gundb/gun
|
102 | ```
|
103 |
|
104 | Or build the [Docker](https://docs.docker.com/engine/installation/) image locally:
|
105 |
|
106 | ```bash
|
107 | git clone https://github.com/amark/gun.git
|
108 | cd gun
|
109 | docker build -t myrepo/gundb:v1 .
|
110 | docker run -p 8080:8080 myrepo/gundb:v1
|
111 | ```
|
112 |
|
113 | Or, if you prefer your Docker image with metadata labels (Linux/Mac only):
|
114 |
|
115 | ```bash
|
116 | npm run docker
|
117 | docker run -p 8080:8080 usenameHere/gun:git
|
118 | ```
|
119 |
|
120 | Then visit [http://localhost:8080](http://localhost:8080) in your browser.
|
121 |
|
122 |
|
123 | ### Videos
|
124 | - [Fault tolerance](https://www.youtube.com/watch?v=-i-11T5ZI9o&feature=youtu.be) (01:01)
|
125 | - [Saving relational or document based data](https://www.youtube.com/watch?v=cOO6wz1rZVY&feature=youtu.be) (06:59)
|
126 | - [Everything you want to know about GUN](https://youtu.be/qJNDplwJ8aQ) (57:50) 2x speed recommended.
|
127 | - [GUN's YouTube channel](https://www.youtube.com/channel/UCQAtpf-zi9Pp4__2nToOM8g/playlists) also has videos.
|
128 |
|
129 | ### <a name="gun-projects"></a>Projects
|
130 | - GUN users are encouraged to add their projects to this [running projects list](https://github.com/amark/gun/wiki/projects).
|
131 |
|
132 | ## <a name="gun-modules"></a>Modules
|
133 | GUN is designed to be as minimal as possible, with any additional functionality being provided via modules. Please refer to the [modules](https://github.com/amark/gun/wiki/modules) page for a list of existing extensions. Please refer to the [gun-extensions](https://github.com/gundb/gun-extensions/issues) repo to see what extensions have been requested or to request an extension.
|
134 |
|
135 | ## How can I help make gun even more awesome?
|
136 | - Star this repo
|
137 | - Follow us and share your appreciation via [Gitter](https://gitter.im/amark/gun), [Twitter](https://twitter.com/databasegun), [LinkedIn](https://www.linkedin.com/company/gun-inc), and [Facebook](https://www.facebook.com/databasegun)
|
138 | - [Share projects you've written](https://github.com/amark/gun/wiki/projects)
|
139 | - [Build extensions or squish bugs](https://waffle.io/amark/gun)
|
140 | - If you are working on an extension, familiarize yourself with [GUN's Module API](https://github.com/amark/gun/wiki/Building-Modules-for-Gun)
|
141 |
|
142 | ## License
|
143 |
|
144 | Designed with ♥ by Mark Nadal, the gun team, and many amazing contributors. Liberally licensed under [Zlib / MIT / Apache 2.0](https://github.com/amark/gun/blob/master/LICENSE.md).
|
145 |
|
146 | ## Contributors
|
147 |
|
148 | Thanks to the following people who have contributed to GUN, via code, issues, or conversation (this list has quickly become tremendously behind! We'll probably turn this into a dedicated wiki page so you can add yourself):
|
149 |
|
150 | [agborkowski](https://github.com/agborkowski); **:star:[alanmimms](https://github.com/alanmimms)**; [alexlafroscia](https://github.com/alexlafroscia); [anubiann00b](https://github.com/anubiann00b); [bromagosa](https://github.com/bromagosa); [coolaj86](https://github.com/coolaj86); [d-oliveros](https://github.com/d-oliveros), [danscan](https://github.com/danscan); **[forrestjt](https://github.com/forrestjt) ([file.js](https://github.com/amark/gun/blob/master/lib/file.js))**; [gedw99](https://github.com/gedw99); [HelloCodeMing](https://github.com/HelloCodeMing); **[JosePedroDias](https://github.com/josepedrodias) ([graph visualizer](http://acor.sl.pt:9966))**; **[JuniperChicago](https://github.com/JuniperChicago) ([cycle.js bindings](https://github.com/JuniperChicago/cycle-gun))**; **[jveres](https://github.com/jveres) ([todoMVC](https://github.com/jveres/todomvc))**; [ndarilek](https://github.com/ndarilek); [onetom](https://github.com/onetom); [phpnode](https://github.com/phpnode); [PsychoLlama](https://github.com/PsychoLlama); **[RangerMauve](https://github.com/RangerMauve) ([schema](https://github.com/gundb/gun-schema))**; **[robertheessels](https://github.com/swifty) ([gun-p2p-auth](https://github.com/swifty/gun-p2p-auth))**; [riston](https://github.com/riston); [rootsical](https://github.com/rootsical); [rrrene](https://github.com/rrrene); [sbeleidy](https://github.com/sbeleidy); **:star:[Sean Matheson](https://github.com/ctrlplusb) ([Observable/RxJS/Most.js bindings](https://github.com/ctrlplusb/gun-most))**; [ssr1ram](https://github.com/ssr1ram); **[Stefdv](https://github.com/stefdv) ([Polymer/web components](http://stefdv.github.io/gun-collection/components/gun-collection/))**; [Xe](https://github.com/Xe); [zot](https://github.com/zot); [ayurmedia](https://github.com/ayurmedia);
|
151 |
|
152 | This list of contributors was manually compiled and alphabetically sorted. If we missed you, please submit an issue so we can get you added!
|
153 |
|
154 | ## [Changelog](https://github.com/amark/gun/blob/master/CHANGELOG.md#03)
|
155 |
|
156 | Also see the current [Release List](https://github.com/amark/gun/releases) and [Tag List](https://github.com/amark/gun/tags) for quick access to relevant versions.
|
157 |
|
158 | <a name="stay-up-to-date"></a>
|
159 |
|
160 | <a href="https://gitter.im/amark/gun"><img alt="Gitter channel" src="https://badges.gitter.im/Join%20Chat.svg" /></a>
|
161 | [![YouTube](https://img.shields.io/badge/You-Tube-red.svg)](https://www.youtube.com/channel/UCQAtpf-zi9Pp4__2nToOM8g) [![LinkedIn](https://img.shields.io/badge/Linked-In-blue.svg)](https://www.linkedin.com/company/gun-inc) [![Twitter Follow](https://img.shields.io/twitter/follow/databasegun.svg?style=social)](https://twitter.com/databasegun)
|