Flock
Getting started

Installation

Install Flock in your project and choose a server hosting path.

Client packages

# React adapter (includes @xevrion/flock-core as a dependency)
npm install @xevrion/flock-react
 
# Framework-agnostic core only
npm install @xevrion/flock-core

Server options

Option 1: npx (quickest)

No install needed. Just run:

npx @xevrion/flock-server

Environment variables:

VariableDefaultDescription
FLOCK_PORT8787Port to listen on
FLOCK_REDIS_URLRedis URL for multi-instance mode
FLOCK_API_KEYSComma-separated keys (omit for open mode)
FLOCK_PRESENCE_TTL_SECONDS30Seconds before an idle user is evicted

Option 2: Docker

docker run -p 8787:8787 ghcr.io/xevrion/flock-server:latest

With Redis (for scaling across multiple instances):

docker run -p 8787:8787 \
  -e FLOCK_REDIS_URL=redis://your-redis-host:6379 \
  ghcr.io/xevrion/flock-server:latest

Option 3: Programmatic (embed in an existing Node server)

import { FlockServer } from "@xevrion/flock-server";
 
const server = new FlockServer({
  port: 8787,
  redisUrl: process.env.REDIS_URL,
});
 
await server.start();

Requirements

  • Node.js 22 or later
  • React 18+ (for @xevrion/flock-react)

On this page