feat(grammar): check-grammar Edge Function + LanguageTool + migrations #60

Merged
raisondetredev merged 1 commit from refs/pull/60/head into main 2026-06-21 14:15:08 +02:00
raisondetredev commented 2026-06-21 14:12:34 +02:00 (Migrated from codeberg.org)

check-grammar Edge Function + LanguageTool + migrations (backend)

Backend for halkyon-learn's inline grammar checking. check-grammar is the trusted choke point in front of a private self-hosted LanguageTool instance (mirrors execute-code -> Judge0): verifies the caller's JWT, enforces a per-user rate limit + daily quota via the service-role grammar_check_events ledger, forwards plain text to LanguageTool /v2/check, and returns normalized matches. The device never sees the LanguageTool URL.

Included

  • supabase/functions/check-grammar/index.ts + languagetool.ts + README
  • migrations: grammar_check_events ledger; studysets.front_language / back_language
  • docker/languagetool/ — lean compose (n-grams off, ~1-2 GB) + README

Deploy

  1. docker compose -f docker/languagetool/docker-compose.yml up -d (reachable from Supabase's Edge runtime)
  2. supabase db push
  3. supabase functions deploy check-grammar
  4. supabase secrets set LANGUAGETOOL_URL=... [LANGUAGETOOL_AUTH_TOKEN=...]

Companion PR

App side: project-halkyon/halkyon-learn#656

## check-grammar Edge Function + LanguageTool + migrations (backend) Backend for halkyon-learn's inline grammar checking. `check-grammar` is the trusted choke point in front of a **private self-hosted LanguageTool** instance (mirrors `execute-code` -> Judge0): verifies the caller's JWT, enforces a per-user rate limit + daily quota via the service-role `grammar_check_events` ledger, forwards plain text to LanguageTool `/v2/check`, and returns normalized matches. The device never sees the LanguageTool URL. ### Included - `supabase/functions/check-grammar/` — `index.ts` + `languagetool.ts` + README - migrations: `grammar_check_events` ledger; `studysets.front_language` / `back_language` - `docker/languagetool/` — lean compose (n-grams off, ~1-2 GB) + README ### Deploy 1. `docker compose -f docker/languagetool/docker-compose.yml up -d` (reachable from Supabase's Edge runtime) 2. `supabase db push` 3. `supabase functions deploy check-grammar` 4. `supabase secrets set LANGUAGETOOL_URL=... [LANGUAGETOOL_AUTH_TOKEN=...]` ### Companion PR App side: project-halkyon/halkyon-learn#656
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
project-halkyon/halkyon-infra!60
No description provided.