Skip to content

Deploy the service

The platex service does the actual LaTeX compilation. It’s a standalone project that runs anywhere Node.js runs — Vercel, Fly.io, Railway, Render, or your own Docker host. Deploy it once, then point any number of apps at it via PLATEX_SERVICE_URL.

  1. Clone and deploy.

    Terminal window
    git clone https://github.com/nandan-varma/platex
    cd platex
    npx vercel deploy
  2. What the build does. Vercel runs npm run build:vercel, which downloads the Tectonic binary for Linux x86_64 (SHA256-pinned) and packs it into the serverless function via includeFiles: "bin/**" in vercel.json. Your service is now live at something like https://platex-xxx.vercel.app.

  3. Point your app at it. In your app’s environment:

    Terminal window
    PLATEX_SERVICE_URL=https://platex-xxx.vercel.app

The service is a plain Node.js HTTP server, so it runs on any host. Two common shapes:

For maximum accuracy, the Docker image uses full TeX Live instead of Tectonic:

Terminal window
npm run build:server
docker build -f docker/Dockerfile -t platex .
docker run -p 3001:3001 platex

See Self-hosting with Docker for the full walkthrough.

The service has no auth by default, and compiling is CPU-intensive. Before exposing it publicly, either restrict network access or enable bearer-token auth:

Terminal window
PLATEX_API_KEY=your-secret-key # on the service

Then send the same key from your app:

Terminal window
PLATEX_API_KEY=your-secret-key # on the client app

The client sends it as Authorization: Bearer <key> automatically. See Server configuration for auth, concurrency limits, and body-size caps.

Terminal window
curl https://platex-xxx.vercel.app/health
# → {"status":"ok"}

The /health endpoint never requires auth, so it’s safe for uptime checks. From the client, platex.health() pings the same endpoint.