ceigey / helene

Real-time Web Apps for Node.js and Bun

Home Page:https://helene.leonardoventurini.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tests npm GitHub GitHub watchers GitHub Repo stars


Helene


Real-time Web Apps for Node.js and Bun

📘 Documentation


  • ⚡️ Real-time - Helene is a real-time framework for Node.js, Bun 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

bun add @helenejs/server @helenejs/client
npm install @helenejs/server @helenejs/client

Core Packages

  • @helenejs/server - Create a Helene server in Node.js or Bun
  • @helenejs/client - Connect to your Helene server from the browser, Node.js or Bun
  • @helenejs/data - In-memory database for the browser, Node.js and Bun 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

About

Real-time Web Apps for Node.js and Bun

https://helene.leonardoventurini.tech

License:MIT License


Languages

Language:TypeScript 99.2%Language:Mermaid 0.4%Language:JavaScript 0.3%Language:HTML 0.1%