Turn a Kindle into a distraction-free typewriter using a Bluetooth keyboard, an Android phone as a relay, and a Python HTTP server for text sync.
BT Keyboard -> Android Phone (Chrome /keyboard) -> Python Server (port 3333) -> Kindle Browser (/writer)
- A Python HTTP server holds the document state (text, cursor, version) in memory.
- The keyboard page (
/keyboard) captures keystrokes from a paired BT keyboard via a hidden textarea and sends them to the server over XHR. - The writer page (
/writer) polls the server every 2s and renders the document with a cursor — optimized for Kindle's e-ink display (serif font, black-on-white, minimal CSS). - The server auto-saves to
drafts/every 30s and supports save/load to GitHub Gists.
.
├── kindle_writer.py # Main server — serves /writer, /keyboard, and JSON API
├── setup_termux.sh # Termux (Android terminal) setup script
├── kindle_bookmark.html # Bookmark page for Kindle browser with quick-connect links
├── google_apps_script.js # Google Apps Script to save documents to Google Docs
├── webcam_server.py # Separate utility — webcam live view + video recording (port 8080)
│
├── KindleWriter/ # Android app (Kotlin + NanoHTTPD) — native alternative to Termux
│ ├── app/
│ │ ├── build.gradle.kts
│ │ └── src/main/java/com/kindlewriter/
│ │ └── WriterService.kt
│ ├── build.gradle.kts
│ └── settings.gradle.kts
│
├── drafts/ # Auto-saved documents (markdown)
└── clips/ # Recorded webcam clips (mp4)
| Endpoint | Method | Description |
|---|---|---|
/writer |
GET | E-ink reader page (polls for text) |
/keyboard |
GET | Keyboard input page (captures keystrokes) |
/api/text |
GET | Returns current document state as JSON |
/api/keystroke |
POST | Process a single keystroke |
/api/batch |
POST | Insert a batch of text at cursor |
/api/config |
POST | Set title, GitHub token, gist ID |
/api/save |
POST | Save document to GitHub Gist |
/api/load |
POST | Load document from a GitHub Gist |
/api/new |
POST | Reset to empty document |
Ctrl+A— Move cursor to start of lineCtrl+E— Move cursor to end of lineCtrl+K— Kill (delete) to end of lineCtrl+S— Save to Gist- Arrow keys, Home, End — Navigation
Ctrl+Arrow— Word-level navigation
pkg update && pkg install python
python kindle_writer.pySee setup_termux.sh for full setup.
A Kotlin Android app that runs the same HTTP server as a foreground service with a wake lock. Uses NanoHTTPD instead of Python's http.server.
python3 kindle_writer.pyOpen /keyboard in any browser and point the Kindle to /writer.
A separate utility (port 8080) for live webcam preview and video recording. Uses imagesnap for frame capture and ffmpeg for recording. Used for documenting the project.