How revdotcom/revai-node-sdk works
Project Type and Purpose
• Type: Open-source Node.js SDK wrapping the Rev AI REST and streaming APIs.
• Purpose: Provide developers with a set of client classes to submit audio/video for transcription, translation, summarization, sentiment/topic analysis, language identification, streaming transcription, and custom-vocabulary management.
File Structure
• src/
– api-client.ts, custom-vocabularies-client.ts, language-id-client.ts, sentiment-analysis-client.ts, streaming-client.ts, topic-extraction-client.ts
– base-api-client.ts (abstract base for REST clients)
– api-request-handler.ts (HTTP transport via axios)
• examples/ (sample usage code showing integration points)
• test/unit (Jest unit tests with mocks) & test/integration (live API tests)
• build scripts (TypeScript → JavaScript), configuration (tsconfig.json, jest configs), CI/CD (GitHub workflows, Jenkinsfile), Dockerfile.
Extract Key Insights from the README
• The SDK exposes three main clients:
– RevAiApiClient (asynchronous REST API)
– RevAiStreamingClient (WebSocket streaming API)
– RevAiCustomVocabulariesClient (custom vocabulary REST API)
• Features covered: job submission, status polling, transcript retrieval (text, JSON, captions), summaries, translations, streaming events, custom vocab lifecycle.
– Developer/User: Imports the SDK into their application
– SDK Layer (in your package)
• Client Classes (public API)
– RevAiApiClient
– RevAiStreamingClient
– RevAiCustomVocabulariesClient
• Core Transport
– ApiRequestHandler (HTTP via axios)
– WebSocket handler (built into streaming-client.ts)
• BaseApiClient (common logic: auth headers, endpoint URLs)
– Build & Packaging
• TypeScript compiler → dist/
• npm packaging
– Tests
• Unit tests (mocks)
• Integration tests (real API)
– Examples: reference implementations showing usage patterns
– Developer → imports Client Classes
– Client Classes → call BaseApiClient → uses ApiRequestHandler to send HTTP requests to Rev AI REST endpoints
– RevAiStreamingClient → opens WebSocket connection to Rev AI streaming endpoint
– ApiRequestHandler ↔ axios / HTTP transport
– Model Layer ↔ Client Classes (serialization/deserialization)
– Build & Packaging → produces SDK consumed by Developer and Examples
– Tests → invoke Client Classes via mocks or live API
c. Architectural Patterns & Principles
– Layered architecture: Public API → Core logic → Transport → External services
– Separation of concerns: each analysis feature has its own client and model sub-package
– Extensibility: new features can add clients and models in the same pattern
– DRY via BaseApiClient and shared ApiRequestHandler
d. Key Technologies/Frameworks
– Node.js, TypeScript
– axios for HTTP
– WebSocket (native) for streaming
– Jest for testing
– npm for packaging
– GitHub Actions / Jenkins for CI/CD
– Docker (for containerized builds/tests)