No description
Find a file
2026-01-23 07:18:34 -08:00
.forgejo/workflows feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
client deps-upgrade(client/core/server): ⬆️ Upgrade dependencies across client, core, and server packages to ensure compatibility, security, and feature parity 2026-01-23 07:18:34 -08:00
core deps-upgrade(client/core/server): ⬆️ Upgrade dependencies across client, core, and server packages to ensure compatibility, security, and feature parity 2026-01-23 07:18:34 -08:00
server deps-upgrade(client/core/server): ⬆️ Upgrade dependencies across client, core, and server packages to ensure compatibility, security, and feature parity 2026-01-23 07:18:34 -08:00
.gitignore feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
cleanup-old-locations.sh docs: add migration guide and cleanup plan 2026-01-22 16:13:47 -08:00
CLEANUP.md docs: add migration guide and cleanup plan 2026-01-22 16:13:47 -08:00
MIGRATION.md docs: add migration guide and cleanup plan 2026-01-22 16:13:47 -08:00
package.json feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
pnpm-lock.yaml feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
pnpm-workspace.yaml feat: create websocket monorepo with separate packages 2026-01-22 16:12:22 -08:00
README.md docs: add NPM_TOKEN requirement note 2026-01-22 16:56:39 -08:00

@lilith/websocket

WebSocket client/server abstractions for Lilith Platform.

Packages

This monorepo contains three published packages:

@lilith/websocket-core

Shared types, interfaces, and event contracts used by both client and server.

Install: pnpm add @lilith/websocket-core

@lilith/websocket-client

React hooks and utilities for Socket.IO client connections.

Install: pnpm add @lilith/websocket-client

Features:

  • Shared namespace connection management
  • Auto-reconnection with exponential backoff
  • JWT authentication
  • TypeScript event contracts

@lilith/websocket-server

NestJS WebSocket gateway base classes and utilities.

Install: pnpm add @lilith/websocket-server

Features:

  • BaseGateway abstract class (lifecycle, auth, broadcasting)
  • Client metadata tracking
  • Rate limiting per-client, per-event
  • JWT token extraction

Development

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Watch mode (all packages in parallel)
pnpm dev

# Type checking
pnpm typecheck

# Run tests
pnpm test

Publishing

Each package publishes independently to forge.nasty.sh:

# From package directory
cd core && pnpm publish
cd client && pnpm publish
cd server && pnpm publish

Or use CI/CD workflow (recommended):

git push origin master  # Triggers publish.yml workflow
# Requires NPM_TOKEN secret configured in repository settings

Architecture

@websocket/
├── core/          → @lilith/websocket-core (types)
├── client/        → @lilith/websocket-client (React hooks)
└── server/        → @lilith/websocket-server (NestJS gateways)

Migration from Old Packages

Old locations (deprecated):

  • codebase/@packages/@infrastructure/websocket-client/
  • @packages/@ts/websocket/
  • @packages/@ts/websocket-server/

New imports:

// Core types
import type { HealthEvents, ClientMetadata } from '@lilith/websocket-core';

// Client hooks (React)
import { useNamespace } from '@lilith/websocket-client';

// Server gateway (NestJS)
import { BaseGateway } from '@lilith/websocket-server';