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.
Deploy to Vercel
Section titled “Deploy to Vercel”-
Clone and deploy.
Terminal window git clone https://github.com/nandan-varma/platexcd platexnpx vercel deploy -
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 viaincludeFiles: "bin/**"invercel.json. Your service is now live at something likehttps://platex-xxx.vercel.app. -
Point your app at it. In your app’s environment:
Terminal window PLATEX_SERVICE_URL=https://platex-xxx.vercel.app
Deploy elsewhere
Section titled “Deploy elsewhere”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:
npm run build:serverdocker build -f docker/Dockerfile -t platex .docker run -p 3001:3001 platexSee Self-hosting with Docker for the full walkthrough.
npm run build:vercel produces dist/server.cjs bundling the Tectonic binary.
Run it directly on any Node host (Fly.io, Railway, Render):
npm run build:vercelnode dist/server.cjs # listens on PORT (default 3001)Secure it before going public
Section titled “Secure it before going public”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:
PLATEX_API_KEY=your-secret-key # on the serviceThen send the same key from your app:
PLATEX_API_KEY=your-secret-key # on the client appThe client sends it as Authorization: Bearer <key> automatically. See
Server configuration for auth, concurrency limits,
and body-size caps.
Verify it’s up
Section titled “Verify it’s up”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.