🚀 Big News:Socket Has Acquired Secure Annex.Learn More
Socket
Book a DemoSign in
Socket

@stacksjs/bunpress

Package Overview
Dependencies
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stacksjs/bunpress

Modern documentation engine. Powered by Bun.

latest
Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
55K
-17.47%
Maintainers
2
Weekly downloads
 
Created
Source

Social Card of this repo

npm version GitHub Actions Commitizen friendly

BunPress

Fast, modern documentation engine powered by Bun, inspired by VitePress

BunPress is a lightning-fast static site generator designed specifically for documentation. Built on top of Bun's blazing performance with a developer-friendly API inspired by VitePress.

Features

Core Features

  • Lightning Fast - 0.18s build time (4,000 files), 11x faster than Eleventy
  • 📝 Rich Markdown - VitePress-compatible markdown with containers, alerts, code groups, and syntax highlighting
  • 📋 Smart TOC - Automatic table of contents with filtering, positioning (sidebar/inline/floating), and interactive navigation
  • 🛠️ Developer Friendly - Native TypeScript support, comprehensive CLI (15+ commands), and extensive customization

SEO & Analytics

  • 🔍 Complete SEO - Auto-generated sitemap.xml, robots.txt, Open Graph tags, and JSON-LD structured data
  • 📊 Fathom Analytics - Privacy-focused analytics with GDPR/CCPA compliance and DNT support
  • 🔎 SEO Validation - Built-in SEO checker with auto-fix mode for common issues

Markdown Extensions (VitePress-Compatible)

  • ✅ Custom containers (info, tip, warning, danger, details, raw)
  • ✅ GitHub-flavored alerts (note, tip, important, warning, caution)
  • ✅ Code features (line highlighting, line numbers, focus, diffs, errors/warnings, groups)
  • ✅ Code imports from files with line ranges and regions
  • ✅ Tables with alignment and formatting
  • ✅ Image enhancements with captions and lazy loading
  • ✅ Custom header anchors and inline TOC
  • STX template syntax in markdown — dynamic content with @if, @foreach, {{ }}, <script server>

Developer Experience

  • 🚀 Fast Dev Server - ~100ms startup, hot reload, and instant feedback
  • 📦 Small Bundles - ~45KB per page (HTML + JS + CSS)
  • 💚 Low Memory - ~50MB dev server, ~250MB peak for 1000 files
  • 🎯 15+ CLI Commands - Build, dev, preview, stats, doctor, SEO check, and more

Quick Start

Get started with BunPress in seconds:

# Install BunPress
bun add @stacksjs/bunpress

# Create a new documentation site
mkdir my-docs
cd my-docs

# Initialize with basic structure
bunx @stacksjs/bunpress init

# Start development server
bun run dev

# Build for production
bun run build

Basic Usage

Create your first documentation page:

---
title: Welcome
layout: home
---

# Welcome to My Project

This is my awesome project documentation built with BunPress!

## Quick Links

- [Getting Started](/guide/getting-started)
- [API Reference](/api)
- [Examples](/examples)

Configure your site in bunpress.config.ts:

export default {
  title: 'My Documentation',
  description: 'Built with BunPress',
  nav: [
    { text: 'Home', link: '/' },
    { text: 'Guide', link: '/guide' },
    { text: 'API', link: '/api' }
  ],

  // SEO Configuration
  sitemap: {
    enabled: true,
    baseUrl: 'https://mysite.com',
  },
  robots: {
    enabled: true,
  },

  // Analytics
  fathom: {
    enabled: true,
    siteId: 'YOUR_SITE_ID',
    honorDNT: true,
  },
}

STX Templates in Markdown

BunPress supports STX template syntax directly inside markdown files. This enables dynamic content generation — conditionals, loops, computed values, and more — powered by the STX templating engine.

Server Scripts

Define variables and logic in <script server> blocks:

<script server>
const features = [
  { name: 'Fast', desc: 'Built with Zig for maximum performance' },
  { name: 'Modern', desc: 'ES modules and TypeScript native' },
  { name: 'Simple', desc: 'Zero config, one binary' },
]
const showBeta = false
</script>

# Features

@foreach (features as feature)
### {{ feature.name }}

{{ feature.desc }}

@endforeach

@if (showBeta)
## Beta Features

These features are coming soon.
@endif

Available Directives

DirectiveDescription
<script server>Define variables and run server-side logic
{{ expression }}Output an escaped expression
{!! expression !!}Output raw (unescaped) HTML
@if (condition) / @else / @endifConditional rendering
@foreach (array as item) / @endforeachIterate over arrays
@foreach (array as item, index)Iterate with index
@for (let i = 0; i < n; i++) / @endforC-style for loops
@include('Component')Include STX components

Frontmatter Access

Frontmatter values are automatically available in STX expressions:

---
title: My Page
author: Chris
---

# {{ title }}

Written by {{ author }}.

Inline Expressions

Use expressions anywhere in your markdown:

<script server>
const count = 42
const items = ['Alpha', 'Beta', 'Gamma']
</script>

There are {{ count }} items and {{ items.length }} categories.
The sum is {{ 10 + 20 + 12 }}.

STX processing happens before markdown conversion, so the output of STX directives is treated as regular markdown and rendered accordingly — headings, lists, bold, code blocks, and all other markdown features work as expected.

CLI Commands

BunPress provides a comprehensive CLI for managing your documentation:

# Development
bunpress dev              # Start dev server with hot reload
bunpress build            # Build for production
bunpress preview          # Preview production build

# Content Management
bunpress new <path>       # Create new markdown file
bunpress init             # Initialize new project

# Maintenance
bunpress clean            # Remove build artifacts
bunpress stats            # Show documentation statistics
bunpress doctor           # Run diagnostic checks

# SEO
bunpress seo:check        # Check SEO for all pages
bunpress seo:check --fix  # Auto-fix SEO issues

# Configuration
bunpress config:show      # Show current configuration
bunpress config:validate  # Validate configuration

Performance Benchmarks

BunPress is the fastest documentation generator available, powered by Bun's built-in Zig-based markdown parser.

Markdown Engine Benchmarks

Real benchmark results comparing BunPress against documentation frameworks and popular markdown engines. All engines configured with equivalent GFM features (tables, strikethrough, task lists, autolinks). Tested on Apple M3 Pro, 18GB RAM, Bun 1.3.10.

Fairness note: These results are conservative. Real VitePress adds Shiki syntax highlighting + Vue plugins on top of markdown-it. Real Astro adds Shiki on top of remark/rehype. commonmark.js does not support GFM, so it processes fewer features and appears artificially fast.

Simple Markdown (paragraph + inline formatting)

EngineAvg Timevs BunPress
BunPress2.09 µs-
commonmark (no GFM)3.91 µs1.9x slower
Eleventy4.93 µs2.4x slower
VitePress7.87 µs3.8x slower
marked29.67 µs14x slower
showdown32.48 µs16x slower
micromark120.10 µs57x slower
Astro126.36 µs60x slower

Real-World Doc Page (~3KB markdown)

EngineAvg Timevs BunPress
BunPress28.60 µs-
commonmark (no GFM)101.47 µs3.5x slower
Eleventy124.67 µs4.4x slower
VitePress178.68 µs6.2x slower
showdown791.29 µs28x slower
marked841.17 µs29x slower
micromark2.03 ms71x slower
Astro2.56 ms90x slower

Large Document Stress Test (~33KB markdown)

EngineAvg Timevs BunPress
BunPress204.97 µs-
commonmark (no GFM)1.01 ms4.9x slower
Eleventy1.07 ms5.2x slower
VitePress1.40 ms6.8x slower
showdown12.76 ms62x slower
micromark21.61 ms105x slower
Astro26.56 ms130x slower
marked47.41 ms231x slower

Throughput: 100 Mixed Documents

EngineAvg Timevs BunPress
BunPress827.40 µs-
commonmark (no GFM)3.45 ms4.2x slower
Eleventy3.80 ms4.6x slower
VitePress4.85 ms5.9x slower
marked17.43 ms21x slower
showdown25.29 ms31x slower
micromark72.79 ms88x slower
Astro84.95 ms103x slower

Build Performance (4,000 markdown files)

Using the same methodology as 11ty's official performance tests:

GeneratorBuild Timevs BunPress
BunPress0.18s-
Eleventy1.93s11x slower
VitePress8.50s47x slower
Astro22.90s130x slower
Gatsby29.05s165x slower
Next.js70.65s401x slower
GeneratorBuild Timevs BunPress
BunPress4.12s-
VitePress8.50s2x slower
Astro22.90s5.6x slower
Gatsby29.05s7x slower
Next.js70.65s17x slower

Run the benchmarks yourself:

cd benchmark && bun install && bun run bench

Testing

bun test              # Run all tests
bun test:quick        # Quick test run (10s timeout)
bun run typecheck     # Type checking
bun run lint          # Lint code

Changelog

Please see our releases page for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discussions on GitHub

For casual chit-chat with others using this package:

Join the Stacks Discord Server

Postcardware

“Software that is free, but hopes for a postcard.” We love receiving postcards from around the world showing where Stacks is being used! We showcase them on our website too.

Our address: Stacks.js, 12665 Village Ln #2306, Playa Vista, CA 90094, United States 🌎

Sponsors

We would like to extend our thanks to the following sponsors for funding Stacks development. If you are interested in becoming a sponsor, please reach out to us.

License

The MIT License (MIT). Please see LICENSE for more information.

Made with 💙

Keywords

bunpress

FAQs

Package last updated on 19 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts