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

md-vault

v0.0.1

Published

Tool for working with collections of markdown

Readme

md-vault

A tool for working with a directory of markdown files. Suitable for a blog or docs sites.

Problem

Most markdown tools work with a single file.

But blogs and docs sites have many files. They need functions that work across multiple files, like displaying a menu, performing a search, grouping by tags or pagination.

These functions take the most time to build.

md-vault solves this problem by providing an API for working with a collection of markdown files.

Benefits

  • Framework agnostic. Works with React, Vue, Svelte, Hono, Express, etc..
  • Works everywhere: SSR (server-side rendering), SSG (static-site generators), MPA (multi page apps) or SPA (single page apps).
  • Full pagination support.
  • Filter by tags, author, etc...
  • Supports front-matter and metadata.
  • Folder structure can be hierarchal (docs, book) or flat (blog posts).
  • Integrates with search engines like Algolia and MeiliSearch.
  • Search index can be updated during CI deployment.

Setup

pnpm install md-vault

Usage

Create folders to hold .md files:

mkdir docs
mkdir posts

Add a file with frontmatter docs/index.md

---
title: Example doc
author: Josh
date: 2024-11-01
---

Hi, this is my first doc

First, create shared instances of dir() in src/lib/server/docs.ts:

import { dir } from 'md-vault'

// load docs folder
export const docs = dir('./docs')

// load posts folder
export const blog = dir('./posts')

Then, use those shared instances to get docs or posts by path:

// src/routes/docs/[...path]/+page.server.ts
import { docs } from '$lib/server/docs.ts'
import { error } from '@sveltejs/kit'

export async function load({ params }) {
  const doc = docs.get(params.path)

  if (!doc) throw error(404)

  return { doc }
}

To display a menu, use docs.roots():

// src/routes/+layout.server.ts
import { docs } from '$lib/server/docs.ts'

export async function load() {
  return {
    menus: docs.roots()
  }
}

To display a list of blog posts with paging:

// src/routes/+page.server.ts
import { blog } from '$lib/server/docs.ts'

export async function load({ url }) {
  const page = url.searchParams.get('page')
  const posts = blog.search({ page })

  return { posts }
}

If using vite, the page can be reloaded using vite-plugin-full-reload in vite.config.ts:

import { sveltekit } from '@sveltejs/kit/vite'
import { defineConfig } from 'vite'
++import reload from 'vite-plugin-full-reload'

export default defineConfig({
  plugins: [
++  reload(['./docs/**/*.md', './posts/*.md']),
    sveltekit()
  ]
})

License

MIT