Private Relationship Protocol for Sui-native invisible social graph infrastructure.
Bun monorepo with workspaces:
apps/
web/ # Vite + React + Sui dApp Kit frontend
server/ # Bun + Hono + SQLite backend (relayer)
packages/
shared/ # Shared TypeScript types (@ghostlink/shared)
contracts/
ghostlink/ # Sui Move smart contracts
bun install # Install dependencies
bun run seed # Seed SQLite database (required first time)
bun run dev:server # Start backend at http://localhost:3000
bun run dev:web # Start frontend at http://localhost:5173Build order matters: build:shared must run before build:web or build:server.
bun run build # Builds all in correct order
bun run typecheck # Typechecks all packages (builds shared first)Copy .env.example to .env in project root. Key variables:
Server:
DEMO_MODE=true— Local mode with simulated Sui objects (no on-chain writes)DEMO_MODE=false— Testnet mode requiringSUI_PACKAGE_IDandSUI_RELAYER_PRIVATE_KEY
Frontend:
VITE_API_BASE_URL=http://localhost:3000VITE_SUI_NETWORK=testnet
packages/shared/src/index.ts exports all domain types. Both apps/web and apps/server import from @ghostlink/shared. Types include: Relationship, RelationshipCap, HiddenGroup, GroupMember, MembershipProof, RelationshipEvent.
apps/server/src/index.ts — Hono app with SQLite via Drizzle ORM. Routes: /api/relationships, /api/groups, /api/proofs, /api/events. SSE endpoint at /api/events/stream.
apps/web/src/main.tsx — React 19 with SuiProvider (dApp Kit), QueryClientProvider, BrowserRouter. Routes defined in App.tsx using lazy loading.
- Frontend:
@mysten/dapp-kitfor wallet connection,@mysten/suifor client - Server:
@mysten/suifor relayer transactions - Contract:
contracts/ghostlink/sources/protocol.movedefinesRelationship,RelationshipCap,HiddenGroup,GroupMember,MembershipProofobjects
Proof scheme is ghostlink-merkle-v1. Server maintains Merkle tree commitments in groupMemberCommitments and groupRoots tables. Proof verification checks path, nullifier uniqueness, expiry, and attestation signature.
- Library:
react-i18nextwithi18next-browser-languagedetector - Config:
apps/web/src/lib/i18n.ts - Locales:
apps/web/src/locales/en.json,apps/web/src/locales/zh.json - Auto-detects browser language, persists choice to localStorage
- Language switcher in top navigation bar
| Purpose | Path |
|---|---|
| Shared types | packages/shared/src/index.ts |
| DB schema | apps/server/src/db/schema.ts |
| Server entry | apps/server/src/index.ts |
| Web entry | apps/web/src/main.tsx |
| Sui provider | apps/web/src/lib/sui.tsx |
| i18n config | apps/web/src/lib/i18n.ts |
| Move contract | contracts/ghostlink/sources/protocol.move |
Edition 2024. Entry functions for testnet relayer:
record_relationship— Creates relationship + caps for both membersrecord_hidden_group— Creates hidden grouprecord_membership_proof— Creates membership proof
User-facing functions (wallet-initiated):
create_relationship,accept_relationshipcreate_hidden_group,add_group_membergenerate_membership_proof
- Create/accept relationship → inspect capabilities
- Create hidden group → invite members
- Generate ZK membership proof
- Verify proof → unlock demo content
- Review Sui object references from relayer