@nomyx/decentranet
v1.0.1
Published
A library for managing multi-context objects in distributed applications
Downloads
7
Maintainers
Readme
@nomyx/decentranet
A powerful library for building decentralized applications that can run seamlessly across browser, server, and peer environments.
Features
- Multi-context Support: Run your app in browser, server, or peer environments with a unified API.
- Reactive UI: Build dynamic user interfaces with a reactive component system.
- Distributed State Management: Easily manage and synchronize state across multiple peers.
- Peer-to-Peer Communication: Seamless P2P networking with built-in WebRTC support.
- Plugin System: Extend your app's functionality with a flexible plugin architecture.
- Development Tools: Comprehensive toolset for debugging and monitoring your decentralized apps.
- TypeScript Support: Full TypeScript support for enhanced developer experience.
Installation
npm install @nomyx/decentranet
or
yarn add @nomyx/decentranet
Quick Start
Here's a simple example to get you started with a decentralized chat application:
import { DecentralizedApp, Component, GunDataProvider } from '@nomyx/decentranet';
class ChatComponent extends Component<{ messages: string[] }, {}> {
constructor(contexts: string[], dataProvider: GunDataProvider) {
super(contexts, dataProvider, { messages: [] }, {});
}
render(): string {
return `
<div>
${this.state.messages.map(msg => `<p>${msg}</p>`).join('')}
</div>
<input id="messageInput" type="text">
<button onclick="sendMessage()">Send</button>
`;
}
sendMessage(message: string) {
this.setState({ messages: [...this.state.messages, message] });
}
}
const app = new DecentralizedApp(new GunDataProvider());
app.initialize().then(() => {
const chatComponent = new ChatComponent(['browser'], app.gunDataProvider);
chatComponent.mount(document.getElementById('app')!);
app.start();
});
Documentation
For more detailed information about using @nomyx/decentranet, please refer to our comprehensive guide.
API Reference
Detailed API documentation can be found here.
Examples
Check out our examples directory for more complex usage scenarios and best practices.
Contributing
We welcome contributions! Please see our Contributing Guide for more details.
License
@nomyx/decentranet is MIT licensed.
Support
If you encounter any issues or have questions, please file an issue on our GitHub issue tracker.
Acknowledgements
@nomyx/decentranet is built on top of several amazing open-source projects, including GunDB, WebRTC, and many others. We're grateful for their contributions to the open-source community.
Stay Connected
- Follow us on Twitter for updates
- Join our Discord community for discussions and support
Happy decentralized app building!