Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

echofi-client

echofi-ai1.9kMIT3.19.0TypeScript support: included

A comprehensive TypeScript/JavaScript client library for EchoFi services with automatic gRPC-Web code generation, unified service access, and real-time WebSocket communication.

typescript, grpc, grpc-web, grpc-client, echofi, music-streaming, websocket, real-time, auto-generation, protobuf, microservices, client-library, type-safe, unified-client

readme

EchoFi gRPC Client

A comprehensive TypeScript/JavaScript client library for EchoFi services with automatic gRPC-Web code generation and unified service access.

🚀 Features

  • Auto-Generated Client: Automatically discovers and generates clients for all proto services
  • Unified Interface: Single client instance provides access to all backend services
  • Type-Safe: Full TypeScript support with generated types
  • Future-Proof: Just add proto files and regenerate - no manual code changes needed
  • WebSocket Support: Real-time communication capabilities
  • Cross-Platform: Works in browsers (gRPC-Web) and Node.js (gRPC)

📦 Installation

npm install echofi-client

🔧 Quick Start

import { EchoFiGrpcWebClient, Messages } from 'echofi-client';

// Initialize client
const client = new EchoFiGrpcWebClient({
  host: 'localhost',
  port: 8080
});

await client.initialize();

// Use Music Service
const request = new Messages.Music.Service.ListArtistsRequest();
request.setOffset(0);
request.setLimit(10);

const response = await client.music.listArtists(request);
const artists = response.getArtistsList();

console.log('Artists:', artists.map(artist => ({
  id: artist.getArtistId(),
  name: artist.getName()
})));

🏗️ Development

Adding New Services

  1. Add your proto files to proto/ directory
  2. Run generation script:
    npm run generate-client
  3. Your new service is automatically available in the unified client!

Available Scripts

  • npm run generate-client - Generate client from proto files and build
  • npm run build - Build the library
  • npm run clean - Clean generated files and dist
  • npm run dev - Run in development mode

📚 API Reference

Available Services

  • Music Service: Artists, albums, tracks, genres
  • User Service: User management and authentication
  • Activity Service: Listening sessions, favorites, playlists
  • Stats Service: User points, statistics, boosts

Client Configuration

interface EchoFiGrpcWebClientConfig {
  host?: string;        // Default: 'localhost'
  port?: number;        // Default: 8080
  secure?: boolean;     // Default: false
  credentials?: object; // gRPC credentials
  options?: object;     // gRPC options
}

🔄 Auto-Generation

The client automatically discovers all services in your proto directory and generates:

  • Service clients with proper TypeScript types
  • Message classes for requests/responses
  • Unified client interface
  • Helper methods for common operations

📄 License

MIT License - see LICENSE file for details.