Vaultys Peer SDK Overview
A decoupled, reusable SDK for peer-to-peer communication built on WebRTC. This SDK provides a clean, interface-based architecture for building peer-to-peer applications with support for messaging, file sharing, audio/video calls, and group communication.
๐ Why Vaultys Peer SDK?โ
The Challenge of P2P Developmentโ
Building peer-to-peer applications traditionally requires:
- Deep understanding of WebRTC complexities
- NAT traversal and STUN/TURN configuration
- Connection management and state handling
- Implementing reconnection logic
- Building message protocols from scratch
- Handling edge cases and network failures
Our Solutionโ
Vaultys Peer SDK abstracts away these complexities while maintaining flexibility:
- Batteries Included: Powered by VaultysId for enterprise-grade DID management
- Scale Effortlessly: Lazy loading enables managing thousands of peers with zero overhead
- Your Infrastructure: Bring your own signaling server for complete control
- Developer First: Clean APIs, TypeScript support, and comprehensive documentation
โจ Key Featuresโ
๐ Powered by VaultysIdโ
Built on VaultysId, the leading open-source Decentralized Identity System. Get W3C-compliant DIDs, verifiable credentials, and key management out of the box. Passkey and FIDO2 authentication has never been so easy! Enable passwordless login with just one line of code - your users can authenticate with fingerprint, Face ID, or security keys.
โก Lazy Loading Magicโ
Manage thousands of peers without performance impact. Connections are established only when messages are exchanged, making it perfect for large-scale applications.
๐๏ธ Infrastructure Flexibilityโ
- Bring your own signaling server today
- Configure custom STUN/TURN servers
- Deploy on-premise or in the cloud
- Coming Soon: Bring your own DID system
๐ Security Firstโ
- Passwordless authentication with passkeys/FIDO2
- Biometric and security key support
- End-to-end encryption support
- DID-based authentication
- No central message storage
- Privacy by design
๐ฆ TypeScript Nativeโ
Full TypeScript support with comprehensive type definitions, enabling better IDE support and catching errors at compile time.
๐ฏ Perfect Forโ
Applicationsโ
- ๐ฌ Chat Applications: WhatsApp-like messaging with E2E encryption
- ๐ File Sharing: Dropbox-style sharing without the middleman
- ๐ฎ Multiplayer Games: Low-latency networking for real-time gameplay
- ๐น Video Conferencing: Zoom-like calls with WebRTC
- ๐ค Collaboration Tools: Real-time collaborative editing
- ๐ Secure Communications: Private channels for sensitive data
Industriesโ
- Healthcare: HIPAA-compliant peer-to-peer communication
- Finance: Secure document sharing and communication
- Education: Virtual classrooms and study groups
- Gaming: Multiplayer game networking
- Enterprise: Internal communication tools
๐๏ธ Architectureโ
The SDK follows a modular, interface-based architecture:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Your Application โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Vaultys Peer SDK โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโค
โ PeerService โ Storage โ Event Bus โ
โ โ Provider โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโผโโโโโโโโโโโโโโโโค
โ PeerJS โ IndexedDB โ EventEmitter โ
โ WebRTC โ OPFS โ โ
โ VaultysId โ Memory โ โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโดโโโโโโโโโโโโโโโโ
Core Componentsโ
- PeerService: Main service for peer management and operations
- VaultysPeer: Individual peer connection handling with auto-reconnection
- Storage Provider: Pluggable interface supporting any storage backend
- Event Bus: Decoupled event system for reactive applications
- Message Queue: Reliable message delivery with offline support
- Health Monitor: Real-time connection health tracking
๐ Performance & Scaleโ
Benchmarksโ
- Connection Time: < 1 second average
- Message Latency: 10-50ms typical (network dependent)
- Concurrent Peers: 1000+ supported with lazy loading
- Memory Usage: ~2MB base + ~100KB per active connection
- File Transfer: Limited only by bandwidth
Optimization Featuresโ
- Connection pooling
- Automatic reconnection with exponential backoff
- Message queuing for offline peers
- Lazy connection establishment
- Efficient binary data transfer
๐ ๏ธ Technology Stackโ
- WebRTC: For peer-to-peer communication
- PeerJS: Simplified WebRTC wrapper
- VaultysId: Decentralized identity management
- TypeScript: Type-safe development
- Node.js & Browser: Cross-platform support
๐จ Design Principlesโ
-
Simple by Default, Powerful When Needed
- Get started with minimal configuration
- Advanced features available when required
-
Interface-Based Architecture
- Swap implementations without changing code
- Extend functionality through plugins
-
Developer Experience First
- Comprehensive documentation
- Clear error messages
- Extensive examples
-
Privacy & Security
- No central servers for messages
- End-to-end encryption support
- User-controlled data
-
Production Ready
- Battle-tested in real applications
- Automatic error recovery
- Health monitoring
๐ฆ Getting Startedโ
Quick Installationโ
# npm
npm install @vaultys/peer-sdk
# yarn
yarn add @vaultys/peer-sdk
# pnpm
pnpm add @vaultys/peer-sdk
Your First P2P Appโ
import { setupVaultysPeerSDK } from '@vaultys/peer-sdk';
import { VaultysId } from '@vaultys/id';
// Authenticate with passkey - incredibly simple!
const identity = await VaultysId.authenticate({
passkey: true // That's it! Biometric/security key auth
});
// Initialize with authenticated identity
const peer = setupVaultysPeerSDK({ identity });
await peer.initialize(identity.did);
// Connect to a friend (lazy - no connection yet!)
const friend = await peer.addContact('did:vaultys:bob');
// Send a message (connection established now!)
await peer.sendMessage(friend.did, 'Hello P2P World! ๐');
// Listen for messages
peer.on('message-received', (msg) => {
console.log(`${msg.from}: ${msg.content}`);
});
๐ Documentationโ
- Getting Started Guide - Installation and setup
- Quick Start Tutorial - Build your first app
- API Reference - Detailed API documentation
- Examples - Working code examples
- Playground - Interactive demo environment
๐ค Community & Supportโ
Get Helpโ
- ๐ฌ Discord Community - Chat with developers
- ๐ GitHub Issues - Report bugs
- ๐ก Discussions - Share ideas
Stay Updatedโ
- โญ Star on GitHub - Show support
- ๐ฆ NPM Package - Latest versions
- ๐ฐ Blog - Tutorials and updates
๐ Why Choose Vaultys Peer SDK?โ
| Feature | Vaultys Peer SDK | Traditional WebRTC | Other P2P SDKs |
|---|---|---|---|
| Passkey/FIDO2 Auth | โ One-line setup | โ Not included | โ Not included |
| DID Integration | โ Built-in VaultysId | โ Manual setup | โ ๏ธ Limited |
| Lazy Loading | โ 1000+ peers | โ Not supported | โ ๏ธ Limited scale |
| Custom Signaling | โ Full control | โ Manual config | โ Locked-in |
| TypeScript | โ Native | โ ๏ธ Varies | โ ๏ธ Varies |
| Storage Flexibility | โ Pluggable | โ DIY | โ Fixed |
| Documentation | โ Comprehensive | โ ๏ธ Technical | โ ๏ธ Basic |
| Enterprise Ready | โ Production tested | โ ๏ธ Requires work | โ Limited |
๐ Licenseโ
MIT License - See LICENSE for details.
Ready to build amazing P2P applications? Get Started Now โ