NHacker Next
login
▲Show HN: Vaultrice – A real-time key-value store with a localStorage APIvaultrice.com
28 points by adrai 22 hours ago | 9 comments
Loading comments...
djfobbz 39 minutes ago [-]
I thought you could easily achieve this (a global real-time object) with convex.dev?
RestartKernel 3 hours ago [-]
I love the API, but it's a tough sell as a SaaS first — who knows if you'll still be around after I've built my infra around your SDK?
adrai 3 hours ago [-]
The team behind vaultrice.com is the same team behind locize.com and i18next.com...
adrai 3 hours ago [-]
and as long as it's used on those and other apps, it will for sure continue to exist ;-)
santa_boy 3 hours ago [-]
Yet to explore but just reading few snippets ... is this good for offline first apps?

If not, any others you recommend for that use-case?

If yet, is this ready enough for production use?

adrai 3 hours ago [-]
Hey, thanks for the great questions!

Offline-first: That's a key distinction. The Vaultrice SDK is currently designed for "online-first" and "offline-sometimes" use cases. Its main strength is real-time, consistent synchronization that relies on an active connection.

Proper offline-first support with automatic conflict resolution is on our roadmap, as we have a backlog item for it ;-) However, you can easily achieve a robust offline capability in your own code today by using localStorage as a fallback.

Here’s a simple wrapper pattern (not tested, just for illustration) that reads from Vaultrice when online and falls back to a local cache when offline:

import { NonLocalStorage } from '@vaultrice/sdk';

// --- A simple offline-first wrapper --- function createOfflineStore(credentials, id) { const vaultriceStore = new NonLocalStorage(credentials, id); const localCacheKey = `vaultrice_cache_${id}`;

  // Helper to get local data
  const getLocal = () => JSON.parse(localStorage.getItem(localCacheKey) || '{}');

  return {
    // SET: Write to both Vaultrice (if online) and localStorage
    async setItem(key, value) {
      // Always update the local cache immediately
      const localData = getLocal();
      localData[key] = value;
      localStorage.setItem(localCacheKey, JSON.stringify(localData));

      try {
        // Attempt to write to the cloud
        await vaultriceStore.setItem(key, value);
      } catch (error) {
        console.warn('Offline: Data saved locally.', error.message);
      }
    },

    // GET: Try Vaultrice first, fallback to localStorage
    async getItem(key) {
      try {
        const item = await vaultriceStore.getItem(key);
        if (item) {
            // Optional: Update local cache with fresh data
            const localData = getLocal();
            localData[key] = item.value;
            localStorage.setItem(localCacheKey, JSON.stringify(localData));
            return item.value;
        }
      } catch (error) {
        console.warn('Offline: Reading from local cache.', error.message);
      }
      // Fallback to local cache
      return getLocal()[key];
    }
  };
}

Production Readiness: Yes, for its intended use case, Vaultrice is ready for production. We've put a lot of focus on a layered security model (from API key restrictions to E2EE) and built it on top of Cloudflare's infrastructure, which gives us a reliable and scalable foundation.

Hope that helps clarify things! Appreciate you checking it out.

taherchhabra 6 hours ago [-]
Just yesterday my son built a zombie shooter game in chatgpt, then shared the link with his friend, both were able to play individually, then my son asked can we play together and shoot each other. I was wondering is there something like localstorage but for network which chatgpt can easily use it. Can this work for my son's use case?
adrai 5 hours ago [-]
Yes — that’s exactly the kind of thing Vaultrice is designed for.

Think of it like localStorage, but instead of being tied to one browser on one device, the data lives in a globally-available, real-time object. Any change one player makes (like moving their character or firing a shot) can be sent instantly to the other player’s browser — without having to set up your own server or WebSocket layer.

For your son’s zombie shooter: • Each game session could be one Vaultrice “object” (with an id like game-123). • Each player writes their position, health, actions to that object. • The other player’s browser listens for changes and updates the game state instantly. • Presence tracking is built-in, so you can show “who’s in the game” without extra code.

The nice part is that the SDK’s API feels familiar — setItem, getItem, and on() for events — so you can get a working multiplayer prototype with just a few lines. If you want even less boilerplate, the SyncObject API lets you just set properties on a shared object and Vaultrice syncs it behind the scenes.

It won’t handle game physics for you, but it’s a fast, simple way to make a turn-based or moderately real-time multiplayer experience without hosting your own backend.

Gys 2 hours ago [-]
The two players would be two users?
larikk 4 hours ago [-]
[dead]