npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@harshalpatel2868/gosync-client

v1.0.1

Published

Offline-first sync for SQLite and Postgres using Go + WASM

Readme

GoSync

Build Status

A relentless, offline-first sync engine for Go.
Zero dependencies. Instant sync. Full ownership.


🚀 Why GoSync?

Most "offline-first" solutions lock you into their ecosystem (Firebase, Supabase, CouchDB). GoSync works differently.

It is a Protocol, not a Platform.

  • Go + WASM: We run the exact same Go code in the browser (via WebAssembly) and on the server.
  • IndexedDB Persistence: Your app works perfectly offline. Data survives refreshes and restarts.
  • Bidirectional Sync: Changes made offline automatically upload when online. Server changes download instantly.
  • Merkle Tree & Snapshots: Efficiently detects data mismatches and "heals" the state using a robust sync protocol.
  • Local-First: The client is the source of truth. The server is just a backup.

🛠 Tech Stack

  • Client: Go (compiled to stored WASM) + IndexedDB (via idb-keyval).
  • Server: Go + SQLite (or switch to Postgres easily).
  • Communication: WebSockets (Real-time).
  • Storage: syscall/js Bridge to Browser APIs.

📦 Installation

npm install @harshalpatel2868/gosync-client

🎮 Try it instantly

We included a "Kitchen Sink" demo.

Windows:

.\run_demo.bat

Mac/Linux:

chmod +x run_demo.sh
./run_demo.sh

🧪 How to Verify (The Magic Trick)

  1. Open http://localhost:3000. Status should be 🟢 Online.
  2. Add a task: "Hello World".
  3. Kill the Server (Close the terminal). Status turns 🔴 Offline.
  4. Add a task: "I am offline".
  5. Refresh the Page. The tasks are still there! (IndexedDB Persistence).
  6. Restart the Server. Status turns 🟢 Online.
  7. Check Server Logs: It will say "Synced!" and have both items.

⚡ Quick Start

1. Build the Server

# Windows
go build -o server.exe ./cmd/server

# Mac/Linux
go build -o server ./cmd/server

2. Build the Client (WASM)

# Windows (PowerShell)
$env:GOOS = "js"; $env:GOARCH = "wasm"; go build -o dist/main.wasm ./cmd/client
# Mac/Linux
GOOS=js GOARCH=wasm go build -o dist/main.wasm ./cmd/client

3. Run Everything

Start the Backend:

./server.exe

Start the Frontend Host:

python -m http.server 3000 --directory dist

Visit http://localhost:3000. Add items. Go offline. Refresh. Synced.

💻 Usage Example

How to use GoSync in your own Go application:

// 1. Define your data
type Task struct {
    ID      string
    Content string
}

// 2. Initialize the Sync Engine
repo := gosync.NewBrowserRepo() // Auto-connects to IndexedDB
engine := gosync.NewEngine(repo)

// 3. Add Data (Works Offline!)
engine.Add(Task{ID: "1", Content: "Buy Milk"})
// -> Automatically syncs to server when online

🏗 Architecture

graph TD
    User[User Action] -->|Add Item| ClientDB[(IndexedDB)]
    ClientDB -->|Update| Merkle[Merkle Tree]
    Merkle -->|Hash Mismatch| Sync[Sync Engine]
    Sync -->|WebSocket| Server[Go Server]
    Server -->|Persist| SQLite[(SQLite/Postgres)]

📜 License

MIT License © 2025 Harshal Patel.