npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@courseecho/ai-client-node

v1.2.0

Published

Node.js client for CourseEcho AI API. Server-side SDK for backend integrations.

Readme

@courseecho/ai-client-node

Node.js client for AI orchestrator - Backend integration for server-side AI queries.

npm version Node.js License: MIT

Overview

Production-ready Node.js client with:

  • Express/Koa middleware support
  • AWS Lambda compatible
  • Streaming responses
  • Batch processing
  • Full TypeScript support
  • Zero external dependencies beyond @courseecho/ai-core-sdk

Installation

npm install @courseecho/ai-client-node @courseecho/ai-core-sdk

Quick Start

import { AiClient } from '@courseecho/ai-client-node';

const client = new AiClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://ai.courseecho.com'
});

const response = await client.query({
  query: 'How do I get started with React?',
  context: { pageType: 'course', entityId: 'react-101' }
});

console.log(response.answer);

v2.1+ Features

Basic Query

const response = await client.query({
  query: 'What is the difference between state and props?',
  context: { pageType: 'lesson', entityId: 'lesson-456' },
  userId: 'user-123'
});

console.log('Answer:', response.answer);
console.log('Confidence:', response.confidence);

Streaming Responses

const stream = await client.queryStream({
  query: 'Explain React hooks',
  context: { pageType: 'course', entityId: 'react-101' }
});

stream.on('data', (chunk) => {
  process.stdout.write(chunk);
});

stream.on('end', () => {
  console.log('\n[Complete]');
});

Usage Examples

Express Integration

import express from 'express';
import { AiClient } from '@courseecho/ai-client-node';

const app = express();
const client = new AiClient({ apiKey: 'your-api-key' });

app.post('/api/ask', async (req, res) => {
  try {
    const { query, courseId } = req.body;
    const response = await client.query({
      query,
      context: { pageType: 'course', entityId: courseId },
      userId: req.user?.id
    });
    res.json(response);
  } catch (error) {
    res.status(500).json({ error: error.message });
  }
});

app.listen(3000);

AWS Lambda

import { AiClient } from '@courseecho/ai-client-node';

const client = new AiClient({
  apiKey: process.env.COURSEECHO_API_KEY
});

export const handler = async (event) => {
  const { query, courseId } = JSON.parse(event.body);
  const response = await client.query({
    query,
    context: { pageType: 'course', entityId: courseId }
  });
  return {
    statusCode: 200,
    body: JSON.stringify(response)
  };
};

Batch Processing

import { AiClient } from '@courseecho/ai-client-node';

const client = new AiClient({ apiKey: 'your-api-key' });

const queries = [
  { query: 'What is React?', courseId: 'react-101' },
  { query: 'What is Vue?', courseId: 'vue-101' },
  { query: 'What is Angular?', courseId: 'angular-101' }
];

const results = await Promise.all(
  queries.map(q => 
    client.query({
      query: q.query,
      context: { pageType: 'course', entityId: q.courseId }
    })
  )
);

results.forEach(r => console.log(r.answer));

Configuration

const client = new AiClient({
  apiKey: 'your-api-key',           // Required
  jwtToken: 'token',                // Optional - use instead of apiKey
  baseUrl: 'https://ai.courseecho.com', // Default
  timeout: 30000,                   // 30s default
  retries: 2,                       // Retry on failure
  wordDelay: 28                     // Typewriter effect (ms)
});

Authentication

API Key (Recommended):

const client = new AiClient({ apiKey: 'your-api-key' });

JWT Token:

const client = new AiClient({ jwtToken: user.token });

Error Handling

try {
  const response = await client.query({
    query: 'Help me with React',
    context: { pageType: 'course' }
  });
} catch (error) {
  if (error.code === 'QUOTA_EXCEEDED') {
    console.log('Query quota exceeded');
  } else if (error.code === 'UNAUTHORIZED') {
    console.log('Invalid API key');
  } else {
    console.log('Error:', error.message);
  }
}

Support

  • Docs: https://courseecho.com/docs
  • Issues: https://github.com/COURSEECHO/courseecho-ai-widget-sdk/issues
  • Email: [email protected]

License

MIT 2026 CourseEcho