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

@ilb/classifiercomponent

v2.0.5

Published

Document classification and management component for Next.js applications.

Downloads

17

Readme

Classifier Component

Document classification and management component for Next.js applications.

Features

  • Document upload and classification
  • Drag-and-drop interface for managing documents
  • PDF handling and image processing
  • Automatic document type detection
  • React components for document classification UI
  • REST API for document management

Installation

npm install @ilb/classifiercomponent
# or
yarn add @ilb/classifiercomponent

Requirements

  • Node.js 14+
  • Poppler (for PDF processing)
  • ImageMagick (for image conversion)

Configuration

Configure the component by setting the following environment variables:

DOSSIER_DOCUMENT_PATH=/path/to/documents
BASE_URL=http://localhost:3010
POPPLER_BIN_PATH=/usr/bin

Usage

Client-side Component

import { Classifier } from '@ilb/classifiercomponent/src/client';

// Example schema
const schema = {
  classifier: {
    readonly: false,
    disabled: false
  },
  tabs: [
    {
      type: 'PASSPORT',
      name: 'Паспорт',
      readonly: false,
      accept: 'image/*,application/pdf'
    },
    {
      type: 'SNILS',
      name: 'СНИЛС',
      readonly: false,
      accept: 'image/*,application/pdf'
    }
  ],
  blocks: []
};

export default function MyApp() {
  return (
    <Classifier
      uuid="document-uuid"
      schema={schema}
      onInit={docs => console.log('Documents initialized', docs)}
      onUpdate={(tab, docs) => console.log('Documents updated', tab, docs)}
      onRemove={(tab, docs) => console.log('Document removed', tab, docs)}
      onChange={docs => console.log('Documents changed', docs)}
    />
  );
}

Server-side API

// pages/api/classifications/[...classifier].js
import { ClassifierApi } from '@ilb/classifiercomponent/src/server.mjs';
import { createScope } from '../../../libs/usecases/index.mjs';
import { onError, onNoMatch } from '../../../libs/middlewares/index.mjs';

export const config = {
  api: {
    bodyParser: false
  }
};

export default ClassifierApi(createScope, onError, onNoMatch);

The DI container must have the following dependencies:

  • dossierBuilder - Instance of the DossierBuilder class
  • fileService - File handling service
  • For classification: verificationService, verificationRepository, classifierQuantity

Example

git clone https://github.com/ilb/classifiercomponent.git
npm i
cp .env.example .env
npm run dev

Navigate to http://127.0.0.1:3010

Project Structure

src/
  classifier/
    client/         # Client-side components
      components/   # React components
      hooks/        # Custom hooks
      utils/        # Client utilities
      context/      # React context providers
    schema/         # Schema validation
    server/         # Server-side code
      core/         # Core business logic
      gates/        # API gateways
      usecases/     # Business use cases
  config/           # Configuration management
  di/               # Dependency injection
  http/             # HTTP utilities and handlers
  repository/       # Data access layer
  services/         # Business services
  util/             # Utility functions

Development

# Install dependencies
npm install

# Start development server
npm run dev

# Run tests
npm test

# Build for production
npm run build

The application will be available at http://localhost:3010

API Reference

Server API Endpoints

  • GET /api/classifications/:uuid - Get document classification tasks
  • PUT /api/classifications/:uuid - Classify documents
  • GET /api/classifications/:uuid/documents - Get all documents
  • POST /api/classifications/:uuid/documents/correction - Correct document classification
  • GET /api/classifications/:uuid/documents/:name - Get document by name
  • PUT /api/classifications/:uuid/documents/:name - Add pages to document
  • GET /api/classifications/:uuid/documents/:name/:number - Get specific page
  • DELETE /api/classifications/:uuid/documents/:name/:pageUuid - Delete page

License

ISC