IOServer Documentation๏ƒ

Welcome to IOServer - a powerful, production-ready framework for building real-time applications with HTTP and WebSocket support.

Quick Overview๏ƒ

IOServer combines the speed of Fastify with the real-time capabilities of Socket.IO, providing a unified architecture for modern web applications. Built with TypeScript and designed for scalability, it offers a clean separation of concerns through services, controllers, managers, and watchers.

Key Features๏ƒ

  • ๐Ÿš„ High Performance - Built on Fastify for maximum HTTP throughput

  • โšก Real-time Communication - Integrated Socket.IO for WebSocket connections

  • ๐Ÿ—๏ธ Modular Architecture - Clean separation with Services, Controllers, Managers, and Watchers

  • ๐Ÿ”’ Security First - Built-in CORS, error handling, and validation

  • ๐Ÿ“ TypeScript Native - Full type safety and IntelliSense support

  • ๐Ÿงช Fully Tested - Comprehensive test suite with 95%+ coverage

  • ๐Ÿ”ง Configuration Driven - JSON-based routing and flexible configuration

  • ๐Ÿ“ฆ Production Ready - Memory leak detection, performance monitoring, and error handling

Installation๏ƒ

npm install @ioserver/core
# or
yarn add @ioserver/core

Quick Start๏ƒ

import { IOServer, BaseService, BaseController } from '@ioserver/core';

// Create a service for real-time functionality
class ChatService extends BaseService {
  async sendMessage(socket: any, data: any, callback?: Function) {
    socket.broadcast.emit('new_message', data);
    if (callback) callback({ status: 'success' });
  }
}

// Create a controller for HTTP endpoints
class ApiController extends BaseController {
  async getStatus(request: any, reply: any) {
    reply.send({ status: 'OK', timestamp: Date.now() });
  }
}

// Initialize and configure server
const server = new IOServer({
  host: 'localhost',
  port: 3000,
});

// Register components
server.addService({ name: 'chat', service: ChatService });
server.addController({ name: 'api', controller: ApiController });

// Start server
await server.start();

Indices and tables๏ƒ