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/clientnpm install @ravex/server @ravex/clientyarn add @ravex/server @ravex/clientNote: You do not need to install
@ravex/typesseparately. 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
- Server Quick Start — More detailed server setup
- Client Quick Start — Rich client examples
- Framework Integrations — Use with Express, Fastify, NestJS, etc.
- Core Concepts — Understand the data models
You're ready to build real-time chat experiences with full type safety.