<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Israel Martins</title>
    <description>The latest articles on DEV Community by Israel Martins (@israelmarmar).</description>
    <link>https://dev.to/israelmarmar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3511921%2F81219228-d216-4b28-b1ed-6e330aa09ba4.jpeg</url>
      <title>DEV Community: Israel Martins</title>
      <link>https://dev.to/israelmarmar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/israelmarmar"/>
    <language>en</language>
    <item>
      <title>I created a fork of GunDB and rewrote it in TypeScript using Vibe Code</title>
      <dc:creator>Israel Martins</dc:creator>
      <pubDate>Sat, 30 May 2026 18:43:59 +0000</pubDate>
      <link>https://dev.to/israelmarmar/i-created-a-fork-of-gundb-and-rewrote-it-in-typescript-using-vibe-code-5b9b</link>
      <guid>https://dev.to/israelmarmar/i-created-a-fork-of-gundb-and-rewrote-it-in-typescript-using-vibe-code-5b9b</guid>
      <description>&lt;p&gt;Inspired by a similar project called GenosDB and Cloudflare’s initiative to rebuild Next.js, I decided to rebuild GunDB with a modern coding style, incorporating improvements and addressing shortcomings in the original technology. I used the OpenCode tool with the Big Pickle model to rewrite the project in a new graph database called Garfo (the Portuguese word for “fork”), and I was impressed with the results and its practical applications. In this article, I’ll explain the technology and its improvements over GunDB.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Garfo&lt;/strong&gt; is a modern, browser-first fork of &lt;a href="https://gun.eco/" rel="noopener noreferrer"&gt;GUN.js&lt;/a&gt; — the decentralized, offline-first graph database. A fork of the original project that keeps the familiar GUN graph API while bringing meaningful improvements to the modern JavaScript ecosystem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a Fork?
&lt;/h2&gt;

&lt;p&gt;GUN.js is a revolutionary technology — a graph database that syncs in real time, works peer-to-peer, resolves conflicts automatically, and runs in the browser. However, the JavaScript ecosystem has evolved. TypeScript has become the standard, ES modules are the norm, and new transport layers like &lt;strong&gt;Nostr&lt;/strong&gt; have emerged as promising decentralized protocols.&lt;/p&gt;

&lt;p&gt;Garfo was born to fill these gaps: a GUN rewritten with modern typing, designed with the browser as a first-class citizen, and with native support for the Nostr protocol.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Features
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Familiar Graph API
&lt;/h3&gt;

&lt;p&gt;If you've used GUN before, you'll feel right at home. Garfo exposes the same chainable API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;Garfo&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;garfo&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Garfo&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;put&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;online&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;users&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;profile&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Update:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;All the classic methods are there: &lt;code&gt;get()&lt;/code&gt;, &lt;code&gt;put()&lt;/code&gt;, &lt;code&gt;set()&lt;/code&gt;, &lt;code&gt;on()&lt;/code&gt;, &lt;code&gt;once()&lt;/code&gt;, &lt;code&gt;map()&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Optional Nostr Transport
&lt;/h3&gt;

&lt;p&gt;This is one of the most exciting additions. Garfo can use &lt;strong&gt;Nostr relays&lt;/strong&gt; as a transport layer, allowing peers to exchange graph messages through public or private relays:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Garfo&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;nostr&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;sk&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;private-key-hex&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;relays&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://relay.damus.io&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;wss://nos.lol&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;chat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;general&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;alice&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello over Nostr!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  IndexedDB and OPFS storage
&lt;/h3&gt;

&lt;p&gt;In addition to localStorage, I have also included IndexedDB and OPFS as alternative ways to store database data in the browser&lt;/p&gt;

&lt;p&gt;This unlocks immense possibilities: Garfo no longer depends solely on direct WebSocket connections — any Nostr relay can become a synchronization backbone.&lt;/p&gt;

&lt;h3&gt;
  
  
  SEA — Security, Encryption, Authorization
&lt;/h3&gt;

&lt;p&gt;The SEA module is included, providing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Public/private key pairs for users&lt;/li&gt;
&lt;li&gt;End-to-end encryption&lt;/li&gt;
&lt;li&gt;Data signing and verification&lt;/li&gt;
&lt;li&gt;Proof-of-work for rate limiting&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Browser-First
&lt;/h3&gt;

&lt;p&gt;Unlike GUN.js which carries a Node.js legacy, Garfo is built with the browser as the primary target:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Native &lt;code&gt;localStorage&lt;/code&gt; backend support&lt;/li&gt;
&lt;li&gt;Zero configuration to get started&lt;/li&gt;
&lt;li&gt;Web-optimized bundle&lt;/li&gt;
&lt;li&gt;TypeScript throughout&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Use Cases
&lt;/h2&gt;

&lt;p&gt;Garfo shines in &lt;strong&gt;local-first&lt;/strong&gt; and &lt;strong&gt;decentralized&lt;/strong&gt; applications:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Peer-to-peer chat&lt;/strong&gt; — the repo includes a complete Nostr-backed chat example with React + TypeScript&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Collaborative apps&lt;/strong&gt; — document editing, Kanban boards, shared whiteboards&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;P2P content delivery&lt;/strong&gt; — the repo has a livestream example using peer-to-peer CDN&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Offline IoT&lt;/strong&gt; — field data collection with sync when online&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decentralized social networks&lt;/strong&gt; — combining graph data model with Nostr transport&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Example: Nostr Chat
&lt;/h2&gt;

&lt;p&gt;The project ships with a working chat demo. Run &lt;code&gt;npm start&lt;/code&gt;, open two browser tabs, and each creates a Nostr identity. Messages flow through relays and are stored locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/israelmarmar/garfodb.git
&lt;span class="nb"&gt;cd &lt;/span&gt;garfodb/examples/nostr-chat
npm &lt;span class="nb"&gt;install
&lt;/span&gt;npm start
&lt;span class="c"&gt;# Open http://127.0.0.1:8900/ in two windows&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The chat supports generating identities, copying public keys, backing up and restoring keys — recovering full history from relays.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Garfo Compares
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;GUN.js&lt;/th&gt;
&lt;th&gt;Garfo&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Package name&lt;/td&gt;
&lt;td&gt;&lt;code&gt;gun&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;garfo&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Constructor&lt;/td&gt;
&lt;td&gt;&lt;code&gt;Gun&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Garfo&lt;/code&gt; (with &lt;code&gt;Gun&lt;/code&gt; alias)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;TypeScript&lt;/td&gt;
&lt;td&gt;Limited&lt;/td&gt;
&lt;td&gt;Full&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nostr transport&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;✅ Native&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Focus&lt;/td&gt;
&lt;td&gt;Node + Browser&lt;/td&gt;
&lt;td&gt;Browser-first&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage&lt;/td&gt;
&lt;td&gt;LocalStorage&lt;/td&gt;
&lt;td&gt;LocalStorage, IndexedDB, OPFS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Maintenance&lt;/td&gt;
&lt;td&gt;Original community&lt;/td&gt;
&lt;td&gt;Active fork&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Technical Notes
&lt;/h2&gt;

&lt;p&gt;Garfo retains the &lt;strong&gt;graph node&lt;/strong&gt; architecture of original GUN. Each piece of data lives in a "soul" — a node identified by a unique key. Peers connect in a mesh and exchange graph deltas.&lt;/p&gt;

&lt;p&gt;A key difference: while GUN.js was designed in a pre-TypeScript era, Garfo ships with complete types — you get intellisense and type checking out of the box.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;If you're building a decentralized application and need a real-time syncing database without central servers, Garfo deserves your attention.&lt;/p&gt;

&lt;p&gt;The project is already available in beta; not all security tests have been completed, so use it at your own risk&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Links:&lt;/strong&gt; &lt;a href="https://github.com/israelmarmar/garfodb" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt; | &lt;a href="https://gun.eco/" rel="noopener noreferrer"&gt;GUN.eco&lt;/a&gt; | &lt;a href="https://nostr.com/" rel="noopener noreferrer"&gt;Nostr Protocol&lt;/a&gt;&lt;br&gt;
| &lt;a href="https://genosdb.com/" rel="noopener noreferrer"&gt;GenosDB&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>database</category>
      <category>showdev</category>
      <category>typescript</category>
      <category>vibecoding</category>
    </item>
  </channel>
</rss>
