Markdown rendered like GitHub. Exported like print.
An open-source Markdown workbench: live preview, page-perfect PDF export, Mermaid diagrams in the PDF, GitHub-accurate themes, and shareable view-only links. No size caps. No watermarks.
π Live demo: https://binderly.msantoki.com/
Cap.2026-04-27.at.17.17.31.mp4
- GitHub-accurate themes β light + dark variants powered by the official
github-markdown-cssPrimer stylesheet. Your rendered Markdown matchesgithub.com. - Mermaid diagrams in the PDF β sequence, flowchart, gantt, class, state. Rendered server-side via Puppeteer so they survive the trip into the export. Theme auto-pairs with the document theme.
- GitHub Flavored Markdown β alerts (
> [!NOTE],[!WARNING],[!CAUTION], etc.), footnotes, task lists, tables with column alignment. - Auto table of contents + heading anchors using
github-sluggerfor slug parity with GitHub itself. - Page-perfect PDFs β A4, page numbers in footer,
break-inside: avoidon code blocks, tables, alerts, and Mermaid SVGs so nothing splits awkwardly. Optional rounded-card or full-bleed mode. - Shareable view-only links β click Share, get a public URL like
/v/<uuid>. Backed by Postgres. Each click is an immutable snapshot. - Custom CSS injection for brand-matching, plus four curated typographic themes (GitHub Light/Dark, Editorial Serif, Modern Neutral, Midnight Focus).
- Privacy-first β self-hosted instances ship
noindexby default. Opt-in to indexing and analytics via env vars. - Self-hostable β Next.js + Puppeteer + Postgres. MIT-licensed.
- Node.js 22+
- pnpm 9.15.2+
- Postgres 14+ (only required for the share-link feature; the editor + PDF export work without it)
- Docker (optional, for the easiest Postgres setup)
git clone https://github.com/Manan-Santoki/Binderly
cd Binderly
pnpm installpnpm install downloads a Chromium binary for Puppeteer (~170 MB on first install).
docker run -d --name binderly-pg \
-p 5432:5432 \
-e POSTGRES_USER=binderly \
-e POSTGRES_PASSWORD=devpw \
-e POSTGRES_DB=binderly \
postgres:16-alpine
cat > .env.local <<'EOF'
DATABASE_URL=postgres://binderly:devpw@127.0.0.1:5432/binderly
DATABASE_SSL=false
EOF
pnpm db:migratepnpm dev # development (turbopack, hot reload)
# or
pnpm build && pnpm start # productionOpen http://localhost:3000.
All env vars are optional (except DATABASE_URL if you use sharing). See .env.example for the canonical list.
| Variable | Required for | Notes |
|---|---|---|
DATABASE_URL |
Share links | Postgres connection string |
DATABASE_SSL |
β | false (self-hosted), require (managed providers), default prefer |
NEXT_PUBLIC_SITE_URL |
SEO on hosted instance | Set to your canonical URL to enable indexing, sitemap, canonical tag, JSON-LD. Leave unset for private/internal deploys β the app ships noindex by default. |
NEXT_PUBLIC_ANALYTICS_SRC |
Analytics | Script URL for a privacy-friendly analytics provider (Plausible/Umami-style). Both vars must be set; otherwise zero tracking JS loads. |
NEXT_PUBLIC_ANALYTICS_SITE_ID |
Analytics | Site identifier passed via data-site-id |
NEXT_PUBLIC_* vars are inlined at build time. Changes require a rebuild, not just a restart.
ββββββββββββββββββββ βββββββββββββββββββ ββββββββββββββββ
β Workbench (UI) ββββββΆβ /api/pdf ββββββΆβ Puppeteer β
β react-markdown β β marked + β β β A4 PDF β
β remark-gfm β β marked-alert + β ββββββββββββββββ
β remark-alert β β mermaid UMD β
β rehype-slug β β injection β
ββββββββββββββββββββ βββββββββββββββββββ
β
β Share button
βΌ
ββββββββββββββββββββ βββββββββββββββββββ
β /api/share ββββββΆβ Postgres β
β (POST snapshot) β β shared_docs β
ββββββββββββββββββββ βββββββββββββββββββ
β
β /v/[id] (public read-only viewer)
βΌ
ββββββββββββββββββββ
β SharedDocViewer β
β (same renderer β
β as workbench) β
ββββββββββββββββββββ
Two markdown libraries are used deliberately:
react-markdownin the live preview β lots of plugins, runs in the browser, fast.markedin the PDF render path β server-friendly, easier to swap renderers, integrates cleanly with Puppeteer.
GFM alert plugins are paired across the two (remark-github-blockquote-alert for the preview, marked-alert for the PDF) so both emit the same markdown-alert markdown-alert-{variant} classes β one stylesheet covers both.
src/
βββ app/
β βββ api/pdf/route.ts # POST: render markdown -> PDF
β βββ api/share/route.ts # POST: persist snapshot, return UUID
β βββ v/[id]/page.tsx # public read-only viewer
β βββ layout.tsx # metadata + JSON-LD
β βββ page.tsx # home β workbench + SEO landing
β βββ robots.ts # gated on NEXT_PUBLIC_SITE_URL
β βββ sitemap.ts # gated on NEXT_PUBLIC_SITE_URL
βββ components/
β βββ pdf-workbench/ # editor, mermaid, code-block, toc
β βββ shared-doc-viewer.tsx # used by /v/[id]
β βββ seo-landing.tsx # SSR feature/FAQ block
β βββ ui/ # Radix-based primitives
βββ lib/
βββ pdf.ts # marked + Puppeteer pipeline
βββ themes.ts # theme registry + helpers
βββ db.ts # Postgres queries
βββ seo.ts # hosted-mode toggle + constants
βββ github-markdown-themes/ # bundled Primer CSS
βββ highlight-themes/ # bundled highlight.js CSS
migrations/0001_shared_documents.sql
scripts/migrate.ts
See src/lib/themes.ts. Existing themes are CSS-variable based and live in themeTokens. The Primer-based themes (github-light, github-dark) wrap the content in <div class="markdown-body">; the rest use <div class="md-theme">. Adding a new CSS-variable theme is a few lines β see CONTRIBUTING.md.
src/lib/pdf.ts is the server-side render path. Page break controls, the page-numbered footer template, and theme-aware CSS overrides all live there.
Standard Next.js hosting story β Node 22+, persistent Postgres, and a process supervisor of your choice. The PDF route uses Puppeteer's bundled Chromium and works in containers with --no-sandbox (already configured).
For SEO on your hosted instance, set NEXT_PUBLIC_SITE_URL=https://your-domain and rebuild. That switches the app into hosted mode (sitemap, canonical, indexable robots, JSON-LD with the right URL).
Open to suggestions. Things on my list:
- Editable share links (currently snapshots only)
- Math support (KaTeX/MathJax)
- Diagram alternatives β PlantUML, D2, Graphviz
- Theme builder UI
Open an issue if you want to discuss any of these or pitch your own.
PRs welcome β see CONTRIBUTING.md.
MIT Β© 2026 Manan Santoki