.typz: A format for packaged Typst projects

TLDR: .typz is a ZIP-based project format for Typst that packages all project files (.typ, images, data, etc.) into a single archive. It solves sandboxing limitations on desktop apps while making sharing, backup, and portability easier, and it’s designed to unzip into a regular project structure.


When using Typst locally, a project is, like a TeX/LaTeX project, a collection of files: a root .typ file along with other Typst files, images, data, and resources that reference each other through relative paths.

This works fine for the web app, which already maintains project isolation. On desktop, though, it runs up against modern sandboxing and capability-based filesystems. For security reasons, sandboxed applications only get access to the files the user explicitly grants them access to, not entire parent or sibling directories. When a user opens a .typ file through a file picker, a sandboxed app like a Flatpak gets access to that one file without access to the rest of the project directory. Imports fail. Images don’t load. There’s no way to open a single document from the file manager and have it simply load assets without additional user steps.

The Typst CLI, Tinymist, and most other editors sidestep this problem through full filesystem access: you’re granting a text editor capable of loading remote modules blanket permission to read and write anywhere on your system. Some sandboxed Typst apps allow manually whitelisting certain directories to bypass sandboxing limitations, or else allow manually selecting a project folder, but this adds friction to the workflow, requires users to understand and manage projects and file system exceptions, and leaves room for confusion when, from the user’s perspective, imports mysteriously fail.

For my desktop Typst app, Typesetter, I decided to adopt an alternate approach that works within the design of modern sandboxing systems. As such, from version 0.16 onward, Typesetter has adopted the .typz project format in addition to loose .typ files.

A .typz file is a ZIP archive containing your project exactly as it sits on disk. E.g.:

example.typz
├── main.typ
├── chapters/introduction.typ
├── images/diagram.png
└── typst.toml

.typz uses an internal typst.toml project manifest following the same syntax envisioned for future use in upstream Typst itself. You can simply extract a .typz file to disk to have a regular Typst project that you can use with e.g. the CLI or Tinymist, and in the future, you should simply be able to zip a project based on loose files to immediately have a usable .typz file.

The format is detailed here.

Beyond sandboxing, .typz also brings other practical benefits. A single file is easier to share with collaborators, easier to back up, and easier to archive. When building reader applications, you only need to load a specific file. When you’re juggling multiple projects with many internal files each, everything stays together, so there’s no risk of accidentally leaving behind an image or data file. Projects are more portable: move one file instead of managing an entire directory structure.

I’m posting this because it could be useful for other app developers facing similar problems. Rather than each of us building incompatible project formats, .typz gives us a shared standard based on upstream semantics to build on. And if upstream Typst eventually decides to officially support project archives in addition to directories of loose files, having a community standard already in place makes that more straightforward.

2 Likes

Been following your Typesetter work, and am a big fan. It only being on Linux and most of my work being on my laptop means I haven’t had much of a chance to use it, but I’m hoping to sink my teeth into it later.

By the way, your links don’t seem to be rendering correctly.

Thanks! I fixed the links. (I copied Typst syntax into Markdown :sweat_smile:)

Thanks for the detailed update!

Happy to confirm that my demo for Typst-based ebooks is now fully moved to use .typz instead of internal ad hoc format. Glad that we have found alignment (and thanks to the Typst team for providing a basis for this alignment)!