A decentralized personal data wallet that securely stores your memories on the blockchain while keeping chat sessions in a PostgreSQL database.
The system uses a hybrid storage approach:
-
On-chain Storage (Sui Blockchain + Walrus)
- HNSW Index for vector similarity search
- Embedding vectors for memory retrieval
- Memory content (encrypted)
- Memory metadata and relationships
-
Off-chain Storage (PostgreSQL)
- Chat sessions
- Chat messages
- User preferences
- Application state
- Node.js 18+
- PostgreSQL 14+
- Docker and Docker Compose (optional)
- Sui wallet with testnet funds
-
Clone the repository:
git clone https://github.com/yourusername/personal-data-wallet.git cd personal-data-wallet
-
Install dependencies:
npm install cd backend && npm install
-
Configure environment variables:
cp backend/.env.example backend/.env
Edit the
.env
file with your database credentials and Sui wallet information. -
Set up PostgreSQL:
# Create database createdb personal_data_wallet
Or use Docker:
docker-compose up -d postgres
-
Start the backend:
cd backend npm run start:dev
-
Start the frontend:
# In the project root npm run dev
id
: UUID (primary key)title
: Stringsummary
: String (optional)userAddress
: StringsuiObjectId
: String (optional, for blockchain reference)isArchived
: Booleanmetadata
: JSONBcreatedAt
: TimestampupdatedAt
: Timestamp
id
: UUID (primary key)role
: String (user/assistant)content
: TextsessionId
: UUID (foreign key)memoryId
: String (optional, reference to blockchain memory)walrusHash
: String (optional, reference to Walrus storage)metadata
: JSONBcreatedAt
: Timestamp
- Memory records
- Memory indices
- Vector storage
- Relationship graphs
- Session metadata
- Message references
POST /api/memories
- Create new memoryGET /api/memories?user={address}
- Get all memories for a userGET /api/memories/{id}?user={address}
- Get a specific memoryPOST /api/memories/search
- Search memoriesPOST /api/memories/{id}
- Update a memoryDELETE /api/memories/{id}
- Delete a memoryPOST /api/memories/process
- Process a memory without creating itPOST /api/memories/save-approved
- Save an approved memory
POST /api/chat/sessions
- Create a new chat sessionGET /api/chat/sessions?user={address}
- Get all sessions for a userGET /api/chat/sessions/{id}
- Get a specific chat sessionPOST /api/chat/sessions/{id}/messages
- Add a message to a sessionPOST /api/chat/stream
- Stream chat responsesDELETE /api/chat/sessions/{id}
- Delete a chat session
MIT