JavaScript · Static Site Generator · MIT

PeaPress — Markdown in, clean static HTML out

A deliberately small static site generator inspired by Grav, Astro and Eleventy — Nunjucks layouts, collections, pretty URLs, watch mode and a built-in dev server.

View on GitHub Download ZIP

Overview

PeaPress turns a folder of Markdown files with YAML frontmatter into a static website. Templates are Nunjucks with layout inheritance, collections group content (for example /blog/), and the output is plain HTML that any static host can serve — Netlify, Vercel, GitHub Pages, S3, Apache or nginx. No runtime, no database, no framework lock-in.

It is deliberately small: scan, parse, render, write. If you want a full application framework, reach for Astro or Next.js. If you want a blog, docs site or landing page with zero build complexity and total ownership of the output, PeaPress is the right size.

Use cases

  • Personal blogs and portfolios with pretty URLs and negligible build tooling.
  • Documentation sites rendered from Markdown with shared layout inheritance.
  • Marketing pages published to GitHub Pages, Netlify or S3.
  • Team knowledge bases kept in Git, deployed as static HTML.
  • Changelogs and release-note archives grouped by collection.
  • Prototypes that must not accrete framework dependencies.
  • Teaching static-site fundamentals: frontmatter, templates, collections.

How to work with it — a day in the life

You scaffold a post with peapress new my-post posts, write Markdown with frontmatter, and run node peapress.js dev. The watcher rebuilds on save; the dev server on :8080 refreshes your loop. Frontmatter picks the layout, collection: posts groups it with siblings, and listing pages iterate the collection with template: list. When it reads right, npm run build and push dist/ to your host. Edit, watch, verify, ship — all local and fast.

Features

  • Markdown content with YAML frontmatter (title, date, slug, tags).
  • Nunjucks templates with {% extends %} layout inheritance.
  • Collections grouped by frontmatter or directory; listing pages iterate them.
  • Pretty URLs: /blog/hello-world/ → dist/blog/hello-world/index.html.
  • Watch mode with dev server (peapress dev, port 8080).
  • Static assets copied from static/ or src/assets/.
  • Site-wide data from src/_data/ (JSON/YAML).
  • CLI: peapress build|dev [dir], peapress new <name> [collection].

Install

git clone https://github.com/PeaBox-Lab/PeaPress.git
cd PeaPress
npm install
node peapress.js build

Or use the npm scripts: npm run build and npm run dev. Output lands in dist/ (gitignored).

Quickstart — 30 seconds to a page

# 1. Scaffold a content file
peapress new my-first-post posts

# 2. Write Markdown with frontmatter
---
title: My first post
date: 2026-11-16
slug: /blog/my-first-post/
collection: posts
---
# Hello PeaPress

# 3. Watch and preview
node peapress.js dev

Open the dev server address shown in the console; edit and save to rebuild.

Configuration — templates, frontmatter, site data

Content lives anywhere under src/ (or content/, pages/, posts/). Frontmatter keys: slug/url/permalink control the output URL; collection groups content (defaults to the parent folder); layout or template selects a template (layout: post → templates/post.njk).

Templates live in templates/ and use Nunjucks. A page template extends base.njk: {% extends "base.njk" %}{% block content %}{{ content | safe }}{% endblock %}. Listing pages use template: list and iterate a collection.

Site data: JSON/YAML files in src/_data/ — site.json feeds global values like site.title; any other file groups by name (_data/blog.json → blog). Project layout: peapress.js (CLI), lib/ (builder, parser, renderer, config, dev-server), templates/, src/, static/, dist/.

Troubleshooting

  • Blank or missing page: check the frontmatter slug and that the file sits under a scanned content root.
  • Template not found: layout: post requires templates/post.njk; verify the filename and Nunjucks syntax.
  • Collection empty: set collection: explicitly or confirm the parent folder name matches the listing page's target.
  • Assets 404: static files must live in static/ or src/assets/; they are copied verbatim into dist/.
  • Dev server port busy: stop the old process or pass a different directory/port per peapress dev --help.
  • Stale output: re-run npm run build; dist/ is regenerated on every build.
← All repositoriesDeveloper Tools →