4 ms·
I'd never heard of gun before, but the project looks interesting. I see there's a few videos in the main repo's readme, so I'll be checking em out. Any comment
by TheAceOfHearts 10y ago
I'd never heard of gun before, but the project looks interesting. I see there's a few videos in the main repo's readme, so I'll be checking em out.
Any comments on how it compares to something like PouchDB [0]?
What are examples of good use-cases where you'd want to reach for something like gun?
Although I've looked into stuff like CouchDB and NoSQL databases, I can never intuitively wrap my head around it. For most problems that cross my mind, my first response is usually "Postgres sounds perfect for this". Does anyone have suggestions for resources that discuss this in a way that's approachable?
While looking through their docs and wiki, one of my questions was: how do you protect yourself from invalid data and all the related "baddies"? They have a wiki entry on the subject of authn and authz [1], but unfortunately it doesn't look like they included a complete example. In another wiki entry [2] they mention an authorization filter, but don't go into more detail.
[0] https://pouchdb.com/ https://pouchdb.com/
[1] https://github.com/amark/gun/wiki/Security%2C-Authentication%2C-Authorization https://github.com/amark/gun/wiki/Security%2C-Authentication...
[2] https://github.com/amark/gun/wiki/Mesh-Network-Messaging-Algorithm https://github.com/amark/gun/wiki/Mesh-Network-Messaging-Alg...
- marknadal 10y agoThanks for the comment! I'll start with what you should not use gun for: It is a strong eventually consistent system (AP if you are familiar with the CAP Theorem) which means it is a bad choice for banking/accounting. You should use a strongly consistent system like RethinkDB or Postgres instead. Some things that people are using gun for are: - Distributed Machine Learning ( http://myrighttocode.org/blog/artificial%20intelligence/particle%20swarm/genetic%20algorithm/collective%20knowledge/machine%20learning/gun-db-artificial-knowledge-sharing http://myrighttocode.org/blog/artificial%20intelligence/part... ) - Multiplayer VR games in the browser with WebGL. - Realtime IoT data viz with webcomponents. ( https://github.com/Stefdv/gun-ui-lcd https://github.com/Stefdv/gun-ui-lcd ) - Peer-to-Peer electron/react-native fully encrypted social networks. How it compares to PouchDB? PouchDB is great! They pioneered offline-first before people had even termed the phrase, very much were forward thinkers. The biggest difference is that Pouch/Couch is a document database while gun is a graph database which can support key/value, relational, document, circular references, or graph data structures. I haven't used Couch since 2011 though, so I can't speak to any of their more recent features, but their latest release looked really solid. NoSQL was definitely a fad, so I don't blame you for not being able to wrap your head around it. We plan on introducing a SQL query extension for gun within the next 8 months. SQL is great, relations are great, and the NoSQL/document-only hype hurt the industry although it was based on some legitimate needs. From my perspective there is no question that Postgres should be considered the best solution for Master-Slave query based databases. I do predict, obviously biased though, that the industry will slowly migrate towards Master-Master push based graph databases though. And my experience with gun, the VC funding I've raised, the pain points I've had and heard from others, and the traction we're getting is confirmation of that (or confirmation bias?). Preventing invalid data from being saved is as simple as adding a schema ( https://github.com/RangerMauve/gun-schema https://github.com/RangerMauve/gun-schema ). Preventing hackers is as not-simple as using real end-to-end cryptography, but we're making an explainer video series to try and help consolidate these ideas for people ( http://gun.js.org/explainers/data/security.html http://gun.js.org/explainers/data/security.html ). Or you can opt to use gun in a traditional centralized server setup where all reads/writes are proxied by your app's routes, like you would normally do with any other database. Anything else I can answer? Thanks for asking these questions!
- philippnagel 10y agoI'm currently building a P2P web app/social network that ideally should run completely in the browser and haven't looked at Gun before. Can Gun be used on top of IndexedDB? You mentioned "Peer-to-Peer electron/react-native fully encrypted social networks". Can you point me to any repos? Thanks!
- marknadal 10y agoAwesome idea! What are you building it with, then? Yes, IndexedDB has a Level down adapter which should work with GUN's Level up adapter: https://github.com/PsychoLlama/gun-level https://github.com/PsychoLlama/gun-level (or however the naming works). I don't actually know how to do this though, so ping Jesse (psychollama) if you have any problems. The best repo is a barebones P2P encrypted auth example using polymer (not electron or react native): https://github.com/swifty/gun-p2p-auth https://github.com/swifty/gun-p2p-auth , git clone it, then open ./demo/standalone.html and try the login/register forms after you run a gun server (npm install gun, cd ./node_modules/gun , node examples/http.js 8081). Let me know if this worked. If you got stuck on anything absolutely let me know so I can help. :)
- philippnagel 10y agoGreat, thanks! Currently building the app on top of http://ssbc.github.io/scuttlebot/ http://ssbc.github.io/scuttlebot/.