← Back to PromptVault

Docs

Everything you need to know about PromptVault.

Overview

PromptVault is the first decentralized AI prompt registry built on Sui. Users can submit AI prompts that are stored as immutable Walrus blobs, evaluated by AI (Gemini via OpenRouter), and indexed in Firestore with wallet author provenance.

Every prompt is paired with an AI-generated evaluation (clarity, structure, model-fit, improved version) that is also stored permanently on Walrus.

How It Works

1. Submit

Enter a title, your prompt, tags, and the target model. The form sends everything to our backend.

2. AI Evaluation

Our evaluator (powered by Gemini 2.5 Flash Lite via OpenRouter) scores your prompt across clarity, model fit, and structure. It also returns an improved version.

3. Walrus Storage

Prompts and evaluations are stored as immutable Walrus mainnet blobs whenever community publishers are available. When they are temporarily unreachable, the full data is reliably saved to Firestore as a fallback (clearly marked) and can be promoted to real Walrus blobs later via the "Retry storing to Walrus" button.

4. Metadata Index (Firestore)

Title, blob IDs, tags, target model, author wallet address, and fork parent are saved to Firebase Firestore for fast public vault queries and provenance.

For Users

  • Submit a prompt — Go to /submit (wallet connection required via @mysten/dapp-kit). Fill title, prompt, tags, and target model.
  • Browse the Vault — Visit /vault to explore all published prompts.
  • View details — Click any prompt card to see the full text, evaluation scores, and improved version.
  • Fork — Use the "Fork this prompt" button on any detail page. It pre-fills the submit form with the original content and tracks the parent via Firestore metadata.

Technical Details

Storage (Walrus Mainnet + Firestore fallback)

We attempt to store prompts + AI evaluations as immutable blobs on Walrus mainnet via the HTTP publisher API. We currently use the only available zero-cost option: community-operated publishers (Staketab primary + a couple of others) with very aggressive retry cycling (20 attempts), outer retries, and client-side auto-retry. Reads use multiple public aggregators with fallbacks.

When community publishers are unreachable (a known, documented reality on mainnet — see the official docs below), the submit still succeeds: the full prompt text and full evaluation are saved to Firestore as a reliable fallback. The vault and detail pages show the content from metadata with a clear "metadata fallback" indicator. A "Retry storing to Walrus" button is available on fallback records so they can be promoted to real immutable blobs later.

Post-Hackathon Plan: After the hackathon we will move to a paid, reliable Walrus publisher (e.g. Nami Cloud, a self-hosted funded publisher, or the official Upload Relay with a properly funded wallet). This will give us consistent, production-grade mainnet storage with no more reliance on volunteer community endpoints. All existing fallback records will be backfilled to real Walrus blobs at that time.

Official reality: There are no public unauthenticated publishers on mainnet (see operators.json, public aggregators & publishers, and the Mainnet Publisher Production Guide— "Do not rely on community publishers for production uploads"). Running reliable storage requires funding real SUI + WAL. The current hybrid approach is the pragmatic zero-cost solution for a public hackathon demo while still delivering genuine Walrus integration and never losing user data.

Wallet & RPC (Sui Mainnet via Tatum)

Wallet connection uses @mysten/dapp-kit with Sui mainnet only (via Tatum's mainnet gateway). The connected address is saved as the author in Firestore metadata. No smart contract or on-chain PromptRecord is used — storage is purely Walrus + Firestore indexing.

AI Evaluator

We use OpenRouter with Google Gemini 2.5 Flash Lite (free tier) as primary, with current free fallbacks (Gemma 4, Llama 3.3, Nemotron, DeepSeek). The master system prompt forces structured JSON output (clarity, model_fit, structure, improved_prompt, etc.). The store route includes retries, timeouts, and a default evaluation fallback so submits succeed even if OpenRouter is temporarily unavailable.

Wallet Connection (Sui Mainnet)

We use @mysten/dapp-kit (official Mysten Labs React SDK for Sui) for wallet connections.

  • Connect wallet button is in the Navbar (top right on desktop; inside mobile hamburger menu).
  • Required to submit/publish a prompt — the connected wallet address is saved as author in Firestore.
  • Not required to browse the vault feed (public reads only; writes are authenticated).
  • Restricted to Sui Mainnet only (chainId: sui:mainnet).
  • Supports Sui Wallet, Suiet, Slush, and any Sui-compatible wallet (via the kit's auto-detection).

Implementation notes:

// In submit page / form:
const account = useCurrentAccount();
if (!account) {
  // show "Connect your wallet to submit"
}

// Pass to form:
<SubmitForm author={account?.address} ... />

// In /api/store:
body: { ..., author }

// Saved to Firestore as:
{ ..., author: '0x1234...' }

Providers are set up in app/providers.tsx (QueryClient + SuiClientProvider + WalletProvider with mainnet only).

Local development note: On http://localhost:3000 (or any non-HTTPS origin), Sui wallets (Sui Wallet, etc.) will display a "Your connection is not secure" warning before allowing the connection. This is standard security behavior by the wallet extension to protect users. It is safe to approve during local testing. The warning does not appear on the production HTTPS site.

Walrus reachability errors (502, DNS, etc.): Per official docs there are no public unauth mainnet publishers (https://docs.wal.app/operators.json + public-aggregators-and-publishers). We rely on community endpoints (Staketab primary). The code does 5 retries + endpoint fallbacks for both store and retrieve. On transient failure the API returns a short "Temporary issue reaching Walrus storage. Please try again in a few minutes." message. This is expected behavior for a demo using volunteer infrastructure.

Development

Run locally:

cp .env.local.example .env.local
npm install
npm run dev

For local wallet testing without the "not secure" warning, try next dev --experimental-https (self-signed cert) or a HTTPS tunnel (ngrok, cloudflared, etc.).

Wallet: npm install @mysten/dapp-kit @tanstack/react-query (already done).

Dark theme only (Leo × Saturn palette). CSS custom properties defined in globals.css under :root.

All code is open source. See the GitHub repo for contribution guidelines.

Analytics

Two analytics systems are active:

  • Vercel Analytics: Automatic when deployed to Vercel (added via @vercel/analytics in app/layout.tsx).
  • Firebase Analytics (Google Analytics 4): Enabled via Firebase SDK. Add NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID (your GA4 Measurement ID from Firebase console) to .env.local. See lib/firebase.ts for initialization (uses getAnalytics).

Both will send data to Google (via Firebase) and Vercel dashboards. Measurement ID is passed via NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID in the Firebase config.

Firebase Firestore Rules

Recommended rules (paste into Firebase Console > Firestore > Rules):

rules_version = '2'; service cloud.firestore {match /databases/{database}/documents {match /prompts/{promptId} {allow read: if true;   // Public vault feed allow write: if true;  // Public submissions. The backend writes from Next.js API routes (no Firebase Auth). // For production add App Check or rate limiting.}}}

Important: Rules with request.auth != null will cause PERMISSION_DENIED errors on server writes (as seen in logs). Use the open-write version above so the fallback path works when Walrus publishers are down.

We have prepared firestore.rules, firestore.indexes.json, firebase.json, and .firebaserc in the repo root. Use npm run deploy:firestore (after npx firebase login) to deploy.

Post-deploy index step (required for real vault feed): The main query orders by createdAt descending. If the Vault shows only demo seeds after deploy, create the single-field index:
Firebase Console → Firestore → Indexes → Single field indexes → ensure prompts collection has a descending index on createdAt, or click the "Create index" link shown in logs when loading the feed (it autofills the exact index needed). The index builds in ~1-5 min.

Links

PromptVault · Built on Sui Mainnet × Walrus · June 2026