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

@lanonasis/memory-client

v2.2.0

Published

Universal Memory as a Service (MaaS) Client SDK - Works everywhere: Browser, Node.js, React, Vue, Edge Functions

Readme

@lanonasis/memory-client

npm version TypeScript License: MIT

Memory as a Service (MaaS) Client SDK - Intelligent memory management with semantic search capabilities for JavaScript/TypeScript applications.

🚀 Features

  • 🧠 Semantic Search - Find memories by meaning, not just keywords
  • 🏷️ Smart Tagging - Organize memories with tags and topics
  • 📊 Analytics - Track memory usage and access patterns
  • 🔐 Secure - API key and token-based authentication
  • ⚡ Performance - Optimized with gateway routing and caching
  • 📱 Universal - Works in Node.js, browsers, and React applications
  • 🎯 TypeScript - Full type safety with comprehensive type definitions

📦 Installation

npm install @lanonasis/memory-client
yarn add @lanonasis/memory-client
pnpm add @lanonasis/memory-client

🏁 Quick Start

Basic Usage

import { createMemoryClient } from '@lanonasis/memory-client';

// Initialize the client
const memoryClient = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: 'your-api-key-here'
});

// Create a memory
const memory = await memoryClient.createMemory({
  title: 'Important Code Pattern',
  content: 'Use React.memo() for expensive components to prevent unnecessary re-renders',
  memory_type: 'knowledge',
  tags: ['react', 'performance', 'optimization']
});

// Search memories
const results = await memoryClient.searchMemories({
  query: 'React performance optimization',
  limit: 10
});

console.log('Found memories:', results.data?.results);

Production Setup

import { createProductionClient } from '@lanonasis/memory-client';

const client = createProductionClient(process.env.LANONASIS_API_KEY!);

// Test connection
const health = await client.healthCheck();
console.log('Service health:', health.data?.status);

Development Setup

import { createDevelopmentClient } from '@lanonasis/memory-client';

const client = createDevelopmentClient('dev-api-key');

🛠️ API Reference

Client Configuration

interface MemoryClientConfig {
  apiUrl: string;           // API endpoint URL
  apiKey?: string;          // API key for authentication
  authToken?: string;       // Bearer token (alternative to API key)
  timeout?: number;         // Request timeout in milliseconds (default: 30000)
  useGateway?: boolean;     // Enable gateway mode (default: true)
  headers?: Record<string, string>; // Custom headers
}

Memory Operations

Create Memory

const memory = await client.createMemory({
  title: 'Memory Title',
  content: 'Memory content goes here...',
  memory_type: 'context', // 'context' | 'project' | 'knowledge' | 'reference' | 'personal' | 'workflow'
  tags: ['tag1', 'tag2'],
  metadata: { source: 'api', version: '1.0' }
});

Search Memories

const results = await client.searchMemories({
  query: 'search terms',
  memory_types: ['knowledge', 'reference'],
  tags: ['important'],
  limit: 20,
  threshold: 0.7 // Similarity threshold (0-1)
});

List Memories

const memories = await client.listMemories({
  page: 1,
  limit: 50,
  memory_type: 'project',
  tags: ['work', 'important'],
  sort: 'updated_at',
  order: 'desc'
});

Update Memory

const updated = await client.updateMemory('memory-id', {
  title: 'Updated Title',
  tags: ['new-tag']
});

Delete Memory

await client.deleteMemory('memory-id');

Topic Operations

Create Topic

const topic = await client.createTopic({
  name: 'Project Alpha',
  description: 'Memories related to Project Alpha',
  color: '#3B82F6',
  icon: 'project'
});

Get Topics

const topics = await client.getTopics();

Statistics

const stats = await client.getMemoryStats();
console.log('Total memories:', stats.data?.total_memories);
console.log('By type:', stats.data?.memories_by_type);

🎯 Memory Types

  • context - General contextual information
  • project - Project-specific knowledge
  • knowledge - Educational or reference material
  • reference - Quick reference information
  • personal - User-specific private memories
  • workflow - Process and procedure documentation

🔐 Authentication

API Key (Recommended)

const client = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: 'your-api-key'
});

Bearer Token

const client = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  authToken: 'your-bearer-token'
});

Runtime Authentication Updates

// Update API key
client.setApiKey('new-api-key');

// Update auth token
client.setAuthToken('new-token');

// Clear authentication
client.clearAuth();

⚙️ Gateway Mode

Gateway mode provides enhanced performance through optimized routing and caching:

// Enable gateway mode (default)
const client = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: 'your-key',
  useGateway: true
});

// Direct API mode (for debugging)
const directClient = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: 'your-key',
  useGateway: false
});

⚛️ React Integration

Custom Hook

import { useMemoryClient } from '@lanonasis/memory-client';

function MyComponent() {
  const client = useMemoryClient({
    apiUrl: process.env.NEXT_PUBLIC_API_URL!,
    apiKey: process.env.NEXT_PUBLIC_API_KEY!
  });

  const [memories, setMemories] = useState([]);

  useEffect(() => {
    const loadMemories = async () => {
      const result = await client.listMemories({ limit: 10 });
      if (result.data) {
        setMemories(result.data.data);
      }
    };
    loadMemories();
  }, [client]);

  return <div>{/* Your component */}</div>;
}

🚨 Error Handling

All methods return a standardized response format:

interface ApiResponse<T> {
  data?: T;      // Success data
  error?: string; // Error message
  message?: string; // Additional info
}

// Example error handling
const result = await client.getMemory('invalid-id');
if (result.error) {
  console.error('Failed to get memory:', result.error);
} else {
  console.log('Memory:', result.data);
}

🔧 Configuration Examples

Environment-specific Configs

// Production
const prodClient = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: process.env.LANONASIS_API_KEY,
  timeout: 10000,
  useGateway: true
});

// Development
const devClient = createMemoryClient({
  apiUrl: 'http://localhost:3001',
  apiKey: 'dev-key',
  timeout: 30000,
  useGateway: false
});

// Custom headers
const customClient = createMemoryClient({
  apiUrl: 'https://api.lanonasis.com',
  apiKey: 'your-key',
  headers: {
    'X-Client-Version': '1.0.0',
    'X-Environment': 'production'
  }
});

📋 TypeScript Support

Full TypeScript support with comprehensive type definitions:

import type { 
  MemoryEntry, 
  CreateMemoryRequest,
  SearchMemoryRequest,
  MemoryType,
  ApiResponse 
} from '@lanonasis/memory-client';

// Strongly typed memory creation
const memory: CreateMemoryRequest = {
  title: 'TypeScript Tips',
  content: 'Use strict mode for better type safety',
  memory_type: 'knowledge' as MemoryType,
  tags: ['typescript', 'tips']
};

// Typed responses
const response: ApiResponse<MemoryEntry> = await client.createMemory(memory);

🌍 Browser Support

  • ✅ Chrome 88+
  • ✅ Firefox 85+
  • ✅ Safari 14+
  • ✅ Edge 88+
  • ✅ Node.js 16+

📚 Examples

Check out the examples directory for complete implementation examples:

📖 Documentation

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

📄 License

MIT © Lanonasis Team

🆘 Support


Made with ❤️ by the Lanonasis Team