Felipe Martín

Forgejo

Adding STL 3D Previews to Forgejo

March 15, 2026

I run a self-hosted Forgejo instance where I keep my repositories, including now some 3D printing projects I have started along with STL files (and SCAD files where applicable). By default Forgejo doesn’t know what to do with them. An ASCII STL gets served as plain text, so browsing one gives you a wall of coordinates and a page that takes ages to load, and a binary STL just gets you the “this file is binary” placeholder. Neither one is useful.

Codeberg (which runs on Forgejo) had a nice 3D preview for STL files and I wanted the same thing for my instance. It turns out you can achieve this without patching Forgejo itself by combining three things: the markup configuration, custom templates, and a bundled Three.js viewer.

Read more »