NewAPIVerve Academy: free courses and certifications anyone can verify.Explore the Academy →

Grammar Checker Template

  • Next.js
  • TypeScript

Proofread any text and review each suggested fix in place: take it, keep your wording, then copy the result.

A Next.js app that proofreads text. Paste an email, post or essay and every suggested fix appears in place with the original crossed out, plus a list where you take or reject each one. The finished text is rebuilt from your choices, ready to copy. Use it as a writing tool, or lift the API route and the diff to add proofreading to your own editor or CMS.

The grammar checker app running

What it does

Fixes shown in place
Each change is drawn inside your text, with what you wrote crossed out and the fix beside it.
You decide
Take a fix or keep your own wording, one change at a time. Click a change in the text to flip it.
Alternatives on paid plans
When the API returns its corrections list, each change shows the reason and other wordings to choose from.
Draft saved
Your text is kept on the device while you write, so a refresh doesn’t lose it.
Keeps your key private
The browser only talks to your own API route, which caps the text at 5,000 characters, caches answers and limits each visitor to 10 checks a minute.

How it works

The API route: it checks the text, answers from the cache when it can, and calls Grammar Check.

app/api/check/route.ts
/** POST /api/check { text }: proofreads a passage and returns the corrected text. */
export async function POST(request: Request) {
  const body = await request.json().catch(() => null);
  const text = String(body?.text ?? '').slice(0, MAX_CHARS);
  if (!text.trim()) return fail('Write or paste some text to check');

  const key = `check:${text}`;
  const hit = fromCache<CheckResult>(key, TTL_MS);
  if (hit) return Response.json(hit);

  const blocked = guard(request);
  if (blocked) return blocked;

  return respond(async () => {
    const data = await callApi<CheckResult>('grammarcheck', { json: { text } });
    toCache(key, data);
    return data;
  });
}

See the whole file on GitHub →

Deploy it

  1. Get a free API key

    The free plan includes 200 credits a month, no card needed. Create your key.

  2. Deploy it

    Click Deploy to Vercel. Vercel copies the repo to your GitHub account and asks for APIVERVE_API_KEY: paste your key there.

  3. Open your app

    Vercel builds it and gives you a live URL, usually in about a minute. Every push to the repo redeploys it.

Try the Grammar Check API — the call this template makes

Request
POSTapi.apiverve.com/v1/grammarcheck
Body
Verification
Format

No key required to try it. Get a key to use it in your app.

Example
{
  "status": "ok",
  "error": null,
  "data": {
    "modified": true,
    "corrected": "The pig snorted when I saw it on the barn gate. I was a little mad because it woke up my puppy",
    "errorCount": 3,
    "dialect": "American",
    "corrections": [
      {
        "rule": "Repetition",
        "message": "Did you mean to repeat this word?",
        "position": {
          "start": 0,
          "end": 7
        },
        "suggestions": [
          "The"
        ]
      },
      {
        "rule": "Spelling",
        "message": "Did you mean `because`?",
        "position": {
          "start": 71,
          "end": 78
        },
        "suggestions": [
          "because"
        ]
      },
      {
        "rule": "Spelling",
        "message": "Did you mean `puppy`?",
        "position": {
          "start": 93,
          "end": 101
        },
        "suggestions": [
          "puppy",
          "puppetry"
        ]
      }
    ]
  }
}

Build your own with Grammar Check. Start with 200 free credits. One key unlocks all 300+ APIs.

Explore the catalog

300+ APIs on the same key and the same response shape.

Browse all APIs