πͺΆ OpenGrammar 2.0
Your privacy-first, open-source writing assistant.
The completely free, zero-compromise Grammarly alternative you can host yourself.
π Official Website | π Documentation Site
Writing clearly matters. But achieving perfect grammar shouldn't mean sacrificing your privacy or paying a premium monthly subscription to a tech giant.
OpenGrammar is a powerful intelligent writing assistant built to match the premium writing tools you already know, but with one massive difference: You own your data, and it runs completely for free.
π Why OpenGrammar?
- The Zero-Cost Foundation: Out of the box, our core engine runs 100% locally in your browser. With a massive 156,000-word offline dictionary, it instantly catches misspellings, passive voice, and weak phrasing without ever pinging a server.
- Bring Your Own Brain (BYOK): Want deep, context-aware AI corrections? Just plug in your own API key (OpenAI, Groq, Together, OpenRouter, or local models via Ollama). You pay fractions of a cent exclusively for what you use.
- Paranoid-Level Privacy: We don't have a database. We don't want your data. Your API key never leaves your browser storage. Text processed through the AI is immediately deleted via stateless edge functions.
- Deploy It Yourself: You own the entire pipeline. Host our lightweight backend instantly via Docker, NPM, Cloudflare, Vercel, or Netlify.
π Live Production Endpoints
Don't want to host the backend yourself? OpenGrammar comes with incredibly fast, globally-distributed public edge deployments that you can connect your browser extension to instantly:
- βοΈ Cloudflare Workers:
https://cf.opengrammer.eu.cc/ - β³ Vercel Edge:
https://vercel.opengrammer.eu.cc/ - π© Netlify Functions:
https://nl.opengrammer.eu.cc/
π οΈ Usage & Installation Environments
Our backend is natively multi-platform. Choose the environment that best fits your workflow.
π¦ 1. NPM / Mobile / Node Environments (Recommended for easy local use)
Run the OpenGrammar server on any machine with Node.js. You can effortlessly run this on an old laptop, a Raspberry Pi, or even an Android phone using Termux!
# Run instantly without installing
npx opengrammar-server
# Or install globally for persistent usage
npm i -g opengrammar-server
# Start the server on port 8787
opengrammar-server --port 8787
π± Android (Termux) Setup:
- Install Termux.
- Run
pkg update && pkg install nodejs. - Run
npx opengrammar-server. Your phone is now a local grammar API!
π³ 2. Docker Setup
We maintain a highly optimized, multi-architecture Docker image. This is the recommended route for standard server environments or local homelabs.
# Pull the production image straight from Docker Hub
docker pull swdhinbiswas/opengrammar-backend:latest
# Run the container locally (exposes port 8787)
docker run -d -p 8787:8787 --name opengrammar swdhinbiswas/opengrammar-backend:latest
π§© 3. Browser Extension (For End Users)
- Download the latest release from the
opengrammar/extension/distbuild. - Open Chrome/Brave/Edge and navigate to
chrome://extensions/. - Enable Developer Mode.
- Click Load unpacked and select the extension folder.
- Click the OpenGrammar feather icon in your toolbar, input your custom AI API keys, and optionally link the Server URL to one of our Live Production Endpoints above!
π API Reference & Environment Variables
If you are hosting OpenGrammar yourself via Docker or NPM, you have full access to its modular REST API endpoints.
Environment Variables (.env)
Create a .env file in your runtime directory to configure the AI routing logic.
| Variable | Description |
|---|---|
PORT |
Server port (default: 8787) |
GROQ_API_KEY |
Groq API key for ultra-fast AI grammar rewriting |
OPENAI_API_KEY |
OpenAI API key for premium AI models |
Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/ |
Status dashboard & Engine Version |
GET |
/health |
Server health check |
POST |
/analyze |
Advanced grammar analysis |
POST |
/autocomplete |
AI Context-aware text completion |
GET |
/providers |
Returns configured AI providers |
Example Request:
curl -X POST http://localhost:8787/analyze \
-H "Content-Type: application/json" \
-d '{"text": "Me and him went to store yesterday."}'
β¨ Application Features
- The Dual-Engine Architecture: A blazing fast local (offline) RegEx + Dictionary matching engine, paired securely with a configurable LLM router framework for tone rewriting and smart context adjustments.
- Deduplication Logic: The AI is fully synchronized with the local spellchecker. It never wastes expensive AI tokens re-checking typos already caught locally.
- Smart Context Awareness: Automatically detects if you are writing a casual tweet, a technical document, or a formal business email, scaling its strictness appropriately.
- Dynamic Writing Score: Evaluates your text dynamically (0-100) based on Correctness, Readability, Engagement, and Sentence Delivery.
- Flawless Integrations: Securely injects into rich-text editors including Gmail, GoogleDocs, Notion, and Reddit.
π€ Contributing
We need your help to unseat the monopolies and make OpenGrammar the definitive open-source writing assistant.
Whether you are a TypeScript developer wanting to optimize Vercel Edge latency, or a language nerd looking to build out our offline Regex GRAMMAR_RULES.mdβwe want you!
- Read our CONTRIBUTING.md guide to get started locally.
- Check our
ROADMAP.mdto see what features we are currently building. - Found a bug? Open an Issue. Have an idea? Start a thread in our Discussions tab.
π License
This project is proudly open-source under the Apache 2.0 License. See the LICENSE file for details. Let's build the future of writing together.