πͺΆ OpenGrammar
Your privacy-first, open-source writing assistant.
The free, self-hostable Grammarly alternative.
OpenGrammar is a powerful, self-hostable browser extension that helps you write clearly and confidently everywhere on the web. It's built to feel like the premium writing assistants you know, but with a critical difference: you control your data, and it can run completely for free.
π Why OpenGrammar?
Most popular grammar assistants require you to send every keystroke to their servers and charge a hefty monthly fee for advanced features. OpenGrammar changes that:
- Zero Cost Option: The core engine runs locally in your browser, checking for passive voice, repetition, and readability without needing a server or an internet connection.
- Bring Your Own AI: Want advanced, context-aware grammar corrections? Just paste in your own API key (like OpenAI, Groq, or OpenRouter). You pay only fractions of a cent for what you actually use, directly to the AI provider.
- Absolute Privacy: We don't have a database. We don't have user accounts. Your API key never leaves your browser. If you use the AI features, your text is sent securely to a stateless edge function, processed, and immediately forgotten.
- Open Source & Self-Hosted: You can deploy the backend to Cloudflare Workers or Vercel Edge for free in one command. You own the infrastructure.
β¨ Features
- Works Everywhere: Seamlessly integrates into text inputs, textareas, and rich text editors (like Gmail, Google Docs, Notion, and Reddit).
- Blazing Fast: Built with modern web technologies (React, Vite, Manifest V3) for minimal performance impact.
- Dual-Engine Architecture:
- Rule-Based (Free & Offline): Catches passive voice, repeated words, and overly long sentences.
- AI-Powered (Requires API Key): Advanced grammar, spelling, clarity, and stylistic suggestions using models like GPT-4, Groq, Together, or open-source alternatives via OpenRouter and Ollama.
- Tone & Style Rewriting: Right-click context menus or shortcuts to quickly rewrite text in 8 different tones (Formal, Casual, Professional, etc.).
- Writing Statistics: Built-in dashboard for readability scores, reading time, and vocabulary diversity.
- Intuitive UI: Familiar red, yellow, and blue underlines with click-to-apply suggestions.
π Getting Started (For Users)
Note: Since this is an open-source developer project, it is not yet published on the Chrome Web Store. You will need to load it manually.
- Download the Extension: Download the latest release or clone this repository.
- Open Extensions Page: In Chrome, go to
chrome://extensions/. - Enable Developer Mode: Toggle the switch in the top right corner.
- Load Unpacked: Click the "Load unpacked" button and select the
opengrammar/extension/distfolder you built or downloaded. - Configure: Click the OpenGrammar icon in your browser toolbar. Paste your OpenAI, Groq, or OpenRouter API key to enable advanced AI capabilities.
π» Developer Guide: Build & Deploy
Want to build OpenGrammar from scratch or deploy your own backend? Here is how.
Prerequisites
- Node.js (v18 or newer)
- npm, pnpm, or yarn
1. Set up the Backend (Serverless Edge API)
The backend is a lightweight API that securely handles the AI requests.
# Navigate to the backend folder
cd opengrammar/backend
# Install dependencies
npm install
# Run locally for testing (runs on http://localhost:8787)
npm run dev
# Deploy to Cloudflare Workers (requires a free Cloudflare account)
npx wrangler deploy
After deploying, copy the provided URL (e.g., https://opengrammar.yourname.workers.dev).
2. Set up the Chrome Extension
# Navigate to the extension folder
cd opengrammar/extension
# Install dependencies
npm install
# IMPORTANT: Link your Backend
# Open src/background/index.ts and replace the BACKEND_URL with your deployed URL from step 1.
# Build the extension
npm run build
This will create a dist/ folder. Load this folder into Chrome following the user instructions above.
π€ Contributing & Help Needed
We need your help to make OpenGrammar the best open-source writing assistant!
One of our primary goals is to build the most comprehensive library of local (offline) grammar and style rules. You don't need to be a developer to helpβif you have a good eye for grammar, you can contribute!
- π Add Grammar Rules: Help us expand our
analyzer-simple.tswith more regex-based rules for common mistakes, style improvements, and clarity checks. See GRAMMAR_RULES.md for a guide on how to add them. - π Report Bugs: Found a website where the highlighting is wonky? Open an issue!
- π‘ Suggest Features: Have an idea for a cool new feature? Let's discuss it in the Discussions tab.
Please check out our CONTRIBUTING.md and ROADMAP.md for more details.
π License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.