---
title: "Deploy Overleaf"
description: "Collaborative LaTeX in the cloud — one-click"
category: "Other"
url: https://railway.com/deploy/overleaf
---

# Deploy Overleaf

Collaborative LaTeX in the cloud — one-click

**[Deploy Overleaf on Railway](https://railway.com/template/overleaf)**

- **Creator:** norberia
- **Category:** Other

## Template content

### Overleaf https://github.com/overleaf.png

- **Image:** sharelatex/sharelatex:6.1.2
- **Health check:** /
- **Public domain:** Yes

### Redis https://cdn.sanity.io/images/sy1jschh/production/0ce0bfdcfbdbf69662b1116671f97c2dd788b655-157x157.svg

- **Image:** redis:8.2.1
- **Start command:** `/bin/sh -c "rm -rf $RAILWAY_VOLUME_MOUNT_PATH/lost+found/ && exec docker-entrypoint.sh redis-server --requirepass $REDIS_PASSWORD --save 60 1 --dir $RAILWAY_VOLUME_MOUNT_PATH"`

### Mongo Init

- **Image:** mongo:8.0
- **Start command:** `sh -c 'for i in $(seq 1 90); do mongosh -u "$MONGOUSER" -p "$MONGOPASSWORD" --host "$MONGOHOST" --authenticationDatabase admin --quiet --eval "db.adminCommand({ping:1})" && break; sleep 2; done; mongosh -u "$MONGOUSER" -p "$MONGOPASSWORD" --host "$MONGOHOST" --authenticationDatabase admin --eval "try { rs.status().ok } catch (e) { rs.initiate({_id: \"rs0\", members:[{_id:0, host: process.env.MONGOHOST + \":27017\"}]}) }"; echo INIT_DONE'`

### MongoDB https://devicons.railway.app/i/mongodb.svg

- **Image:** mongo:8.0
- **Start command:** `sh -c 'mkdir -p /data/configdb /data/db; if [ ! -s /data/configdb/keyfile ]; then openssl rand -base64 756 > /data/configdb/keyfile; chown mongodb:mongodb /data/configdb/keyfile; chmod 400 /data/configdb/keyfile; fi; exec docker-entrypoint.sh mongod --replSet rs0 --keyFile /data/configdb/keyfile --ipv6 --bind_ip ::,0.0.0.0 --setParameter diagnosticDataCollectionEnabled=false'`

## Documentation

# Deploy and Host Overleaf on Railway

Overleaf Community Edition is a self-hosted online LaTeX editor for writing, compiling, and collaborating on scientific documents in the browser. It gives you the Overleaf editing experience on your own infrastructure, with projects, real-time preview, and history stored under your control.

## About Hosting Overleaf

Hosting Overleaf means running the web app alongside MongoDB and Redis. Project files live on disk, document metadata lives in MongoDB, and sessions plus real-time collaboration state live in Redis. MongoDB must run as a replica set so Overleaf's change history works. This template wires the three services over Railway's private network, generates database passwords, attaches volumes so data survives redeploys, and publishes only the Overleaf UI. After deploy, create the first admin account at `/launchpad`, then sign in and start a project. Set `OVERLEAF_SITE_LANGUAGE` if you want a UI language other than English.

## Common Use Cases

- Run a private alternative to overleaf.com for yourself or a lab
- Collaborate on papers, theses, and grant proposals in the browser
- Teach LaTeX with an institutional editor that keeps documents in-house
- Compile CVs, posters, and conference abstracts without a local TeX install

## Dependencies for Overleaf Hosting

- Overleaf Community Edition (`sharelatex/sharelatex:6.1.2`)
- MongoDB 8.0 running as a replica set
- Redis 8.2 with password authentication
- Persistent volumes for Overleaf data, MongoDB, and Redis

### Deployment Dependencies

- [Overleaf Community Edition](https://github.com/overleaf/overleaf)
- [Overleaf environment variables](https://docs.overleaf.com/on-premises/configuration/overleaf-toolkit/environment-variables)
- [sharelatex/sharelatex Docker image](https://hub.docker.com/r/sharelatex/sharelatex)
- [Railway volumes](https://docs.railway.com/volumes)
- [Railway private networking](https://docs.railway.com/networking/private-networking)

### Implementation Details

- Create the first admin user at `/launchpad` on your public Overleaf domain after the deployment is healthy.
- `OVERLEAF_SITE_URL` is set automatically from `RAILWAY_PUBLIC_DOMAIN` so links and websockets work on Railway's HTTPS domain.
- Email confirmation is disabled (`EMAIL_CONFIRMATION_DISABLED=true`) so local accounts work without SMTP. Add SMTP variables later if you want invite emails.
- `OVERLEAF_SITE_LANGUAGE` defaults to `en`. Set it to `zh-CN` (or another supported locale) to change the UI language.
- Community Edition is intended for trusted users. Sandboxed compiles are a Server Pro feature and are not enabled here.
- The CE image ships a default TeX Live set. Install extra packages from the Overleaf UI, or switch the image if you need a full TeX Live distribution.
- Redis and MongoDB stay on the private network. Only the Overleaf service is publicly reachable on port 80.

### Why Deploy Overleaf on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Overleaf on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — [Jul'26] Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — A Self-Hosted & Modern Roleplaying Platform
- [Letta Code Remote](https://railway.com/deploy/letta-code-remote) — Run a Letta Code agent 24/7. No inbound ports, just deploy.

Open this page in a browser: https://railway.com/deploy/overleaf
