No description
|
All checks were successful
Build & Deploy to Staging / Build & Deploy to Staging (push) Successful in 12m37s
Added comprehensive tests for previously untested areas: 1. Demo Endpoints (no auth): - POST /v1/demo/html - converts HTML to watermarked PDF - POST /v1/demo/markdown - converts markdown to PDF - Rate limiting (5 requests/hour) validation 2. URL to PDF Conversion: - Valid URL conversion - Missing url field validation - SSRF protection (blocks private IPs like 127.0.0.1, localhost) - Invalid protocol rejection (ftp://) - Invalid URL format handling 3. PDF Options: - A3 format conversion - Landscape orientation - Custom margins 4. Error Handling: - Invalid JSON body - Wrong Content-Type header (415 expected) - Empty HTML string handling 5. Health Endpoint Details: - Verify database field presence - Verify pool stats (size, active, available) - Verify version field Total tests: 27 (3 passed locally, 24 require Docker/Chrome/DB) Tests that need Docker to pass: All PDF generation and DB-dependent tests Note: Local failures are expected without PostgreSQL and Chromium. CI will run these in Docker with all dependencies. |
||
|---|---|---|
| .forgejo/workflows | ||
| deploy | ||
| dist | ||
| infrastructure | ||
| public | ||
| scripts | ||
| sdk | ||
| src | ||
| templates/partials | ||
| @ | ||
| .gitignore | ||
| BACKUP_PROCEDURES.md | ||
| bugs.md | ||
| CI-CD-SETUP-COMPLETE.md | ||
| decisions.md | ||
| DEPLOYMENT.md | ||
| docker-compose.yml | ||
| Dockerfile | ||
| Dockerfile.backup | ||
| logrotate-docfast | ||
| nginx-docfast.conf | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| sessions.md | ||
| state.json | ||
| tsconfig.json | ||
| VERSION | ||
DocFast API
Fast, simple HTML/Markdown to PDF API with built-in invoice templates.
Quick Start
npm install
npm run build
API_KEYS=your-key-here npm start
Endpoints
Convert HTML to PDF
curl -X POST http://localhost:3100/v1/convert/html \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Hello</h1><p>World</p>"}' \
-o output.pdf
Convert Markdown to PDF
curl -X POST http://localhost:3100/v1/convert/markdown \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"markdown": "# Hello\n\nWorld"}' \
-o output.pdf
Invoice Template
curl -X POST http://localhost:3100/v1/templates/invoice/render \
-H "Authorization: Bearer YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"invoiceNumber": "INV-001",
"date": "2026-02-14",
"from": {"name": "Your Company", "email": "you@example.com"},
"to": {"name": "Client", "email": "client@example.com"},
"items": [{"description": "Service", "quantity": 1, "unitPrice": 100, "taxRate": 20}]
}' \
-o invoice.pdf
Options
format: Paper size (A4, Letter, Legal, etc.)landscape: true/falsemargin:{top, right, bottom, left}in CSS unitscss: Custom CSS (for markdown/html fragments)filename: Suggested filename in Content-Disposition header
Auth
Pass API key via Authorization: Bearer <key>. Set API_KEYS env var (comma-separated for multiple keys).
Docker
docker build -t docfast .
docker run -p 3100:3100 -e API_KEYS=your-key docfast