Tiny server hosting pi0.io (or anything else!)
Idea is simple, Turn any base url with raw Markdown, HTML and Assets into a website!
Website contents can be hosted anywhere, such as from https://raw.githubusercontent.com/pi0/pi0.io/refs/heads/main
(pi0/pi0.io).
When opening a URL like /about
, the server fetches {BASE_URL}/about.md
and renders Markdown to HTML using md4w.
The web server then uses {BASE_URL}/index.html
as an HTML template, replacing the {{ content }}
placeholder with the rendered markdown content.
Any other URL ending with an extension, will be directly fetched and served as static asset with proper mime type.
All remote content are cached with simple SWR strategy (stale 1 second).
Check the source code.
Local dir:
npx pipress .
Or remote URL:
npx pipress https://raw.githubusercontent.com/pi0/pi0.io/refs/heads/main
docker-compose.yaml:
services:
www:
image: ghcr.io/pi0/pipress
restart: unless-stopped
environment:
PIPRESS_URL: "https://raw.githubusercontent.com/pi0/pi0.io/refs/heads/main"
ports:
- 3140:3000
Tip
Use watchtower for auto updates.
PIPRESS_URL
PIPRESS_TTL
(default1000
)PIPRESS_STATIC_TTL
(default1000
)