Ravex

Getting Started

Install ravex and build your first real-time chat experience in minutes.

Getting Started

Get up and running with ravex in under 5 minutes.

Installation

Choose your preferred package manager:

# Server (backend)
pnpm add @ravex/server

# Client (frontend / Node)
pnpm add @ravex/client
npm install @ravex/server @ravex/client
yarn add @ravex/server @ravex/client

Note: You do not need to install @ravex/types separately. The types are automatically included when you install the server or client packages.

Minimal Example

Here's the smallest possible end-to-end setup.

1. Server

import { createServer } from "http";
import { ChatEngine } from "@ravex/server";

const httpServer = createServer();

const engine = new ChatEngine(httpServer, {
  socket: {
    cors: { origin: "*" },
  },
});

httpServer.listen(3000, () => {
  console.log("Ravex server running on http://localhost:3000");
});

2. Client

import { ChatClient } from "@ravex/client";
import type { User } from "@ravex/client";

const user: User = {
  id: "user-123",
  username: "alice",
  status: "online",
  socketIds: [],
};

const client = new ChatClient({
  url: "http://localhost:3000",
  auth: { user },
});

client.onMessage((message) => {
  console.log("New message:", message);
});

await client.sendMessage({
  roomId: "general",
  content: "Hello from ravex!",
});

Next Steps

You're ready to build real-time chat experiences with full type safety.

On this page