Get up and running with VoidCore in 5 minutes!
# Clone the repository
git clone https://github.com/moe-charm/voidcore.js
cd voidcore-js
# Start local server
npm startOpen your browser and visit:
- ๐ Heart Transplant Demo: http://localhost:8080/challenge/voidcore-v13-transport-demo.html
- ๐ Multi-Channel Demo: http://localhost:8080/challenge/voidcore-v12-demo.html
- ๐ฏ All Examples: http://localhost:8080/examples/
<!DOCTYPE html>
<html>
<head>
<title>My VoidCore App</title>
</head>
<body>
<script type="module">
import { voidCore, Message } from './src/voidcore.js'
// Subscribe to messages
voidCore.subscribe('hello.world', (message) => {
console.log('Message received:', message.payload)
})
// Send a message
const message = Message.intent('greeter', 'hello.world', {
text: 'Hello, VoidCore!',
timestamp: Date.now()
})
voidCore.publish(message)
</script>
</body>
</html>import { voidCore, Message } from './src/voidcore.js'
class MyPlugin {
constructor(name) {
this.name = name
this.initialize()
}
async initialize() {
// Subscribe to events
voidCore.subscribe('task.request', (msg) => this.handleTask(msg))
// Announce capabilities
await voidCore.publish(Message.notice('plugin.ready', {
plugin: this.name,
capabilities: ['task.processing']
}))
}
async handleTask(message) {
console.log(`${this.name} processing:`, message.payload)
// Process the task
const result = await this.processTask(message.payload)
// Send response
await voidCore.publish(Message.intentResponse('task.result', {
result: result,
processedBy: this.name
}))
}
async processTask(payload) {
// Your task logic here
return `Processed: ${payload.data}`
}
}
// Create plugin instance
const myPlugin = new MyPlugin('TaskProcessor')import { voidCore } from './src/voidcore.js'
import { WebSocketTransport } from './src/transport.js'
// Swap to WebSocket without stopping the system
const wsTransport = new WebSocketTransport('ws://localhost:8080')
await voidCore.setTransport(wsTransport)
// All your existing plugins continue working!import { BroadcastChannelTransport } from './src/transport.js'
// Enable inter-tab communication
const bcTransport = new BroadcastChannelTransport('my-app')
await voidCore.setTransport(bcTransport)// Enable multi-channel mode for better performance
voidCore.enableMultiChannel()
// Send different message types
await voidCore.publish(Message.intentRequest('file_manager', 'file.open', data))
await voidCore.publish(Message.notice('system.status', { status: 'ready' }))
await voidCore.publish(Message.proposal('backup_system', 'backup.start', options))// Request something (expecting response)
Message.intentRequest(target, action, payload)
// Respond to a request
Message.intentResponse(type, payload)
// Announce something happened
Message.notice(type, payload)
// Suggest an action
Message.proposal(target, action, payload)
// Legacy format (still works)
Message.intent(target, action, payload)Want AI to build your app? Just:
- Clone this repo
- Tell Claude Code to read the docs
- Say "build [your app] with VoidCore"
The AI will handle architecture, implementation, and debugging!
// Announce your plugin
await voidCore.publish(Message.notice('plugin.announce', {
name: 'MyPlugin',
version: '1.0.0',
capabilities: ['file.processing', 'data.analysis']
}))
// Listen for other plugins
voidCore.subscribe('plugin.announce', (msg) => {
console.log('New plugin:', msg.payload.name)
})// Requester
const response = await new Promise(resolve => {
const responseId = `response.${Date.now()}`
voidCore.subscribe(responseId, resolve)
voidCore.publish(Message.intentRequest('processor', 'data.process', {
data: myData,
responseId: responseId
}))
})
// Responder
voidCore.subscribe('data.process', async (msg) => {
const result = await processData(msg.payload.data)
await voidCore.publish(Message.intentResponse(msg.payload.responseId, {
result: result
}))
})voidCore.subscribe('error.report', (msg) => {
console.error('Plugin error:', msg.payload)
})
// In your plugin
try {
// risky operation
} catch (error) {
await voidCore.publish(Message.notice('error.report', {
plugin: 'MyPlugin',
error: error.message,
timestamp: Date.now()
}))
}# Make sure you're serving via HTTP, not file://
npm start
# Then open http://localhost:8080 (not file:// URLs)// Check transport status
const stats = voidCore.getStats()
console.log('Transport:', stats.transport.type)
console.log('Status:', stats.transport.status)// Check if anyone is subscribed
const stats = voidCore.getStats()
console.log('Subscribers:', stats.totalSubscribers)
// Add debug logging
voidCore.subscribe('*', (msg) => console.log('All messages:', msg))- Explore the demos - See VoidCore in action
- Read the docs - Deep dive into architecture
- Build your plugin - Start with autonomous lifecycle
- Try transports - Experiment with WebSocket/BroadcastChannel
- Join the community - Contribute to the project!
Happy coding! ๐
The silence awaits your creativity.