সহজে বাংলা লিখুন
A Bangla writing app with per-keystroke phonetic transliteration. No romanized text on screen, ever.
Most phonetic Bangla tools show English letters on screen while you type, then convert them after you press space or confirm. কাগজ takes a different approach. Every keystroke produces native Bangla characters directly. You never see romanized text. Type how it sounds and Bangla appears instantly.
You press: a m i [space] b a n g l a y
You see: আ ম ি [space] ব া ং ল া য়
No server required. No account needed. Your writing stays on your device, saved to localStorage, never sent anywhere. You own your text.
Phonetic Bangla input -- Type on your regular keyboard, see Bangla instantly. 100+ context-aware transliteration rules, complex conjuncts (ক্ষ, জ্ঞ, ষ্ট), toggle between Bangla/English.
Adaptive dictionary -- Learns from your writing. Three tiers: learned words > extended (50,000+) > base collocations. Frequency tracking with bigram-aware predictions.
Ghost text suggestions -- Faded word completions as you type powered by trie lookup + bigram context. Optional AI phrase completion via OpenAI. Tab to accept, Escape to dismiss.
Typing guide -- Built-in searchable reference showing all phonetic mappings organized by the traditional barga structure, with staggered entrance animations. Accessible from the toolbar.
Notes management -- Multiple notes with sidebar, auto-save every 2 seconds, dark/light theme, adjustable font size. Share notes as images.
Rich formatting -- Bold, italic, underline, strikethrough, code, highlight, bullet and numbered lists.
PWA -- Installable as a native-feeling app. Works offline with service worker caching.
Spell-checking (paused) -- Local Levenshtein matching with optional AI fallback. Disabled while being reworked.
Requires Node.js 18.18+ and pnpm.
git clone https://github.com/tarex/kagoj.git
cd kagoj
pnpm install
pnpm devOpen http://localhost:3000.
Optional: Copy .env.example to .env.local and add OPENAI_API_KEY for AI ghost text suggestions. The app works fully without it.
┌──────────────────────────────────────────────────────────┐
│ User Types │
│ "ami banglay" │
└──────────────┬───────────────────────────────────────────┘
│
▼
┌──────────────────────────┐ ┌──────────────────────────┐
│ BanglaInputHandler │ │ Adaptive Dictionary │
│ │ │ │
│ Keystroke -> Bangla │───>│ Learn word on boundary │
│ "a" -> "আ", "m" -> "ম" │ │ Track frequency │
│ Context-aware rules │ │ Trie + bigram suggest │
└──────────────────────────┘ └──────────────────────────┘
│
▼
┌──────────────────────────┐
│ Ghost Text │
│ │
│ Dictionary completion │
│ AI phrase suggestion │
│ Tab to accept │
└──────────────────────────┘
The app includes a built-in typing guide (accessible via the keyboard icon in the toolbar). Here's a quick reference:
| Type | Bangla | Type | Bangla |
|---|---|---|---|
o |
অ | a |
আ |
i |
ই | I / ee |
ঈ |
u |
উ | U |
ঊ |
rri |
ঋ | e |
এ |
OI |
ঐ | O |
ও |
OU |
ঔ |
| 1st | 2nd | 3rd | 4th | 5th | |
|---|---|---|---|---|---|
| ক | k ক |
kh খ |
g গ |
gh ঘ |
Ng ঙ |
| চ | c চ |
ch ছ |
j জ |
jh ঝ |
NG ঞ |
| ট | T ট |
Th ঠ |
D ড |
Dh ঢ |
N ণ |
| ত | t ত |
th থ |
d দ |
dh ধ |
n ন |
| প | p প |
ph ফ |
b ব |
bh ভ |
m ম |
| Type | Bangla | Type | Bangla | Type | Bangla |
|---|---|---|---|---|---|
z |
য | r |
র | l |
ল |
S |
শ | sh |
ষ | s |
স |
h |
হ | R |
ড় | Rh |
ঢ় |
y |
য় | x |
ক্স |
| Type | Result | Notes |
|---|---|---|
ng |
ং | |
t` |
ৎ | Khondo t |
,, |
্ | Hasanta (conjunct former) |
^ |
ঁ | Chandrabindu |
: |
ঃ | |
. |
। | Dari |
\. |
. | Literal dot |
` |
Breaks conjunct | |
$ |
৳ | Taka sign |
0-9 |
০-৯ | Bangla numerals |
| Type | Result | Example |
|---|---|---|
kkh |
ক্ষ | kkhoma = ক্ষমা |
shT |
ষ্ট | koshTe = কষ্টে |
gg |
জ্ঞ | biggan = বিজ্ঞান |
nc |
ঞ্চ | ponco = পঞ্চ |
nj |
ঞ্জ |
Tip: Uppercase = retroflex/aspirated (T = ট, t = ত).
| Shortcut | Action |
|---|---|
| Ctrl+Shift+B | Toggle Bangla / English |
| Ctrl+Shift+T | Toggle theme |
| Tab | Accept ghost suggestion |
| Escape | Dismiss ghost suggestion |
| Ctrl+/ | Typing guide / shortcuts panel |
| Ctrl+N | New note |
| Ctrl+S | Save |
| Ctrl+Z | Undo |
| Ctrl+Shift+Z | Redo |
| Ctrl+B | Bold |
| Ctrl+I | Italic |
| Ctrl+U | Underline |
| Ctrl+D | Strikethrough |
| Ctrl+E | Code |
| Ctrl+H | Highlight |
| Ctrl+P |
| Layer | Technology |
|---|---|
| Framework | Next.js 16 (App Router, Turbopack) |
| UI | React 19, Tailwind CSS 4 |
| Language | TypeScript 5.9 (strict) |
| AI | Vercel AI SDK v6, OpenAI (optional) |
| Validation | Zod 4 |
src/
├── app/
│ ├── api/suggestions/ # AI ghost text endpoint
│ ├── layout.tsx
│ ├── page.tsx
│ ├── globals.css
│ ├── console-greeting.tsx # Console easter egg
│ └── pwa-register.tsx
│
├── components/note/
│ ├── index.tsx # Main orchestrator
│ ├── keyboard-shortcuts-panel.tsx # Typing guide + shortcuts
│ ├── note-editor.tsx # Textarea
│ ├── ghost-text.tsx # Word completion overlay
│ ├── toolbar.tsx # Formatting toolbar
│ ├── note-list.tsx # Sidebar
│ ├── onboarding.tsx # First-use experience
│ ├── share-preview-modal.tsx
│ └── word-suggestion-popup.tsx
│
├── hooks/
│ ├── useAISuggestion.ts # AI ghost text (LRU cache, rate-limited)
│ ├── useSpellCheck.ts
│ ├── useShareImage.ts
│ ├── useUndoRedo.ts
│ └── useDebounce.ts
│
└── lib/
├── bangla-input-handler.ts # Phonetic input processor (singleton)
├── context-pattern.ts # 100+ transliteration rules
├── adaptive-dictionary.ts # Learns from writing (singleton)
├── trie.ts # Trie for fast prefix lookup
├── bigram-store.ts # Bigram word prediction
├── bangla-collocations.ts # Pre-seeded word pairs
├── bangla-words-comprehensive.ts # 50,000+ words
├── local-spell-checker.ts
└── lru-cache.ts # LRU cache for AI suggestions
public/
├── sw.js # Service worker
└── manifest.json # PWA manifest
- Offline-first -- No server needed for core features
- Singletons -- BanglaInputHandler and AdaptiveDictionary share state across the app
- Three-tier dictionary -- Adaptive > Comprehensive > Collocations, ranked by frequency
- Bigram context -- Word predictions consider the previous word for smarter suggestions
- Throttled persistence -- Saves are debounced to keep typing smooth
- AI optional -- App works fully without an API key; AI adds phrase-level ghost text
Everything lives in localStorage. Nothing leaves the browser unless you enable AI ghost text.
| Key | Contents |
|---|---|
notes |
Saved notes |
currentNote |
Unsaved draft |
selectedNoteIndex |
Active note index |
noteFontSize |
Font size |
noteTheme |
Theme |
bangla_learned_words |
Learned words |
bangla_word_frequency |
Word frequencies |
bangla_bigrams |
Learned bigrams |
- Fork the repo
- Create a branch:
git checkout -b feature/my-feature - Make changes, run
npx tsc --noEmit - Open a PR
Areas that could use help: dictionary expansion, transliteration edge cases, test coverage, mobile responsiveness, voice input, spell-check rework.
- Avro Phonetic by OmicronLab inspired the phonetic approach. কাগজ uses its own rules and produces native characters per-keystroke instead of converting after confirmation.
- The 50,000+ word dictionary was generated from verb conjugation paradigms, noun case forms, and curated vocabulary.
MIT © Tareq