A dependency-free rich text editor that runs in the browser.
Defter (“notebook” in Turkish) is a writing pad that needs no installation: a single HTML page and a few ES modules. No libraries, no build step and no server side. What you write is saved automatically and stays only in your own browser.
Templates, code highlighting, find and replace, autosave and a 30-version history; every pasted piece of content goes through an allow-list sanitiser.
Category
Browser-based text editor
Project type
Open source (MIT)
Platform
Web · current browsers
Status
Live · public demo
First release
November 2026
Developer
Ali Zafer
Available in the live demo. No content is ever sent to a server; documents are kept in the browser’s local storage (localStorage). Unit tests run with Node’s built-in test runner (node:test) on GitHub Actions on every push.
01Why Defter?
Taking a note shouldn’t require opening an account, installing an app or sending what you write to a server.
Defter is built on the browser’s own editing capabilities: formatting uses the browser’s editing commands, so undo and redo work for every action without any dependency.
The project is a dependency-free rewrite of an earlier experiment, TextEditor.
02Product approach
No dependencies
No third-party code; icons are inline SVG and fonts come from the system. No build step.
Data stays in the browser
Documents and versions live only in the browser’s local storage; nothing is sent to a server.
Safe content first
Every piece of HTML that comes in (paste, opening a file, reading from storage, version preview) goes through an allow-list.
Reversible actions
A version is saved automatically before risky actions such as replace all, opening a file, a new document or restoring a version.
Search that leaves markup alone
Find and replace works on text nodes, not on HTML; tags and attributes are never touched.
Honest about its limits
Warns when local storage is full and states clearly in its documentation that text split across several formats doesn’t count as a single match.
03System architecture
Modules written as pure functions (highlighter, search, version history) can be tested without a browser.
index.htmlPage, toolbar and <dialog> windows
main.jsCommands, saving, images, dialogs and find and replace
sanitize.jsHTML allow-list
highlight.jsCode highlighter (pure function)
find.jsSearch pattern and text nodes
history.jsVersion history (pure functions)
templates.jsTemplates
localStorageThe document and its last 30 versions, in this browser only
Browser APIsEditing commands, CSS Custom Highlight API
The diagram shows the actual file structure of the repository (src/).
04Roadmap
Phase 01
Storage
Move local storage to IndexedDB (today: the ~5 MB localStorage limit)
Store images separately from the document
Several documents and a document list
Phase 02
Import and export
Markdown import and export
Back up and restore every document in one file
Phase 03
Writing experience
Find and replace across formatted text
Insert and edit tables
Document outline from headings
Phase 04
Offline
Installable app (PWA)
Opens without a connection
Long term
Research areas
Optional end-to-end encrypted sync
Real-time co-writing
The roadmap shows the direction of development; it is not a promise of dates or completion. The dependency-free design and the “data stays in the browser” principle stay in place in every phase.
05Technical approach
Vanilla JavaScript
ES modules
contenteditable
CSS Custom Highlight API
localStorage
<dialog>
node:test
GitHub Actions
06Data and security
What you write in Defter stays in your browser. Content coming from outside is cleaned before it reaches the page.
No data is sent to a server
Scripts, event attributes and javascript: links are removed
iframes and embedded objects are removed
Only harmless style properties such as colour, size and alignment are kept
An automatic version before every risky action
The rules are taken from the README and src/sanitize.js in the repository; they are not the result of an independent security audit.
07What works today
Features available in the live demo and in the repository.
FormattingHeadings, quotes, bold, italic, underline and strikethrough, font size and colour, lists, alignment, horizontal rule.
TemplatesLetter, meeting notes, journal, article, technical note and to-do list.
Code highlightingComments, strings, numbers and keywords are coloured: JS, PHP, Python, SQL and the C family.
Find and replaceMatch case, whole words with Turkish letters, regular expressions; matches are highlighted on the page.
Saving and version historyEvery change is saved within a second; a version is taken every five minutes or with Ctrl+S, and the last 30 versions can be previewed and restored.
Images, files and dark themeDrag-and-drop images, download and open HTML or plain text, printing; a dark theme that follows the system setting.
08Related articles
Articles on the approaches used in this project. The articles are in Turkish.