helene icon indicating copy to clipboard operation
helene copied to clipboard

Real-time Web Apps for Node.js

Tests npm GitHub GitHub watchers GitHub Repo stars


Helene


Real-time Web Apps for Node.js

📘 Documentation


  • ⚡️ Real-time - Helene is a real-time framework for Node.js and the browser.
  • 🦾 Event-driven - Helene is event-driven, which means that it uses events to communicate between the server and the client.
  • 🪝 React Hooks - Helene provides a set of React Hooks to easily integrate your React application with the server.

Quickstart

npm install @helenejs/server @helenejs/client

Core Packages

  • @helenejs/server - Create a Helene server in Node.js
  • @helenejs/client - Connect to your Helene server from the browser or Node.js
  • @helenejs/data - In-memory database for the browser and Node.js with syntax similar to MongoDB
  • @helenejs/react - A set of React hooks and utilities to easily integrate your React application with Helene
  • @helenejs/utils - A set of utilities used by Helene or its extensions

// server.js

import { createServer } from '@helenejs/server'

createServer({
  host: 'localhost',
  port: 3000,
})

// Methods

Helene.addMethod('hello', () => 'Hello World!')

// Events

Helene.addEvent('event')

Helene.addMethod('emit:event', () => {
  Helene.emit('event', { message: 'Hello World!' })
})
// client.js

import { Client } from '@helenejs/client'

const client = new Client({
  host: 'localhost:3000',
})

// Methods

const result = await client.call('hello')

console.log(result) // Hello World!

// Events

await client.subscribe('event')

client.on('event', (data) => {
  console.log(data) // { message: 'Hello World!' }
})

await client.call('emit:event')

Stats

Alt

License

MIT