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

x10minds-ai

v1.0.0

Published

Comprehensive AI module for e-commerce with recommendations, analytics, chatbot, and smart search

Readme

X10Minds AI 🚀

Comprehensive AI module for e-commerce with recommendations, analytics, chatbot, and smart search capabilities.

npm version License: MIT

✨ Features

  • 🎯 Smart Recommendations - Personalized, similar, trending, and complementary product suggestions
  • 📊 Sales Forecasting - Predict future revenue with ML-powered analytics
  • 👥 Customer Insights - Behavioral analysis and segmentation
  • 🤖 AI Chatbot - Natural language understanding with 24/7 support
  • 🔍 Smart Search - Semantic search with typo correction and auto-complete

📦 Installation

npm install x10minds-ai

🚀 Quick Start

import { X10AI } from 'x10minds-ai';

// Initialize AI module
const ai = new X10AI({
  apiKey: process.env.ANY_AI_KEY,
  shopId: 'your-shop-id',
  features: ['recommendations', 'analytics', 'chatbot', 'search']
});

// Connect to your shop
await ai.connect(shop);

console.log('AI features enabled:', ai.getEnabledFeatures());

🎯 Recommendations

Get Personalized Recommendations

const recommendations = await ai.getRecommendations({
  userId: 'user_123',
  type: 'personalized',
  limit: 10,
  context: {
    currentProduct: 'prod_456',
    category: 'electronics'
  }
});

recommendations.forEach(rec => {
  console.log(`${rec.product.name} - Score: ${rec.score}`);
  console.log(`Reason: ${rec.reason}`);
});

Recommendation Types

1. Personalized - Based on user history

const personalized = await ai.getRecommendations({
  userId: 'user_123',
  type: 'personalized',
  limit: 10
});

2. Similar Items - Products related to current item

const similar = await ai.getRecommendations({
  type: 'similar',
  limit: 5,
  context: {
    currentProduct: 'prod_456'
  }
});

3. Trending - Popular products

const trending = await ai.getRecommendations({
  type: 'trending',
  limit: 10,
  context: {
    category: 'electronics'
  }
});

4. Complementary - Frequently bought together

const complementary = await ai.getRecommendations({
  type: 'complementary',
  limit: 5,
  context: {
    currentProduct: 'prod_456'
  }
});

Track User Interactions

// Track product views
ai.trackUserInteraction('user_123', 'prod_456', 'view');

// Track purchases
ai.trackUserInteraction('user_123', 'prod_456', 'purchase');

// Track cart additions
ai.trackUserInteraction('user_123', 'prod_456', 'cart');

📊 Analytics

Sales Forecasting

const forecast = await ai.predictSales({
  period: '30days',
  products: ['prod_001', 'prod_002'],
  includeSeasonality: true
});

console.log('Expected revenue:', forecast.revenue);
console.log('Expected units:', forecast.units);
console.log('Confidence:', forecast.confidence);

// Daily breakdown
forecast.breakdown.forEach(day => {
  console.log(`${day.date}: $${day.revenue} (${day.units} units)`);
});

Customer Insights

const insights = await ai.analyzeCustomers({
  segment: 'high-value',
  metrics: ['lifetime_value', 'churn_risk', 'next_purchase']
});

console.log('Total customers:', insights.totalCustomers);
console.log('Average value:', insights.averageValue);

insights.segments.forEach(segment => {
  console.log(`\n${segment.name}:`);
  console.log(`  Size: ${segment.size} customers`);
  console.log(`  Value: $${segment.value}`);
  console.log(`  Churn Risk: ${segment.churnRisk}`);
  console.log('  Actions:', segment.actions);
});

Real-time Analytics

const realtime = ai.getRealtimeAnalytics();

console.log('Revenue (24h):', realtime.revenue24h);
console.log('Units sold (24h):', realtime.units24h);
console.log('Average order value:', realtime.averageOrderValue);
console.log('Active customers:', realtime.activeCustomers);

🤖 AI Chatbot

Setup Chatbot

ai.setupChatbot({
  name: 'ShopBot',
  personality: 'friendly',
  languages: ['en', 'es', 'fr'],
  capabilities: [
    'product_search',
    'order_tracking',
    'faq',
    'recommendations'
  ],
  fallback: {
    enabled: true,
    handoffToHuman: true
  }
});

Handle Chat Messages

const context = {
  userId: 'user_123',
  conversationId: 'conv_456',
  history: []
};

const response = await ai.generateResponse(
  'I\'m looking for wireless headphones under $100',
  context
);

console.log('Bot:', response.text);
console.log('Confidence:', response.confidence);

if (response.products) {
  console.log('Suggested products:', response.products);
}

if (response.suggestions) {
  console.log('Quick replies:', response.suggestions);
}

if (response.requiresHuman) {
  console.log('⚠️ Requires human agent');
}

Chatbot Capabilities

  • Product Search - Find products by description
  • Order Tracking - Check order status
  • FAQ - Answer common questions
  • Recommendations - Suggest products
  • Natural Language - Understands context and intent

🔍 Smart Search

Setup Search

ai.setupSearch({
  fields: ['name', 'description', 'tags', 'category'],
  weights: {
    name: 2.0,
    description: 1.0,
    tags: 1.5,
    category: 1.0
  },
  features: {
    typoTolerance: true,
    synonyms: true,
    semanticSearch: true
  }
});

Perform Search

const results = await ai.search({
  query: 'wireles headfones', // Note the typos!
  filters: {
    category: 'electronics',
    priceRange: [50, 200],
    inStock: true
  },
  limit: 20
});

console.log(`Found ${results.total} products in ${results.processingTime}ms`);

results.hits.forEach(hit => {
  console.log(`${hit.product.name} - Score: ${hit.score}`);
  
  // Highlighted matches
  if (hit.highlights) {
    console.log('Matches:', hit.highlights);
  }
});

Auto-complete Suggestions

const suggestions = ai.getSearchSuggestions('head', 5);
console.log('Suggestions:', suggestions);
// Output: ['headphones', 'headset', 'headers', ...]

⚙️ Configuration

Advanced Configuration

ai.configure({
  recommendations: {
    algorithm: 'hybrid', // 'collaborative' | 'content' | 'hybrid'
    minScore: 0.7,
    maxResults: 10,
    updateFrequency: '1hour'
  },
  analytics: {
    dataRetention: '90days',
    realTimeUpdates: true,
    customMetrics: ['conversion_rate', 'avg_order_value']
  },
  chatbot: {
    responseTime: 'instant', // 'instant' | 'fast' | 'normal'
    confidenceThreshold: 0.8,
    learningMode: 'active' // 'active' | 'passive'
  }
});

📈 Performance Metrics

Get AI Metrics

const metrics = await ai.getMetrics({
  period: '7days',
  features: ['recommendations', 'search', 'chatbot']
});

// Recommendation metrics
console.log('Recommendation CTR:', metrics.recommendations.ctr);
console.log('Conversion rate:', metrics.recommendations.conversionRate);
console.log('Total served:', metrics.recommendations.totalServed);

// Search metrics
console.log('Search success rate:', metrics.search.successRate);
console.log('Average results:', metrics.search.averageResults);
console.log('Top queries:', metrics.search.topQueries);

// Chatbot metrics
console.log('Satisfaction:', metrics.chatbot.satisfaction);
console.log('Avg response time:', metrics.chatbot.averageResponseTime);
console.log('Total conversations:', metrics.chatbot.totalConversations);

🔄 Dynamic Updates

Add Products Dynamically

ai.addProducts([
  {
    id: 'prod_new',
    name: 'New Product',
    description: 'Amazing new product',
    price: 99.99,
    category: 'electronics',
    tags: ['new', 'trending']
  }
]);

Update User Data

ai.updateUser({
  id: 'user_123',
  email: '[email protected]',
  history: {
    views: ['prod_001', 'prod_002'],
    purchases: ['prod_001'],
    searches: ['laptop', 'headphones'],
    cart: ['prod_003']
  },
  preferences: {
    categories: ['electronics', 'books'],
    priceRange: [50, 500]
  }
});

🎨 Best Practices

1. Data Quality

Ensure clean, accurate product data for better AI performance:

const product = {
  id: 'prod_123',
  name: 'Clear, descriptive name',
  description: 'Detailed description with keywords',
  category: 'electronics',
  tags: ['wireless', 'bluetooth', 'premium'],
  price: 99.99,
  stock: 50
};

2. Regular Updates

Keep AI models trained with latest data:

// Track all user interactions
ai.trackUserInteraction(userId, productId, 'view');
ai.trackUserInteraction(userId, productId, 'purchase');

3. Monitor Performance

Track AI metrics and optimize:

const metrics = await ai.getMetrics({ period: '7days' });
if (metrics.recommendations.ctr < 0.1) {
  // Adjust recommendation algorithm
  ai.configure({
    recommendations: { algorithm: 'hybrid' }
  });
}

4. A/B Testing

Test different configurations:

// Test different recommendation types
const testA = await ai.getRecommendations({ type: 'personalized' });
const testB = await ai.getRecommendations({ type: 'trending' });

📚 API Reference

X10AI Class

Constructor

new X10AI(config: X10AIConfig)

Methods

  • connect(shop: any): Promise<void> - Connect AI to shop
  • getEnabledFeatures(): AIFeature[] - Get enabled features
  • getRecommendations(request: RecommendationRequest): Promise<Recommendation[]>
  • trackUserInteraction(userId: string, productId: string, event: string): void
  • predictSales(request: SalesForecastRequest): Promise<SalesForecast>
  • analyzeCustomers(request: CustomerAnalysisRequest): Promise<CustomerInsights>
  • setupChatbot(config: ChatbotConfig): void
  • generateResponse(message: string, context: ChatContext): Promise<ChatResponse>
  • setupSearch(config: SearchConfig): void
  • search(request: SearchRequest): Promise<SearchResult>
  • configure(config: AIConfiguration): void
  • getMetrics(request: MetricsRequest): Promise<AIMetrics>

🔐 Environment Variables

ANY_AI_KEY=your_api_key_here
ANY_SHOP_ID=your_shop_id_here

🤝 Integration with X10Minds Shop

import { X10Shop } from 'x10minds-shop';
import { X10AI } from 'x10minds-ai';

// Initialize shop
const shop = new X10Shop({
  name: 'My Store',
  currency: 'USD'
});

// Initialize AI
const ai = new X10AI({
  apiKey: process.env.ANY_AI_KEY,
  shopId: process.env.ANY_SHOP_ID
});

// Connect AI to shop
await ai.connect(shop);

// Now AI has access to all shop data!

📄 License

MIT © X10Minds

🆘 Support

🌟 Examples

Check out the /examples directory for complete working examples:

  • quick-start.js - Basic setup and usage
  • recommendations-demo.js - All recommendation types
  • analytics-demo.js - Sales forecasting and insights
  • chatbot-demo.js - AI chatbot implementation
  • search-demo.js - Smart search features
  • full-integration.js - Complete e-commerce integration

Made with ❤️ by X10Minds