<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu" -->

---
title: GitHub - durable-oss/typst-rails: Typst typesetting...
description: Typst-rails is a Ruby gem that integrates the Typst typesetting system into Rails, Rage, and Sinatra applications, letting developers generate PDFs from .typ...
canonical: https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: GitHub - durable-oss/typst-rails: Typst typesetting integration for Ruby applications — generate PDFs from Typst templates in Rails, Rage, Sinatra, or plain Ruby | daily.dev
og:description: Typst-rails is a Ruby gem that integrates the Typst typesetting system into Rails, Rage, and Sinatra applications, letting developers generate PDFs from .typ...
og:url: https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu
og:image: https://api.daily.dev/og/posts/0SZ0a3SsU.png
og:image:alt: GitHub - durable-oss/typst-rails: Typst typesetting integration for Ruby applications — generate PDFs from Typst templates in Rails, Rage, Sinatra, or plain Ruby
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# GitHub - durable-oss/typst-rails: Typst typesetting integration for Ruby applications — generate PDFs from Typst templates in Rails, Rage, Sinatra, or plain Ruby

**[Ruby Flow](https://daily.dev/sources/rubyflow)** · 4 min read · 2 upvotes · 0 comments

## Summary

Typst-rails is a Ruby gem that integrates the Typst typesetting system into Rails, Rage, and Sinatra applications, letting developers generate PDFs from .typ templates that work alongside ERB templates. It supports two compilation backends: a CLI wrapper around the typst executable, or an in-process native extension gem, with auto-detection between them. The gem also allows custom backends (e.g., for remote Typst compilation services), and ships with unit, end-to-end, and Docker-based test suites.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://github.com/durable-oss/typst-rails>

## Questions this post answers

### How do I generate PDFs from Typst templates in a Rails application?

Install the typst-rails gem, add it to your Gemfile, and .typ templates are automatically registered to work like ERB templates. In a controller, respond_to a format.pdf block that renders a template such as reports/monthly.typ, referencing instance variables like @title and @author inside the template.

_Developers wiring PDF generation into Rails often track niche gem releases like this via daily.dev._

### What is the difference between the :cli and :gem backends in typst-rails?

The :cli backend shells out to a separately installed typst executable available on PATH, while the :gem backend uses the native typst RubyGem to compile documents in-process without a subprocess or separate install. By default the backend is set to :auto, which prefers the gem when installed and falls back to the CLI otherwise, though it can be forced explicitly.

_Choosing between subprocess and native compilation approaches is easier when developers follow tooling comparisons like this on daily.dev._

## Similar posts on daily.dev

- [GitHub - enderahmetyurt/typed\_print: TypedPrint provides zero-dependency, beautifully formatted table output for Ruby data structures with automatic column sizing, alignment options, custom headers, a](https://daily.dev/posts/github---enderahmetyurt-typed-print-typedprint-provides-zero-dependency-beautifully-formatted-tabl-3jaoloni6) · Ruby Flow · 0 upvotes · 0 comments
- [Typst: Typst 0.15 contains multitudes – Typst Blog](https://daily.dev/posts/typst-typst-0-15-contains-multitudes-typst-blog-ititd46mk) · Lobsters · 1 upvotes · 0 comments
- [Typst replaced Microsoft Word for me, and the learning curve was worth every minute](https://daily.dev/posts/typst-replaced-microsoft-word-for-me-and-the-learning-curve-was-worth-every-minute-ewxwdufoe) · XDA Developers · 1 upvotes · 0 comments
- [Type-safe Ruby](https://daily.dev/posts/type-safe-ruby-f9hjvs10r) · Hacker News · 1 upvotes · 0 comments
- [Create a Markdown Editor in Ruby on Rails](https://daily.dev/posts/create-a-markdown-editor-in-ruby-on-rails-mhtcschr2) · RUBYLAND · 0 upvotes · 0 comments

---

Tags: [#ruby](https://daily.dev/tags/ruby)

[View this post on daily.dev](https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"GitHub - durable-oss/typst-rails: Typst typesetting integration for Ruby applications — generate PDFs from Typst templates in Rails, Rage, Sinatra, or plain Ruby","url":"https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu"},"datePublished":"2026-08-30T00:30:58.082Z","dateModified":"2026-09-14T07:32:50.015Z","description":"Typst-rails is a Ruby gem that integrates the Typst typesetting system into Rails, Rage, and Sinatra applications, letting developers generate PDFs from .typ...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b30f4785328a0073abb6eeb10abd93fc?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/b30f4785328a0073abb6eeb10abd93fc?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Ruby Flow","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Ruby Flow","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/a21aaa8bcbbf448193a016895c90a0e1","url":"https://daily.dev/sources/rubyflow"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"ruby","timeRequired":"PT4M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Ruby Flow","item":"https://daily.dev/sources/rubyflow"},{"@type":"ListItem","position":3,"name":"GitHub - durable-oss/typst-rails: Typst typesetting integration for Ruby applications — generate PDFs from Typst templates in Rails, Rage, Sinatra, or plain Ruby"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/github---durable-oss-typst-rails-typst-typesetting-integration-for-ruby-applications-generate-pdf-0sz0a3ssu#faq","mainEntity":[{"@type":"Question","name":"How do I generate PDFs from Typst templates in a Rails application?","acceptedAnswer":{"@type":"Answer","text":"Install the typst-rails gem, add it to your Gemfile, and .typ templates are automatically registered to work like ERB templates. In a controller, respond_to a format.pdf block that renders a template such as reports/monthly.typ, referencing instance variables like @title and @author inside the template. Developers wiring PDF generation into Rails often track niche gem releases like this via daily.dev."}},{"@type":"Question","name":"What is the difference between the :cli and :gem backends in typst-rails?","acceptedAnswer":{"@type":"Answer","text":"The :cli backend shells out to a separately installed typst executable available on PATH, while the :gem backend uses the native typst RubyGem to compile documents in-process without a subprocess or separate install. By default the backend is set to :auto, which prefers the gem when installed and falls back to the CLI otherwise, though it can be forced explicitly. Choosing between subprocess and native compilation approaches is easier when developers follow tooling comparisons like this on daily.dev."}}]}
```

