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

@solovey1985/knowledge-base-framework

v1.0.8

Published

A flexible framework for building markdown-based knowledge base and documentation portals with support for Mermaid diagrams, LaTeX math, and syntax highlighting

Readme

Knowledge Base Framework

A flexible, Node.js-based framework for building markdown-based knowledge bases and documentation portals with support for Mermaid diagrams, LaTeX math, and syntax highlighting.

Features

  • 📝 Markdown Support - Full CommonMark and GitHub Flavored Markdown
  • 🔗 Auto Navigation - Automatically generated navigation from folder structure
  • 📊 Mermaid Diagrams - Built-in support for Mermaid diagram rendering
  • 🧮 LaTeX Math - Mathematical notation with MathJax
  • 🎨 Syntax Highlighting - Code blocks with highlight.js
  • 📱 Responsive Design - Mobile-friendly interface
  • 🔍 Table of Contents - Automatic TOC generation from headings
  • Fast Builds - Optimized static site generation
  • 🔌 Plugin System - Extend rendering and directory behavior with plugins
  • 🛠️ TypeScript - Full TypeScript support with type definitions

Quick Start

Using the CLI (Recommended)

# Install globally
npm install -g @solovey1985/knowledge-base-framework

# Create a new project
kb init my-docs

# Navigate and install
cd my-docs
npm install

# Start development server
npm start

# Build static site
npm run build

Manual Setup

npm install @solovey1985/knowledge-base-framework express

Create a server.js:

const express = require('express');
const { KnowledgeBase } = require('@solovey1985/knowledge-base-framework');

const app = express();
const kb = new KnowledgeBase({
  contentRootPath: './content',
  title: 'My Knowledge Base',
  description: 'A comprehensive knowledge base'
});

kb.setupMiddleware(app);

app.listen(3000, () => {
  console.log('Knowledge Base running at http://localhost:3000');
});

Upgrading Existing Projects

After bumping @solovey1985/knowledge-base-framework in a project, run:

kb update

to refresh server.js, build.js, .github/workflows/deploy.yml, README, and package.json scripts.

Configuration

Create a kb.config.json file:

{
  "title": "My Knowledge Base",
  "description": "A comprehensive documentation portal",
  "contentRootPath": "./content",
  "baseUrl": "",
  "enableMath": true,
  "enableMermaid": true,
  "enableSyntaxHighlighting": true,
  "navigation": {
    "maxDepth": 3,
    "excludePatterns": ["README.md", ".*"]
  },
  "server": {
    "port": 3000
  },
  "build": {
    "outputDir": "./docs",
    "target": "github"
  }
}

API Reference

KnowledgeBase Class

import { KnowledgeBase, KnowledgeBaseOptions } from '@solovey1985/knowledge-base-framework';

const kb = new KnowledgeBase(options);

Plugins

You can extend the framework with plugins via KnowledgeBaseOptions.plugins.

For scaffolded projects (kb init), plugin configuration lives in a separate kb.plugins.json file and is loaded automatically by server.js, kb serve, and kb build.

import express from 'express';
import { KnowledgeBase, threeDViewerPlugin } from '@solovey1985/knowledge-base-framework';

const app = express();

const kb = new KnowledgeBase({
  contentRootPath: './content',
  title: 'Engineering KB',
  plugins: [
    threeDViewerPlugin({
      extensions: ['.stl', '.obj']
    })
  ]
});

kb.setupMiddleware(app);

Built-in plugin: threeDViewerPlugin

  • Renders .stl and .obj files as interactive 3D previews.
  • Adds a dedicated 3D Models section in directory listings.
  • Keeps original model files downloadable via Open original link.

Built-in plugin: interviewPrepPlugin

  • Activates on *.interview.md pages.
  • Supports hidden-answer questions, multiple-choice questions, and code-completion exercises.
  • Persists interview progress locally in the browser.

Example interview content file:

---
title: TypeScript Interview Practice
interview:
  persistProgress: true
---

# TypeScript Interview Practice

```interview-question
What is the difference between `interface` and `type` in TypeScript?
---
answer:
Interfaces support declaration merging. Types are more general and can model unions and primitives.
hints:
- One supports declaration merging.
- One is often used with unions.
```

```interview-choice
Which statement about closures is correct?
---
options:
- A closure only exists in async functions.
- A closure keeps access to variables from its lexical scope.
- A closure copies outer values when the function is created.
correct: 1
explanation:
Closures keep access to the lexical environment in which they were created.
```

```interview-code
language: ts
prompt: Complete the function so it returns only even values.
starter:
function onlyEven(values: number[]): number[] {
  return values.
}
solution:
function onlyEven(values: number[]): number[] {
  return values.filter(value => value % 2 === 0);
}
checks:
- includes: filter
- includes: % 2 === 0
```

Example kb.plugins.json:

{
  "plugins": [
    {
      "name": "threeDViewer",
      "enabled": true,
      "options": {
        "extensions": [".stl", ".obj"],
        "sectionTitle": "3D Models"
      }
    },
    {
      "name": "interviewPrep",
      "enabled": true,
      "options": {
        "sectionTitle": "Interview Prep"
      }
    }
  ]
}

Static Site Builder

import { StaticSiteBuilder } from '@solovey1985/knowledge-base-framework';

const builder = new StaticSiteBuilder(options);
await builder.build();

Services

The framework provides several services that can be used independently:

  • FileService - File system operations
  • NavigationService - Navigation menu generation
  • MarkdownRenderer - Markdown to HTML conversion
  • GitService - Git repository information

Content Structure

content/
├── index.md              # Home page
├── guides/               # Guides section
│   ├── index.md
│   ├── getting-started.md
│   └── advanced.md
├── reference/            # Reference section
│   ├── index.md
│   └── api.md
└── assets/              # Static assets
    ├── images/
    └── files/

Markdown Features

Standard Markdown

All CommonMark and GitHub Flavored Markdown features are supported.

Math (LaTeX)

Inline math: $E = mc^2$

Block math:
$$
\frac{d}{dx}\int_a^x f(t)dt = f(x)
$$

Mermaid Diagrams

\`\`\`mermaid
graph TD
    A[Start] --> B[Process]
    B --> C[End]
\`\`\`

Code Highlighting

\`\`\`typescript
interface User {
  name: string;
  email: string;
}
\`\`\`

Deployment

GitHub Pages

Set build.target to "github" in your config and run:

npm run build

Then commit and push the docs/ directory.

Scaffolded projects also include .github/workflows/deploy.yml, which mirrors the second-brain deployment: every push to main runs npm ci, executes npm run build:github, and publishes docs/ to the gh-pages branch via peaceiris/actions-gh-pages. Enable it by choosing Settings → Pages → Deploy from branch → gh-pages (/).

Netlify/Vercel

Set build.target to "local" and deploy the docs/ directory.

CLI Commands

  • kb init [name] - Create new project
  • kb update - Refresh server/build/workflow templates after upgrading the framework
  • kb serve - Start development server
  • kb build - Build static site
  • kb help - Show help

License

MIT

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request