2b43eb2270b9816ff21f4193f241acc724598ec5
Scrollsmith
Scrollsmith is a Node.js tool for generating Dungeons & Dragons one-page dungeon PDFs automatically. It calls an LLM (Open WebUI /api/chat/completions or Ollama /api/generate, inferred from OLLAMA_API_URL), proofreads and refines the result, then builds a structured PDF with maps, rooms, encounters, treasure, and NPCs.
Features
- Three-pass dungeon generation:
- Draft: initial dungeon ideas
- Refine: proofread, add flavor, fill in vague details
- JSON conversion: output strictly valid JSON for PDF generation
- Automatically generates a PDF named after the dungeon title
- PDF layout includes three columns: map & hooks, rooms, encounters & treasure & NPCs
- Open WebUI or Ollama
Requirements
- Node.js 22+
- LLM endpoint (see below)
- Gitea Releases (optional) for PDF uploads
.envfile with:
OLLAMA_API_URL=https://your-openwebui-host/api/chat/completions
OLLAMA_API_KEY=your_api_key_here
OLLAMA_MODEL=qwen3.5-122b-a10b
COMFYUI_URL=http://192.168.1.124:8188
Installation
git clone https://github.com/yourusername/scrollsmith.git
cd scrollsmith
npm install
API Configuration
The client automatically infers the API type from the endpoint URL, making it flexible for different deployment scenarios.
Direct Ollama API
For direct Ollama API calls, set:
OLLAMA_API_URL=http://localhost:11434/api/generate
Open WebUI API
For Open WebUI API calls, set:
OLLAMA_API_URL=https://your-openwebui-host/api/chat/completions
OLLAMA_API_KEY=your_open_webui_api_key
OLLAMA_MODEL=qwen3.5-122b-a10b
Note: The API type is inferred from the URL (
/api/chat/completionsvs/api/generate); noOLLAMA_API_TYPEvariable.
Usage
- Configure
.envand ensure the LLM endpoint is reachable. - Run:
npm start
- A PDF will be generated automatically. The filename matches the dungeon title.
Optional: update the map path in index.js if you have a local dungeon map.
Project structure
index.js– Entry point: env, model init, dungeon + image + PDF.src/– Application modules:dungeonGenerator.js– LLM-backed dungeon content generation and validation.dungeonTemplate.js– HTML template and layout for the PDF.ollamaClient.js– Ollama/Open WebUI API client and text cleaning.imageGenerator.js– Map image generation (Ollama + optional ComfyUI).generatePDF.js– Puppeteer-based PDF generation from the template.
test/– Unit tests (test/unit/) and integration tests (test/integration/).
Example Output
-
the-tomb-of-shadows.pdf -
Three-column layout:
- Column 1: Map, Adventure Hooks, Rumors
- Column 2: Rooms
- Column 3: Encounters, Treasure, NPCs
Notes
- Open WebUI needs a valid
OLLAMA_API_KEYwhen the server requires it. - Dungeon generation can take a few minutes depending on your LLM response time.
License
PROPRIETARY
Description
Releases
122
2026-04-30
Latest
Languages
JavaScript
100%