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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@imigueldiaz/mongodb-labeler

v0.2.0

Published

A MongoDB-based labeling system for content moderation with cryptographic signing

Downloads

307

Readme

MongoDB Labeler

npm version License: MIT PNPM Jest TypeScript AT Protocol MongoDB codecov

A versatile data management and labeling tool that helps you organize, tag, and manage your MongoDB collections efficiently. Originally inspired by ATProtocol's labeling system, it can be used both for general MongoDB data labeling and ATProtocol content moderation.

Acknowledgments

This project is a fork of @skyware/labeler, which was originally designed for Bluesky/ATProto labeling. We've adapted and expanded it to work with MongoDB databases while maintaining compatibility with ATProtocol labeling workflows.

Features

  • Efficient data labeling interface
  • MongoDB integration
  • Support for custom label schemas
  • ATProtocol compatibility
  • Content moderation support
  • Batch labeling operations
  • Export and import functionality
  • TypeScript support

Installation

npm install @imigueldiaz/mongodb-labeler
# or using pnpm
pnpm install @imigueldiaz/mongodb-labeler

Usage

import { MongoDBLabeler } from "@imigueldiaz/mongodb-labeler";

// Initialize the labeler
const labeler = new MongoDBLabeler({
  uri: "your-mongodb-uri",
  database: "your-database",
  collection: "your-collection",
});

// Start labeling session
await labeler.start();

Configuration

The labeler can be configured with the following options:

{
    /** The DID of the labeler account */
    did: string;

    /** The private signing key used for the labeler */
    signingKey: string;

    /** MongoDB connection URI */
    mongoUri: string;

    /** The name of the MongoDB database to use (defaults to 'labeler') */
    databaseName?: string;

    /** The name of the MongoDB collection to use */
    collectionName?: string;

    /** Custom authorization function for label creation */
    auth?: (did: string) => boolean | Promise<boolean>;

    /** Host to bind the server to */
    host?: string;

    /** Port to run the server on (defaults to 4100) */
    port?: number;
}

For basic MongoDB usage:

import { MongoDBLabeler } from "@imigueldiaz/mongodb-labeler";

const labeler = new MongoDBLabeler({
  mongoUri: "mongodb://localhost:27017",
  databaseName: "my_database",
  collectionName: "my_labels",
});

For ATProtocol usage:

import { LabelerServer } from "@imigueldiaz/mongodb-labeler";

const server = new LabelerServer({
  did: "your-did",
  signingKey: "your-signing-key",
  mongoUri: "mongodb://localhost:27017",
  databaseName: "atproto_labels",
});

server.start((error, address) => {
  if (error) {
    console.error(error);
  } else {
    console.log(`Labeler server listening on ${address}`);
  }
});

Development

To set up the development environment:

# Clone the repository
git clone https://github.com/imigueldiaz/mongodb-labeler.git

# Install dependencies
pnpm install

# Run tests
pnpm test

# Build the project
pnpm build

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

  • Ignacio de Miguel Díaz

Special Thanks

Special thanks to the @skyware/labeler team for their excellent work on the original project that served as the foundation for this tool.