---
title: "Deploy LanguageTool: Self-Hosted Grammar & Spell Check API"
description: "Check grammar, spelling and style in 30+ languages over a private API."
category: "Other"
url: https://railway.com/deploy/languagetool-grammar-api
---

# Deploy LanguageTool: Self-Hosted Grammar & Spell Check API

Check grammar, spelling and style in 30+ languages over a private API.

**[Deploy LanguageTool: Self-Hosted Grammar & Spell Check API on Railway](https://railway.com/template/languagetool-grammar-api)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/languagetool-grammar-api/manifest.json

- **Creator:** blueorange
- **Category:** Other

## Template content

### LanguageTool

- **Image:** erikvl87/languagetool:6.8@sha256:ef8fa12cbd485166c9ceeb7139d76d56d07707a624da6bb1fc1fbb5411750527
- **Start command:** `/bin/bash -c 'cd /LanguageTool; N=/ngrams; U=https://languagetool.org/download/ngram-data; ROOT=0; [ "$(id -u)" = 0 ] && ROOT=1; [ $ROOT = 1 ] && [ -d $N ] && chown languagetool:languagetool $N; JOBS=""; for l in $(echo "${NGRAM_LANGUAGES:-none}" | tr "A-Z," "a-z "); do case $l in none|off|false) continue ;; en) f=ngrams-en-20150817.zip ;; de) f=ngrams-de-20150819.zip ;; es) f=ngrams-es-20150915.zip ;; fr) f=ngrams-fr-20150913.zip ;; nl) f=ngrams-nl-20181229.zip ;; *) echo "ngrams: unknown language $l (choose from en,de,es,fr,nl)" >&2; continue ;; esac; if [ -d $N/$l ]; then echo "ngrams: $l already on the volume"; elif [ -d $N ] && [ -w $N ]; then JOBS="$JOBS $l:$f"; else echo "ngrams: $l requested but $N is not a writable volume; add a volume at $N (see README)" >&2; fi; done; if [ -n "$JOBS" ]; then P=$$; ( NEW=0; for j in $JOBS; do l=${j%%:*}; f=${j#*:}; echo "ngrams: downloading $f in the background (LanguageTool keeps serving meanwhile)"; rm -rf $N/.$l.zip $N/.$l.tmp; if curl -fsSL --retry 5 -o $N/.$l.zip $U/$f && unzip -q -o $N/.$l.zip -d $N/.$l.tmp && [ -d $N/.$l.tmp/$l ]; then mv $N/.$l.tmp/$l $N/$l; rm -rf $N/.$l.zip $N/.$l.tmp; [ $ROOT = 1 ] && chown -R languagetool:languagetool $N/$l; echo "ngrams: $l installed"; NEW=1; else echo "ngrams: $l download or unzip failed (check free space on the volume)" >&2; rm -rf $N/.$l.zip $N/.$l.tmp; fi; done; if [ $NEW = 1 ]; then echo "ngrams: restarting so LanguageTool loads the new data"; kill $P; fi; ) & fi; if [ -z "$langtool_languageModel" ]; then for l in en de es fr nl; do [ -d $N/$l ] && export langtool_languageModel=$N && break; done; fi; [ -n "$langtool_languageModel" ] && echo "ngrams: languageModel=$langtool_languageModel"; if [ $ROOT = 1 ]; then exec su languagetool -s /bin/sh -c "echo \"running LanguageTool as \$(id -un)\"; exec bash start.sh"; fi; exec bash start.sh'`
- **Health check:** /v2/languages
- **Public domain:** Yes

## Documentation

# Deploy and Host LanguageTool on Railway

![LanguageTool logo](https://github.com/languagetool-org.png)

LanguageTool is an open source **grammar, spelling and style checker** that supports more than 30 languages, including English, German, Spanish, French, Dutch, Portuguese and Ukrainian. This template runs the LanguageTool HTTP server on Railway so your apps, editors, CI pipelines and browser extensions can send text to the `/v2/check` endpoint and get back a list of issues with suggested fixes, without sending documents to a third-party cloud. LanguageTool is LGPL-2.1 licensed with about 15,300 GitHub stars, and this template runs version 6.8 through the widely used erikvl87 Docker image, pinned by digest. Grammarly Pro costs about $12 per month billed yearly or $30 billed monthly per person. LanguageTool on Railway costs about $5–15/month for a private server your whole team can share.

---

## What This Template Deploys

| Service | Purpose |
|---|---|
| **LanguageTool** | `erikvl87/languagetool:6.8`, pinned by digest, with a public domain on port `8010`. The HTTP API at `/v2/check`, `/v2/languages` and related endpoints. |

The service has no database. An optional volume at `/ngrams` can hold extra n-gram data for better detection of commonly confused words.

---

## About Hosting LanguageTool

Writing tools are everywhere, but most of them send every sentence to a vendor's servers and bill per seat. LanguageTool's open source engine runs on your own server with the same rule-based checks the public service uses, so private documents, support tickets and code comments stay inside your infrastructure.

**Grammar and spelling.** Thousands of rules catch agreement errors, wrong words, punctuation, capitalization and typos, with suggestions for each match.

**Style.** Flag wordiness, repeated words, passive voice and other style issues, and turn individual rules on or off per request.

**Many languages.** Check text in more than 30 languages and variants such as `en-US`, `en-GB`, `de-DE` and `pt-BR`, or let the server detect the language.

**Simple HTTP API.** Post text and a language code to `/v2/check` and read the JSON `matches` array, with offsets, messages and replacements.

**Rate limits.** Per-IP request limits and a maximum text length protect the server when it is exposed to the internet.

**N-gram data.** Optional n-gram files for English, German, Spanish, French and Dutch improve detection of confused words such as their and there.

---

## Deploy LanguageTool in Under 5 Minutes

1. Click **Deploy on Railway**. No inputs are needed.
2. Wait about a minute until `GET /v2/languages` returns HTTP 200 while the language models load.
3. Test it: `curl -s -d language=en-US --data-urlencode "text=This are a test." https://your-domain/v2/check`.
4. Point your editor plugin, browser extension or app at your Railway URL as a custom LanguageTool server.
5. Adjust request limits and memory for your traffic.

---

## Common Use Cases

- **Private writing checks:** check contracts, medical notes or internal documents without a third-party cloud.
- **Docs in CI:** fail a build when documentation or release notes contain grammar errors.
- **Content platforms:** add spell and grammar suggestions to a CMS, forum or support desk.
- **Browser and editor plugins:** connect LanguageTool extensions and editor add-ons to your own server.
- **Multilingual teams:** check text in many languages with one service.
- **Education tools:** give students writing feedback inside a learning app.
- **Data cleaning:** flag low-quality text before it reaches a search index or training set.
- **Support replies:** catch mistakes in customer support answers before they are sent.
- **Localization review:** check translated app strings in each target language.
- **Email drafting tools:** add grammar suggestions to an internal email or CRM composer.

---

## Configuration

| Variable | Required | Default | Description |
|---|---|---|---|
| `PORT` | Required | `8010` | Port LanguageTool listens on |
| `Java_Xms` | Optional | `256m` | Initial Java heap |
| `Java_Xmx` | Optional | `1g` | Maximum Java heap; raise for many languages or heavy traffic |
| `langtool_requestLimit` | Optional | `120` | Checks per client IP per period; `0` is unlimited |
| `langtool_requestLimitPeriodInSeconds` | Optional | `60` | Length of the rate-limit window |
| `langtool_maxTextLength` | Optional | `100000` | Longest text accepted per check |
| `langtool_maxCheckTimeMillis` | Optional | `60000` | Time limit for one check |
| `langtool_cacheSize` | Optional | `1000` | Sentence results kept in memory |
| `langtool_pipelineCaching` | Optional | `true` | Reuses checking pipelines between requests |
| `langtool_trustXForwardForHeader` | Optional | `true` | Uses the real client IP for rate limits |
| `NGRAM_LANGUAGES` | Optional | `none` | N-gram data to download: `en`, `de`, `es`, `fr`, `nl` |

**Memory.** A 1 GB heap handles English and a few other languages well. Raise `Java_Xmx` to `2g` or more and give the service matching memory if you check many languages or long texts.

**N-gram data.** Add a volume at `/ngrams`, then set `NGRAM_LANGUAGES`, such as `en,de`. The start command downloads each set once; English alone is several gigabytes, so size the volume accordingly.

**Access control.** The API has no login. Per-IP limits stop casual abuse, but for a private server keep the URL unpublished, put an authenticating proxy in front, or remove the public domain and call it over Railway's private network.

**Editor plugins.** Many LanguageTool add-ons have an advanced setting for a custom server URL; enter your Railway domain there.

**Rule control.** Every match includes a rule ID. Pass `disabledRules` or `enabledRules` with a request to silence noisy rules or turn on optional ones, and use `disabledCategories` to drop whole groups such as typography.

**Language detection.** Send `language=auto` and LanguageTool picks the language for you, or add `preferredVariants` such as `en-GB` to steer the choice.

**Personal words.** Product names and jargon can trigger spelling matches. Keep a list in your client and filter those matches, or disable the spelling rule for specific requests.

**Throughput.** Most checks of a paragraph finish in well under a second. For batch jobs, send texts in parallel and raise `langtool_requestLimit` for the caller's IP, or call the service over Railway's private network, where the limits apply per internal client.

**Health checks.** `GET /v2/languages` returns the supported languages and is a cheap way to confirm the server is ready.

**Client libraries.** Community clients exist for Python, JavaScript, Java and other languages, and any HTTP client works because the API is plain form posts returning JSON.

**Start-up time.** Each restart reloads the language models, which takes about a minute, so plan redeploys outside busy periods.

---

## LanguageTool vs. Alternatives

| Feature | LanguageTool on Railway | Grammarly Pro | LanguageTool Premium | Harper |
|---|---|---|---|---|
| Hosting | Self-hosted | Hosted SaaS | Hosted SaaS | Runs locally |
| License | LGPL-2.1 | Proprietary | Proprietary service | Apache-2.0 |
| HTTP API | ✅ | ❌ | ✅ | ❌ |
| Languages | 30+ | English | 30+ | English |
| Text stays on your server | ✅ | ❌ | ❌ | ✅ |
| AI rewriting | ❌ | ✅ | ✅ | ❌ |
| Price | About $5–15/month for the team | About $12–30/user/month | Subscription | Free |

Grammarly and LanguageTool Premium add AI rewriting and extra premium rules. Harper is a fast local English checker. Self-hosted LanguageTool gives a private multilingual API for your own apps.

---

## Dependencies for LanguageTool Hosting

- A Railway account.
- Optional: a volume for n-gram data.

### Deployment Dependencies

- [LanguageTool on GitHub](https://github.com/languagetool-org/languagetool): source code and rules
- [LanguageTool HTTP API](https://languagetool.org/http-api/): endpoint reference
- [erikvl87/docker-languagetool](https://github.com/Erikvl87/docker-languagetool): the Docker image used here

### Implementation Details

The image is pinned by digest, so redeploys never change versions. The start command optionally prepares the n-gram volume as root, then runs LanguageTool as an unprivileged user with the configured heap.

---

## Frequently Asked Questions

**What is LanguageTool?**
An LGPL-2.1 open source grammar, spelling and style checker for more than 30 languages.

**How much does it cost to host LanguageTool?**
About $5–15/month on Railway, depending on memory and traffic.

**How do I check text?**
Post `language` and `text` to `/v2/check` and read the `matches` array in the JSON response.

**Is it the same as LanguageTool Premium?**
It uses the open source rules. Premium-only rules and AI rewriting are not included.

**Can I use my browser extension with it?**
Yes, where the extension or add-on supports a custom server URL.

**Is my server private?**
The API has no login, so restrict access with a proxy or Railway's private network for sensitive use.

---

## Why Deploy and Host LanguageTool 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 LanguageTool on Railway, you get a private multilingual grammar and spelling API for your apps and team, without per-seat fees or sending text to a third party.


## Similar templates

- [Rocky Linux](https://railway.com/deploy/rocky-linux) — Hosted Rocky Linux 9 workspace with SSH and persistent storage. 🚀
- [Foundry Virtual Tabletop](https://railway.com/deploy/X5tR6G) — Self-hosted virtual tabletop for role-playing games (license required)
- [Double Commander in your browser](https://railway.com/deploy/double-commander-in-your-browser) — The Double Commander file manager in the cloud, from any device

Open this page in a browser: https://railway.com/deploy/languagetool-grammar-api
