FormatEx

The Stripe of LaTeX compilation — a SaaS REST API that turns .tex files into PDFs in seconds

// Demo // In action

https://formatex.io

Live site

https://formatex.io

Open site ↗

Overview

FormatEx is a production SaaS platform that exposes a dead-simple REST API for compiling LaTeX documents into PDFs. Think of it as "the Stripe of LaTeX compilation" — developers send a .tex file, get a PDF back, and never touch TeX Live again.

The platform is live at formatex.io.

Architecture

A Docker Compose stack on an Oracle VM orchestrates five services:

  • Nginx — reverse proxy on port 9002
  • latex-api — Go/Gin HTTP server (port 8080)
  • latex-worker — Go/Asynq background worker (2 replicas) for async compilation jobs
  • latex-postgres — PostgreSQL 16 storing users, API keys and compilation logs
  • latex-redis — Redis 7 backing the Asynq job queue and rate limiter
  • latex-frontend — Next.js 16 dashboard (port 9003)

Tech Stack

Backend

  • Go 1.25 + Gin framework
  • PostgreSQL 16 with pgx and connection pooling
  • Redis 7 + Asynq for async job queuing
  • TeX Live — pdflatex, xelatex, lualatex, latexmk
  • Auth: JWT (HS256, 24 h) for users; SHA-256 hashed API keys for compilation
  • Billing: Polar.sh (checkout, portal, webhooks — Merchant of Record)
  • Deployment: Docker Compose on Oracle VM

Frontend

  • Next.js 16 App Router (all use client)
  • React 19 + TypeScript 5 strict
  • Tailwind CSS v4 + shadcn/ui
  • Framer Motion 12 animations
  • TanStack React Query 5 for server state
  • React Hook Form 7 + Zod 4 for form validation

Key Features

  • Multi-engine compilation: pdflatex, xelatex, lualatex, latexmk — plan-gated
  • Async jobs: heavy compilations are queued via Redis/Asynq; results polled or streamed
  • API key management: create named keys, revoke anytime, raw key shown once (stored as hash)
  • Plan enforcement: per-plan compilation limits, engine access, timeout and file-size caps — hard block on Free, soft block on paid
  • Usage metering: every compilation logged (engine, status, duration, input size)
  • Billing portal: Polar.sh checkout + customer portal wired to plan upgrades/downgrades via webhooks
  • Admin panel: user management, plan assignment, usage inspection

Plans

PlanCompilations/moEnginesTimeout
Free15pdflatex30 s
Developer500all 4120 s
Pro2 000all 4300 s
Scale15 000all 4300 s

Security

  • API keys stored exclusively as SHA-256 hashes; raw key never persisted
  • Compilation files are ephemeral — deleted immediately after the response is sent
  • User LaTeX content is never logged
  • JWT expiry + auto-logout on 401 on the frontend

Have a project in mind?

Let's build something great together.

Tell me what you need and I'll get back to you with a clear, honest estimate.

HassanOSSYS-00
SECURE CHANNEL · ACTIVE
INIT://