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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@leon4s4/memorizer-server

v2.0.0

Published

Airgapped AI memory service with embedded models - semantic search, versioning, MCP integration

Downloads

78

Readme

@memorizer/server

Backend server for Memorizer - Airgapped AI memory service.

Features

  • LanceDB Storage: Embedded vector database for memories
  • REST API: Full CRUD operations for memories
  • Semantic Search: Vector similarity search (embeddings in Phase 2)
  • Versioning: Automatic version snapshots on updates
  • Relationships: Knowledge graph connections between memories
  • MCP Server: Model Context Protocol integration (Phase 5)

Quick Start

Development

# Install dependencies
npm install

# Run in development mode
npm run dev

# Server will start at http://localhost:5000

Production

# Build
npm run build

# Start
npm start

# Or run directly
node dist/cli.js start

API Endpoints

Health Check

  • GET /healthz - Health check

Statistics

  • GET /api/stats - Get database statistics

Memories

  • GET /api/memories - List memories
    • Query params: limit, offset, types, tags
  • POST /api/memories - Create memory
  • GET /api/memories/:id - Get memory by ID
  • PUT /api/memories/:id - Update memory
  • DELETE /api/memories/:id - Delete memory

Search

  • POST /api/search - Semantic search
    • Body: { query, limit?, threshold?, types?, tags?, includeContent? }

Relationships

  • GET /api/memories/:id/relationships - Get relationships
    • Query params: direction (outgoing, incoming, both)
  • POST /api/relationships - Create relationship
    • Body: { from_memory_id, to_memory_id, type, score? }

CLI Commands

# Start server
memorizer start [options]

Options:
  -p, --port <port>        Port to listen on (default: 5000)
  -d, --data <path>        Data directory path
  -m, --models <path>      Models directory path
  --no-ui                  Disable web UI
  --log-level <level>      Log level (debug, info, warn, error)

# Export data (Phase 3)
memorizer export -o memories.json

# Import data (Phase 3)
memorizer import -i memories.json

# Backup (Phase 3)
memorizer backup -o backup.zip

# Admin commands (Phase 4)
memorizer admin title-gen
memorizer admin rebuild-index
memorizer admin purge-versions --keep 50

Configuration

Environment variables:

MEMORIZER_PORT=5000
MEMORIZER_DATA_PATH=~/.memorizer/data
MEMORIZER_MODEL_PATH=~/.memorizer/models
MEMORIZER_CACHE_PATH=~/.memorizer/cache
MEMORIZER_ENABLE_UI=true
MEMORIZER_CORS_ORIGINS=http://localhost:5173
MEMORIZER_LOG_LEVEL=info

Directory Structure

~/.memorizer/
├── data/           # LanceDB database files
├── models/         # AI models (Phase 2)
└── cache/          # Temporary files

Testing

Manual API Testing

# Create a memory
curl -X POST http://localhost:5000/api/memories \
  -H "Content-Type: application/json" \
  -d '{
    "type": "note",
    "content": {"text": "Hello World"},
    "text": "Hello World",
    "source": "test",
    "tags": ["test"]
  }'

# List memories
curl http://localhost:5000/api/memories

# Search (returns all for now, embeddings in Phase 2)
curl -X POST http://localhost:5000/api/search \
  -H "Content-Type: application/json" \
  -d '{"query": "hello", "limit": 10}'

# Get stats
curl http://localhost:5000/api/stats

Architecture

Dependency Injection

Uses TSyringe for dependency injection:

import { container } from 'tsyringe';
import { StorageService } from './services/storage.js';

const storage = container.resolve(StorageService);

Storage Service

The StorageService is a singleton that handles all database operations:

  • Memory CRUD
  • Vector search
  • Versioning
  • Relationships
  • Events

Logging

Uses Pino for structured logging with pretty printing in development.

Development

Project Structure

src/
├── api/
│   └── routes.ts           # REST API routes
├── services/
│   └── storage.ts          # LanceDB storage service
├── utils/
│   ├── config.ts           # Configuration management
│   └── logger.ts           # Logging setup
├── server.ts               # Fastify server setup
└── cli.ts                  # CLI entry point

Adding New Routes

// In src/api/routes.ts
export async function registerRoutes(fastify: FastifyInstance) {
  const storage = container.resolve(StorageService);

  fastify.get('/api/my-route', async (request, reply) => {
    // Your handler
  });
}

License

MIT