Getting Started with Vaultys P2P SDK
Welcome to Vaultys! This guide will help you quickly build peer-to-peer applications with decentralized identities, encrypted messaging, and real-time collaboration features.
๐ฏ Choose Your Pathโ
๐ฎ Just Want to Try It?โ
Open the Playground - Test all features instantly in your browser without writing any code!
๐ Ready to Build?โ
Quick Start Guide - Build your first P2P app in 5 minutes
๐ Need Details?โ
Installation Guide - Complete setup instructions for all platforms
๐จ Want to Explore?โ
Playground Guide - Learn all playground features and capabilities
๐ฆ What You'll Buildโ
With the Vaultys SDK, you can create:
-
๐ฌ P2P Chat Applications
- End-to-end encrypted messaging
- File and media sharing
- Read receipts and typing indicators
- Offline message queuing
-
๐จ Collaborative Tools
- Real-time canvas drawing
- Shared document editing
- Live cursor tracking
- Automatic synchronization
-
๐ Decentralized Identity Systems
- Self-sovereign identities (DIDs)
- WebAuthn/Passkey support
- No central authority required
- User-owned data
-
๐ Distributed Applications
- Direct peer connections
- No backend servers needed
- Automatic NAT traversal
- Cross-platform support
โก Quick Overviewโ
1. Install the SDKโ
npm install @vaultys/peer-sdk @vaultys/id
2. Create an Identityโ
import { VaultysId } from '@vaultys/id';
// Software-based identity
const identity = await VaultysId.generatePerson();
// Or hardware-based with passkey
const identity = await VaultysId.createWebauthn(true);
console.log('My DID:', identity.did);
3. Connect to P2P Networkโ
import { setupVaultysPeerSDK, BrowserStorageProvider } from '@vaultys/peer-sdk';
const peer = setupVaultysPeerSDK({
vaultysId: identity,
storageProvider: new BrowserStorageProvider()
});
await peer.initialize();
console.log('Connected to P2P network!');
4. Send Your First Messageโ
// Add a contact
const contact = await peer.addContact('did:vaultys:alice123', {
nickname: 'Alice'
});
// Send a message
await peer.sendMessage(contact.did, 'Hello Alice! ๐');
// Listen for replies
peer.on('message-received', (message) => {
console.log(`${message.from}: ${message.content}`);
});
๐๏ธ Architecture Overviewโ
Core Componentsโ
-
Identity Layer (
@vaultys/id)- Creates and manages decentralized identities
- Supports software keys and hardware passkeys
- No central authority or blockchain required
-
P2P Network (
@vaultys/peer-sdk)- Direct peer-to-peer connections via WebRTC
- Automatic NAT traversal and reconnection
- End-to-end encryption by default
-
Storage Layer
- Multiple storage providers (Browser, Node.js, Memory)
- Automatic data persistence
- Encrypted local storage
๐ Learning Pathโ
Beginnerโ
- Try the Playground - Explore features interactively
- Quick Start - Build a simple chat app
- Basic Examples - Learn from code examples
Intermediateโ
- P2P Chat Tutorial - Full chat implementation
- Collaborative Features - Add real-time collaboration
- React Integration - Use with React
Advancedโ
- API Reference - Complete API documentation
- Storage Providers - Custom storage solutions
- Production Deployment - Deploy to production
๐ ๏ธ Development Toolsโ
Browser DevTools Integrationโ
The SDK provides detailed logging in development mode:
const peer = setupVaultysPeerSDK({
vaultysId: identity,
debug: true // Enable detailed logging
});
Testing Utilitiesโ
Test P2P features locally:
// Create mock identities for testing
const alice = await VaultysId.generatePerson();
const bob = await VaultysId.generatePerson();
// Open in different tabs/windows
window.location.hash = alice.did; // Tab 1
window.location.hash = bob.did; // Tab 2
๐ก Key Conceptsโ
Decentralized Identity (DID)โ
Every peer has a unique, cryptographically secure identifier:
- Format:
did:vaultys:5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY - Self-generated, no registration needed
- Portable across applications
- User owns their identity
P2P Connectionโ
Direct connections between peers:
- No intermediate servers for data
- End-to-end encrypted
- Automatic reconnection
- Works through firewalls (NAT traversal)
Storage Providersโ
Flexible data persistence:
- Browser: IndexedDB, LocalStorage
- Node.js: File system
- Memory: Temporary storage
- Custom: Implement your own
๐ Ready to Start?โ
๐ฎ Try Playground
Test features instantly without code
๐ Quick Start
Build your first app in 5 minutes
๐ฆ Installation
Detailed setup for all platforms
๐ค Get Helpโ
- Discord Community - Chat with developers
- GitHub Issues - Report bugs
- Stack Overflow - Q&A
- Email Support - Direct assistance
๐ Licenseโ
The Vaultys SDK is open source and available under the MIT License. See LICENSE for details.
Ready to build the future of P2P applications? Let's go! ๐