docmint
v0.1.0
Published
Generate beautiful branded business PDFs from structured data.
Maintainers
Readme
What is Docmint?
Docmint is a modular document engine for generating beautiful, branded business PDFs from structured data.
Instead of manually building PDFs from scratch, Docmint gives you a clean TypeScript API for creating professional documents like:
- Offers and proposals
- Invoices
- Reports and audits
- Custom branded documents
- API-generated PDFs
- HTML previews before PDF export
Docmint is built around a simple idea:
Your data goes in. A polished branded PDF comes out.
Install
npm install docmintor
pnpm add docmintor
yarn add docmintQuick Start
import { createOfferPdf, oavaBrand } from "docmint";
await createOfferPdf({
output: "./offer.pdf",
brand: oavaBrand,
customer: {
name: "Herr Müller",
company: "Müller Dachtechnik GmbH",
email: "[email protected]"
},
document: {
title: "Neue digitale Präsenz",
number: "ANG-2026-001",
date: "2026-07-08",
validUntil: "2026-07-22"
},
offer: {
intro:
"Eine moderne Website, gebaut für Vertrauen, Sichtbarkeit und mehr Kundenanfragen.",
items: [
{
name: "Website Design & Entwicklung",
description:
"Moderne Unternehmenswebsite inklusive responsivem Design, Kontaktbereich und conversion-orientierter Struktur.",
quantity: 1,
price: 980,
type: "one_time"
},
{
name: "Hosting, Wartung & SEO Updates",
description:
"Hosting, SSL, Updates, Backups und grundlegende SEO Betreuung.",
quantity: 1,
price: 49,
type: "monthly"
}
],
notes: [
"50 Prozent Anzahlung, Restzahlung erst bei vollständiger Zufriedenheit.",
"Kostenlose und unverbindliche Demo Vorschau enthalten.",
"14 Tage Geld-zurück-Garantie bei Unzufriedenheit."
]
}
});Why Docmint?
Most PDF libraries give you low-level primitives.
Docmint gives you a real document system.
createOfferPdf()
createInvoicePdf()
createReportPdf()
createDocumentPdf()
createDocumentHtml()
defineTemplate()
defineBlock()
defineBrand()It is designed for developers who want beautiful PDFs without rebuilding layout, branding, tables, pricing summaries, and document structure every time.
Features
Core
- TypeScript-first API
- HTML to PDF rendering
- Branded document generation
- Reusable document blocks
- Custom templates
- Custom brands and themes
- HTML preview generation
- Offer, invoice, and report templates
- Server/API-ready architecture
- Clean output for business documents
Built-in Document Types
- Offers
- Invoices
- Reports
- Custom documents
Built-in Blocks
- Hero sections
- Pricing tables
- Line item tables
- Notes
- Key-value sections
- Summary cards
- Signature sections
- Footers
- Page breaks
- Spacers
Create an Invoice
import { createInvoicePdf, defaultBrand } from "docmint";
await createInvoicePdf({
output: "./invoice.pdf",
brand: defaultBrand,
customer: {
name: "Herr Müller",
company: "Müller Dachtechnik GmbH",
email: "[email protected]",
address: "Musterstraße 12, 12345 Berlin"
},
document: {
title: "Invoice",
number: "INV-2026-0042",
date: "2026-07-08",
dueDate: "2026-08-08"
},
invoice: {
items: [
{
name: "Strategic Website Consulting",
description: "Audit, concept and roadmap for the website relaunch.",
quantity: 12,
price: 150,
type: "one_time"
},
{
name: "Managed Hosting & Support",
description: "Premium hosting, backups and priority support.",
quantity: 1,
price: 99,
type: "monthly"
}
],
tax: {
rate: 0.19,
label: "VAT (19%)"
},
payment: {
recipient: "Docmint GmbH",
iban: "DE89 3704 0044 0532 0130 00",
bic: "COBADEFFXXX",
bank: "Commerzbank",
reference: "INV-2026-0042"
},
notes: ["Payment due within 30 days.", "Thank you for your business."]
}
});Create a Report
import { createReportPdf, defaultBrand } from "docmint";
await createReportPdf({
output: "./report.pdf",
brand: defaultBrand,
document: {
title: "Website Audit Report",
subtitle: "SEO & Performance Analysis",
number: "RPT-2026-014",
date: "2026-07-08"
},
report: {
sections: [
{
heading: "Executive Summary",
content:
"The website has a solid technical foundation, but several content and performance gaps limit organic reach."
},
{
heading: "Key Findings",
content: "Critical issues discovered during the audit:",
bullets: [
"Meta descriptions missing on high-traffic pages",
"Images are not served in next-gen formats",
"Core Web Vitals need improvement on mobile",
"No structured data for local business markup"
]
}
]
}
});HTML Preview
Generate HTML before exporting to PDF.
import { createOfferHtml } from "docmint";
const html = createOfferHtml({
brand: "default",
customer: {
name: "Herr Müller",
company: "Müller Dachtechnik GmbH"
},
document: {
title: "Neue digitale Präsenz",
number: "ANG-2026-001",
date: "2026-07-08"
},
offer: {
items: []
}
});
console.log(html);This is useful for:
- Debugging layouts
- Building preview screens
- Rendering previews inside dashboards
- Testing templates before exporting PDFs
Modular Document Engine
Docmint is not just a PDF generator.
It is built as a modular document engine.
import {
createDocumentPdf,
defineTemplate,
heroBlock,
pricingTableBlock,
notesBlock,
signatureBlock,
defaultBrand
} from "docmint";
const proposalTemplate = defineTemplate({
name: "custom-proposal",
render(ctx) {
return [
heroBlock({
eyebrow: "Proposal",
title: ctx.document.title,
subtitle: ctx.document.subtitle
}),
pricingTableBlock({
items: ctx.document.items
}),
notesBlock({
notes: ctx.document.notes
}),
signatureBlock({
label: "Accepted by"
})
];
}
});
await createDocumentPdf({
output: "./proposal.pdf",
brand: defaultBrand,
template: proposalTemplate,
document: {
title: "Custom Proposal",
subtitle: "Generated with Docmint",
items: [],
notes: []
}
});Custom Brands
import { defineBrand } from "docmint";
export const acmeBrand = defineBrand({
name: "Acme Solutions",
primary: "#4F46E5",
accent: "#06B6D4",
background: "#0F172A",
surface: "#111827",
surfaceLight: "rgba(255,255,255,0.06)",
text: "#F8FAFC",
muted: "#94A3B8",
border: "rgba(255,255,255,0.12)",
fontFamily: "Inter, Arial, sans-serif"
});Use it like this:
await createOfferPdf({
brand: acmeBrand,
output: "./offer.pdf",
customer,
document,
offer
});Custom Blocks
import { defineBlock, escapeHtml } from "docmint";
export const warningBlock = defineBlock({
name: "warning",
render({ title, message }) {
return `
<section class="dm-card dm-warning">
<h2>${escapeHtml(title)}</h2>
<p>${escapeHtml(message)}</p>
</section>
`;
}
});Blocks make it easy to build your own document system on top of Docmint.
API Server
Docmint can also be used as an API-ready PDF generation service.
npx docmint serveStart on a custom port:
npx docmint serve --port 3000With API key authentication:
npx docmint serve --api-key your-secret-keyGenerate a PDF over HTTP:
curl -X POST http://localhost:3000/v1/pdf/offer \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-secret-key" \
-d @examples/api-offer.json \
--output offer.pdfCLI
npx docmint serveExample output:
Docmint API server running on http://localhost:3000
Health: http://localhost:3000/health
Templates: http://localhost:3000/v1/templatesExample Output
Docmint can generate documents like:
- Premium offers
- Clean invoices
- Modern reports
- Branded custom documents
- API-generated PDFs
- HTML previews
The goal is simple:
Make generated business documents look designed, not exported.
Project Structure
src/
core/
create-document.ts
define-template.ts
define-block.ts
define-brand.ts
registry.ts
renderers/
html-to-pdf.ts
blocks/
hero.ts
table.ts
pricing-table.ts
notes.ts
footer.ts
signature.ts
templates/
offer.ts
invoice.ts
report.ts
base-layout.ts
brands/
default.ts
oava.ts
server/
create-server.ts
routes.ts
auth.ts
config.ts
utils/
money.ts
date.ts
escape-html.ts
totals.tsDevelopment
Clone the repository:
git clone https://github.com/OAVA-Studios/docmint.git
cd docmintInstall dependencies:
npm installRun typecheck:
npm run typecheckBuild:
npm run buildGenerate examples:
npm run examplesRun the API server:
npm run start:serverRoadmap
Docmint is currently focused on the core open-source document engine.
Planned future ideas:
- More templates
- More built-in blocks
- Better visual template presets
- PDF signing workflows
- Watermarks
- QR code blocks
- S3-compatible storage adapters
- Hosted document API
- Web UI template builder
- Pay-as-you-go hosted Docmint Cloud
Author
Built by Darko Mitru.
License
MIT
