all repos — snow-editor @ main

small and cozy markdown, and orgmode editor

13d855e2
melhorias3
Pablo Murad pblmrd@gmail.com
Sat, 04 Jul 2026 17:56:43 -0300
65993a71
updates
Pablo Murad pblmrd@gmail.com
Fri, 05 Jun 2026 22:23:29 -0300
24ce9e9e
better
Pablo Murad pblmrd@gmail.com
Wed, 03 Jun 2026 17:19:11 -0300

Snow Editor

Markdown and Org-mode editor with live preview. Multiple local drafts in localStorage. Shared docs via link + SQLite backend.

Pablo Murad — pablomurad@pm.me

Highlights (0.0.2)

Requirements

Quick start

cp .env.example .env
docker compose up -d --build

Local dev

Terminal 1:

npm install
npm run dev

Terminal 2:

cd backend && npm install && npm run dev

Vite proxies /api to port 41738.

npm run build
npm run preview

Tests

cd backend && npm test   # API unit tests
npm test                 # Org pipeline unit tests
npm run test:e2e         # Playwright smoke (starts backend + Vite dev)

First e2e run needs npx playwright install chromium. CI (GitHub Actions) runs unit tests, build, and e2e on every push/PR.

Config

See .env.example. Main vars:

Routes

Share from /: pick title and expiry, get view + edit URLs.

POST /api/documents needs a browser Origin on the allowlist. No origin → 403.

Edit lock: one editor per doc, 2 min TTL, refreshed every 30s while tab is open. Released on pagehide (re-acquired when restored from bfcache).

Versions: saving snapshots the previous content, coalesced to at most one snapshot per 5 minutes (restores always snapshot). Up to 50 versions per doc. Expired documents (and their locks/versions) are purged at boot and hourly.

API

GET    /api/health
POST   /api/documents
GET    /api/documents/view/:token
GET    /api/documents/edit/:token
POST   /api/documents/edit/:token/lock
POST   /api/documents/edit/:token/lock/refresh
DELETE /api/documents/edit/:token/lock
PUT    /api/documents/edit/:token
GET    /api/documents/edit/:token/versions?clientId=&lockToken=
POST   /api/documents/edit/:token/versions/:versionId/restore

Limits: 60 req/min per IP on /api, 10 req/min on POST /api/documents, 1 MB max body.

Health returns { ok, db, uptime, version }. DB down → 503.

Stack

React, Vite, Express, SQLite (node:sqlite), marked, Orga, CodeMirror 6, DOMPurify, highlight.js, Playwright.

Org-mode

Parser: Orga. Editor: CodeMirror (highlight, fold, checklist toggle, outline on wide screens).

Works: headings, lists, tables, TODO keywords, SRC/QUOTE blocks, basic inline markup, #+TITLE.

Does not work: babel, agenda, LaTeX, full Emacs export. Not a replacement for Emacs.

Backup

Manual only. Stop backend first if copying live.

./scripts/backup-db.sh          # or backup-db.ps1
docker compose stop backend
./scripts/restore-db.sh <file>  # or restore-db.ps1 -Backup <file>
docker compose start backend

Or copy data/snow.db yourself.

Notes

License

Use freely for personal projects and learning.

clone
git clone https://code.pablomurad.com/snow-editor.git