[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-115001":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":33,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":15,"starSnapshotCount":15,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},115001,"noteflare","homielab\u002Fnoteflare","homielab","Keep your notes on Cloudflare. Keep them to yourself. End-to-end encrypted notes on Cloudflare Workers + D1.","https:\u002F\u002Fnoteflare.homielab.com",null,"TypeScript",135,44,1,0,23,54,69,90.24,"MIT License",false,"main",[24,25,26,27,28,29,30,31,32],"cloudflare-access","cloudflare-d1","cloudflare-workers","end-to-end-encryption","markdown","notes","react","self-hosted","shadcn","2026-11-21 06:43:39","2026-11-23 15:55:55","> [!WARNING]\n> LOSE **BOTH** YOUR PASSPHRASE AND YOUR RECOVERY CODE AND YOUR NOTES ARE UNRECOVERABLE. THAT'S WHAT REAL END-TO-END ENCRYPTION MEANS.\n\n\u003Cdiv align=\"center\">\n\n\u003Cimg src=\"public\u002Ffavicon.svg\" width=\"80\" height=\"80\" alt=\"NoteFlare logo\" \u002F>\n\n# NoteFlare\n\n**Keep your notes on Cloudflare. Keep them to yourself.**\n\nA simple, private, serverless notes app — end-to-end encrypted, completely free to run, and yours to customize.\n\n[English](README.md) · [Tiếng Việt](README.vi.md)\n\n[![Deploy to Cloudflare](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002Fbutton)](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002F?url=https:\u002F\u002Fgithub.com\u002Fhomielab\u002Fnoteflare)\n\n![License: MIT](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-MIT-f6821f)\n![Cloudflare Workers](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCloudflare-Workers%20%2B%20D1-f38020?logo=cloudflare&logoColor=white)\n![React](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FReact-19-149eca?logo=react&logoColor=white)\n![shadcn\u002Fui](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fshadcn%2Fui-000?logo=shadcnui&logoColor=white)\n![Cost](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Fcost-%240%2Fmonth-1c1b1a)\n[![Ko-fi](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FKo--fi-support-f6821f?logo=kofi&logoColor=white)](https:\u002F\u002Fko-fi.com\u002Fhomielab)\n\n\u003Cimg src=\"docs\u002Fdemo.gif\" width=\"880\" alt=\"Unlocking NoteFlare: every note decrypts in place, then a label filter, a search, a checklist tick, a note opening, list view, the account menu, two Markdown files dropped in to import, and the dark theme\" \u002F>\n\n\u003C\u002Fdiv>\n\n## ✨ Features\n\n- 🔐 **End-to-end encryption**: Argon2id + AES-256-GCM in your browser. The server only ever stores ciphertext.\n- 💸 **Completely free to run**: one Worker, one D1 database, Cloudflare Access — all on the free plan.\n- 🎨 **Yours to customize**: plain React, Tailwind and shadcn\u002Fui, a small Hono API and plain SQL migrations.\n- 📝 **Markdown notes**: headings, tables, quotes, syntax-highlighted code and `- [ ]` checklists you can tick right on the card.\n- 📌 **Organize your way**: pin, drag notes into the order you want, 8 paper colors, labels, archive, and a trash that empties itself after 30 days. Select several notes, or all of them, and label them or move them to the trash in one go.\n- 📥 **Drag-and-drop import**: drop a folder of Markdown (an Obsidian vault works), a Google Keep export, or an Evernote, Simplenote or Standard Notes export, and every note arrives encrypted.\n- 📤 **Export and backup**: download your notes as Markdown, or as an encrypted backup you can restore later.\n- 🖼️ **Encrypted images and files** (optional): attach images, PDFs or any other file, encrypted before upload and stored in your own R2 bucket.\n- ✨ **Decrypt-in-place unlock**: watch every note resolve from ciphertext the moment you unlock.\n- 📱 **Install it, use it offline**: add NoteFlare to your home screen like an app. Read, write and unlock without a connection; changes sync when you're back.\n- 🔀 **Smart multi-device sync**: edits from two devices to the same note are merged line by line, like `git merge`. Only a true clash (same line, different text) becomes a separate copy.\n- ⚡ **Instant updates**: an edit on one device shows up on your other open devices right away, without reloading.\n- 🗝️ **Recovery code**: forget your passphrase without losing your notes, and change it without re-encrypting anything.\n- 👆 **Unlock with a passkey**: Face ID, Touch ID, Windows Hello or a security key instead of typing your passphrase, still end-to-end encrypted.\n- 🔗 **Share a note by link**: send a read-only copy of one note that opens without signing in. It is encrypted with a key that lives only in the link, so the server can't read it. Links can expire after 1, 7 or 30 days, and you can revoke them any time.\n- 🔒 **Auto-lock**: keys are wiped from memory after 15 minutes idle or with one click.\n- ✍️ **A Markdown editor that helps**: lists and checklists continue when you press Enter, Tab indents, and one tap turns lines into a checklist.\n- 🌗 **Light and dark, grid or list, mobile-ready**, keyboard shortcuts (press `?` to see them) and reduced-motion support.\n- 🔄 **Update notices and release notes in the app**, checked by your own Worker, with no tracking.\n- 🌐 **Six languages out of the box** — English, Español, Français, Deutsch, Português (Brasil), Tiếng Việt — it follows your browser's language the first time, and adding another is one file.\n- 🔌 **Build your own clients**: personal access tokens, a stable `\u002Fapi\u002Fv1` with an OpenAPI spec, a TypeScript SDK that handles the encryption, and a CLI.\n\n> [!TIP]\n> **Who is NoteFlare for?** People who want the simplicity of Google Keep without handing their notes to anyone —\n> including the server they run on. It's built for individuals and small groups (Cloudflare Access is free for up to 50 users).\n\n## 🪧 Screenshots\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd width=\"50%\">\u003Cimg src=\"docs\u002Fnotes-light.png\" alt=\"Notes grid, light theme\" \u002F>\u003C\u002Ftd>\n    \u003Ctd width=\"50%\">\u003Cimg src=\"docs\u002Fnotes-dark.png\" alt=\"Notes grid, dark theme\" \u002F>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg src=\"docs\u002Flock.png\" alt=\"Lock screen over a wall of ciphertext\" \u002F>\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"docs\u002Fdecrypt.png\" alt=\"Notes decrypting in place right after unlock\" \u002F>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n  \u003Ctr>\n    \u003Ctd>\u003Cimg src=\"docs\u002Feditor.png\" alt=\"Editing a note\" \u002F>\u003C\u002Ftd>\n    \u003Ctd>\u003Cimg src=\"docs\u002Fimport.png\" alt=\"Dropping a folder of Markdown files to import\" \u002F>\u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003Cp align=\"center\">\n  \u003Cimg src=\"docs\u002Fmobile.png\" width=\"280\" alt=\"NoteFlare on a phone\" \u002F>\n  &nbsp;\n  \u003Cimg src=\"docs\u002Foffline-mobile.png\" width=\"280\" alt=\"Editing offline on a phone: the header shows one unsynced change\" \u002F>\n\u003C\u002Fp>\n\n## 📥 Import your Markdown\n\nDrag a folder (or a few `.md` files) anywhere onto NoteFlare, or use **Account → Import a Markdown folder…**.\nFiles are read and encrypted in your browser and uploaded in batches. Try it with [`examples\u002Fsample-notes`](examples\u002Fsample-notes).\n\n- **Title**: `title` in YAML frontmatter, else the first `# Heading`, else the file name\n- **Labels**: `tags` from frontmatter (Obsidian style works) plus the sub-folder the file lives in\n- **Also read**: `color`, `pinned`, `archived`\n- **Skipped**: `.obsidian`, `.git`, `node_modules`, non-Markdown files, and notes you already have (same title and body) — importing twice is safe\n\n**From Google Keep**: export Keep with [Google Takeout](https:\u002F\u002Ftakeout.google.com\u002F), unzip it, and drop the `Keep` folder (or use **Account → Import from Google Keep…**). Titles, text, checklists, labels, colors, pinned and archived come across; notes in Keep's trash and attachments (images, audio) do not.\n\n**From Evernote, Simplenote or Standard Notes**: drop the export file onto NoteFlare, or use **Account → Import from Evernote, Simplenote, Standard Notes…**.\n- **Evernote**: File → Export notes as `.enex`. Title, text, checklists and tags come across; attachments do not.\n- **Simplenote**: Settings → Export notes, unzip it and drop `notes.json`. Tags and pinned come across; the trash is skipped.\n- **Standard Notes**: Backups → download a decrypted backup, then drop the .zip (or the .txt inside it). Notes, tags, pinned and archived come across; encrypted backups can't be read.\n\n## 📤 Export and backup\n\n**Account → Export and backup…** gives you three things:\n\n- **Markdown (.zip)**: one readable `.md` file per note, with frontmatter, plus any attached images and files. It imports back into NoteFlare or opens in any Markdown editor. It is **not encrypted**, so keep it somewhere safe.\n- **Encrypted backup**: one `.json` file with your notes exactly as the server stores them, still encrypted. It is useless without your passphrase. The trash and attached images and files are left out.\n- **Restore**: pick an encrypted backup and its notes are added to your notebook; notes you already have are skipped. A backup from another deployment, or from before a recovery-code reset, asks for the passphrase that was in use when it was made.\n\nWith the R2 binding on (see Images and files), NoteFlare also saves an encrypted backup every day and keeps the last 14. They are listed under **Daily backups** in the same dialog; restore one from there.\n\n## 🖼️ Images and files\n\nNotes can carry images and any other file (a PDF, a spreadsheet, a zip), encrypted like everything else. This is off by default because it needs an R2 bucket, and R2 asks for a payment method even on its free 10 GB.\n\nTo turn it on, uncomment the `r2_buckets` line in `wrangler.jsonc` and deploy; the bucket is created for you. Then **Attach a file** appears in the editor, and you can also drop files or paste an image into a note. Images show inside the note; any other file shows as a chip with its name and size, and a click downloads it.\n\n- Everything is encrypted in your browser with your data key before upload. The server stores opaque blobs and never learns the content, the file name or the file type.\n- Any file type, up to 10 MB each. PNG, JPEG, GIF, WebP and AVIF images are shown in the note.\n- Deleting a note forever also deletes the attachments only it used. Notes purged from the trash after 30 days leave their attachments in the bucket.\n- Images need a connection the first time each device shows them, and files each time you download them.\n\n## 🔗 Share a note by link\n\nOpen a note's menu and choose **Share link**. Pick how long the link works (1 day, 7 days, 30 days or never), then **Create link**: it is copied for you. Anyone with the link can read the note in any browser, without signing in.\n\n- The link holds a copy of the note's title and text as they are now. Later edits, labels, colors and images are not shared.\n- The note is encrypted in your browser with a new key for each link. The key is the part after `#`, which browsers never send to a server, so your server only stores ciphertext. Anyone who has the whole link can read the note, so send it only to people you trust.\n- **Share link** also lists the note's active links; revoke one there. Moving the note to the trash revokes all its links, and expired links are deleted every night.\n- Only the share page (`\u002Fs\u002F…`) and its data (`\u002Fapi\u002Fshare\u002F…`) are public; the rest of NoteFlare stays behind Cloudflare Access. The in-app setup opens them for you; if you set up Access by hand, see step 8 below.\n\n## 📱 Install on your phone, use it offline\n\nNoteFlare is a Progressive Web App. Open your NoteFlare URL and sign in once, then:\n\n- **Android (Chrome)**: *Account menu → Install app*, or Chrome's menu → *Install app*\n- **iPhone \u002F iPad (Safari)**: *Share → Add to Home Screen* (*Account menu → Install app* shows the steps)\n- **Desktop (Chrome, Edge)**: the install icon in the address bar, or *Account menu → Install app*\n\n**What works offline**: opening the app, unlocking with your passphrase or a passkey, reading, searching, writing, editing, pinning, archiving, deleting and importing. The header shows *Offline · N unsynced* until everything has reached your Worker. Setting up a new account and recovering with a recovery code need a connection.\n\n**Once installed**:\n\n- **Share to NoteFlare** from other apps (Android): shared text and links become a new note, saved as soon as you unlock.\n- **Open `.md` files with NoteFlare** (desktop Chrome and Edge): they're encrypted and imported like a dropped folder.\n- **New note** from the app icon's shortcut menu.\n- Launching it again focuses the window you already have open, so you don't have to unlock twice.\n- When a new version is deployed, NoteFlare offers to reload rather than switching underneath you.\n\n**How it works**: a service worker caches the app itself. Your notes are cached by the app in IndexedDB — as the same ciphertext the server stores, plus the wrapped keys — so the device copy is just as unreadable without your passphrase. Edits go into a queue on the device and are pushed in order when a connection is available.\n\n### What happens when two devices edit the same note\n\nEvery note has a version number. When a device pushes an edit built on an older version, the server refuses it, and the device merges the two edits from the version both started at:\n\n| Device A | Device B | Result |\n|---|---|---|\n| Ticks the first item | Adds an item at the end | One note with both changes |\n| Rewrites line 2 | Deletes line 5 | Both changes applied |\n| Adds labels `work` | Adds label `q4`, removes `old` | `work`, `q4` — `old` removed |\n| Renames the note to \"A\" | Renames it to \"B\" | Server copy kept, your edit saved as **\"… (conflict copy)\"** |\n| Changes line 3 to \"oat milk\" | Changes line 3 to \"soy milk\" | Same: nothing is lost, you pick which to keep |\n\nMerging happens in the browser on decrypted text; the server never sees note content. Colors, pin and archive never cause a copy: the edit from the device that syncs later wins.\n\n### Tips for Cloudflare Access on phones\n\n- An app added to the iPhone home screen keeps its own cookies, separate from Safari, so you sign in once inside the app.\n- Access sessions last 24 hours by default. For a notes app you open every day, raise **Session Duration** on the Access application (e.g. 1 week or 1 month). When a session expires, NoteFlare keeps working on the device copy and shows *Sign in to sync*.\n- If your browser doesn't offer to install the app, or the home-screen icon is blank, the browser may be fetching the icons without your Access cookie. Add a second Access application for the paths `\u002Fmanifest.webmanifest` and `\u002Ficons\u002F` with a **Bypass** policy (they contain only the app name and icons).\n\n## 🔌 Integrations and API\n\nConnect scripts, editor plugins, browser extensions or your own apps. Create a token under **Account → Integrations** (read-only or read-and-write, with an expiry), then:\n\n```ts\nimport { NoteFlareClient } from '@noteflare\u002Fclient'\n\nconst nf = new NoteFlareClient({ url: 'https:\u002F\u002Fnotes.example.com', token: 'nf_…' })\nawait nf.unlock(passphrase)                       \u002F\u002F decryption stays on your side\nawait nf.create({ title: 'From my script', body: '- [ ] it works' })\n```\n\n```bash\necho \"- [ ] Pack a jacket\" | noteflare append \"trip\"     # the CLI in packages\u002Fcli\nnoteflare export .\u002Fbackup                                 # Markdown you can re-import\n```\n\n`noteflare mcp` lets Claude, Cursor and other AI tools read and write your notes, decrypted on your computer: see [MCP server](docs\u002FAPI.md#mcp-server-ai-tools).\n\nTokens reach only the encrypted copy: a client still needs your passphrase to read anything. Each IP address can make 60 token requests a minute; past that the API answers `429` (change it under `ratelimits` in `wrangler.jsonc`). The **[API guide](docs\u002FAPI.md)** covers the endpoints, syncing, conflict handling, Cloudflare Access setup for `\u002Fapi\u002Fv1`, and the exact encryption format with a Python example — so clients can be written in any language. The OpenAPI spec is served at `\u002Fapi\u002Fv1\u002Fopenapi.json`.\n\n## 🔐 How the encryption works\n\n```\npassphrase    ──Argon2id (64 MiB, t=3)──► KEK  ──AES-GCM wrap──► wrappedDek   ┐\nrecovery code ──HKDF-SHA256─────────────► RKEK ──AES-GCM wrap──► recoveryDek  ├─ stored in D1\npasskey PRF   ──HKDF-SHA256─────────────► PKEK ──AES-GCM wrap──► passkey copy │  (one per passkey)\nrandom 256-bit DEK ──AES-GCM, AAD = \"note:\u003Cid>\"──► note ciphertext            ┘\n                   ──AES-GCM, AAD = \"blob:\u003Cid>\"──► attachment ciphertext (R2, optional)\n```\n\n- Your passphrase, the data key (DEK) and note content never leave the browser unencrypted. Titles, bodies, labels and colors are all inside the ciphertext; only `pinned`, `archived`, `trashed_at`, `position` and timestamps are plaintext so notes can be sorted.\n- **Passkeys** (Account → Unlock with passkey…): the WebAuthn PRF extension gives the browser a secret that only that passkey can produce, after Face ID, Touch ID or a PIN. It wraps one more copy of the DEK. The server stores that copy and the PRF salt, never the secret. Removing a passkey deletes its copy; the passphrase and recovery code keep working, and a changed passphrase doesn't affect passkeys. It needs a browser and passkey provider with PRF (recent Chrome, Edge and Safari with iCloud Keychain, Google Password Manager or Windows Hello); elsewhere the option is hidden.\n- In a session the DEK is a **non-extractable** `CryptoKey` kept in memory only. Locking discards it.\n- The offline copy on your device holds the same ciphertext and wrapped keys as the server. Signing out deletes it.\n- Each note's ciphertext is bound to its id, so the server can't swap content between notes.\n- The client rejects Argon2 parameters below a safe floor, so a malicious server can't downgrade the KDF.\n- The Worker verifies the Cloudflare Access JWT itself (signature, issuer, audience) instead of trusting headers.\n- A strict CSP ships in `public\u002F_headers`; TanStack Markdown escapes raw HTML and drops executable URLs by default.\n\n## 🧱 Tech stack\n\n- **Runtime**: [Cloudflare Workers](https:\u002F\u002Fworkers.cloudflare.com\u002F) with [Static Assets](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fstatic-assets\u002F) and a Cron Trigger\n- **Database**: [Cloudflare D1](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fd1\u002F) (SQLite)\n- **Auth**: [Cloudflare Access](https:\u002F\u002Fwww.cloudflare.com\u002Fzero-trust\u002Fproducts\u002Faccess\u002F), verified with [jose](https:\u002F\u002Fgithub.com\u002Fpanva\u002Fjose)\n- **API**: [Hono](https:\u002F\u002Fhono.dev\u002F)\n- **UI**: [React 19](https:\u002F\u002Freact.dev\u002F), [Tailwind CSS 4](https:\u002F\u002Ftailwindcss.com\u002F), [shadcn\u002Fui](https:\u002F\u002Fui.shadcn.com\u002F), [lucide](https:\u002F\u002Flucide.dev\u002F), View Transitions API\n- **Markdown**: [TanStack Markdown](https:\u002F\u002Fgithub.com\u002FTanStack\u002Fmarkdown), with [TanStack Highlight](https:\u002F\u002Fgithub.com\u002FTanStack\u002Fhighlight) for code\n- **Images** (optional): [Cloudflare R2](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fr2\u002F)\n- **Crypto**: WebCrypto + [hash-wasm](https:\u002F\u002Fgithub.com\u002FDaninet\u002Fhash-wasm) (Argon2id)\n- **Offline**: a Service Worker for the app shell, IndexedDB via [idb](https:\u002F\u002Fgithub.com\u002Fjakearchibald\u002Fidb) for encrypted notes and the sync queue\n\n## 🏗️ Deploy\n\n### One click (no coding needed)\n\nWatch every step first: [3-minute video with narration](https:\u002F\u002Fnoteflare.homielab.com\u002Fstart\u002Fdeploy\u002F).\n\nYou need a free [Cloudflare](https:\u002F\u002Fdash.cloudflare.com\u002Fsign-up) account and a free [GitHub](https:\u002F\u002Fgithub.com\u002Fsignup) account. It takes about 10 minutes, most of it waiting for the first deploy.\n\n**Part 1: Deploy the app**\n\n1. Click the **Deploy to Cloudflare** button at the top of this page and sign in to Cloudflare.\n2. Under **Git account**, connect your GitHub account (**New GitHub connection**, then **Authorize** and **Install & Authorize** on GitHub) and pick it. Tick **Create private Git repository**.\n\n   If Cloudflare shows *Select a repository* after connecting GitHub, click the Deploy to Cloudflare button again: your account is now in the list.\n3. Fill in the form. Only one field needs typing:\n\n   | Field | What to do |\n   | --- | --- |\n   | `ALLOWED_EMAILS` | Type your own email address. |\n   | Everything else | Keep it as it is (`ACCESS_TEAM_DOMAIN` and `ACCESS_AUD` stay `todo`). |\n\n4. Click **Deploy** and wait until the build finishes (about a minute).\n5. Open **Overview** and click **Visit** (the link looks like `noteflare.\u003Cyour-subdomain>.workers.dev`; if it says *No URLs enabled*, reload the page). NoteFlare shows **Finish setting up NoteFlare**.\n\n**Part 2: Set up the login**\n\nNoteFlare puts a Cloudflare Access login in front of itself, so only your email can open it. Access is free for up to 50 people.\n\n1. Click **Create token in Cloudflare**. The permissions NoteFlare needs are already selected: click **Continue to summary**, then **Create Token**, and copy the token.\n2. Back in NoteFlare, paste the token, check your email address, and click **Set up the login**.\n3. Click **Sign in** and enter the code Cloudflare emails you.\n4. Delete the token in Cloudflare (**My Profile → API Tokens**). NoteFlare used it once and did not keep it.\n\nThe token only works for the Cloudflare account NoteFlare runs in, so nobody else can finish the setup for you. Prefer to click through Zero Trust yourself? See [Set up Cloudflare Access by hand](#set-up-cloudflare-access-by-hand).\n\n**Part 3: Create your passphrase**\n\n1. Choose a passphrase. This is what encrypts your notes.\n2. Write down the **recovery code** and keep it somewhere safe, away from your passphrase.\n\n### With an AI agent\n\nHave a coding agent with terminal access (Claude Code, Codex, Gemini CLI…) deploy it for you. First create a deploy token: Cloudflare dashboard → **My Profile → API Tokens → Create Token → Create Custom Token**, with these permissions:\n\n| Permission | Why |\n| --- | --- |\n| Account → **Workers Scripts** → Edit | Upload the Worker, its files and its daily trash cleanup, and turn on its `workers.dev` link |\n| Account → **D1** → Edit | Create the `noteflare` database and apply its migrations |\n| Account → **Workers R2 Storage** → Edit | Only if you turned on attachments in `wrangler.jsonc` |\n\nLimit **Account Resources** to your account. Your account ID is on the dashboard home page (**Account ID**, under the account menu). Then clone this repository, open the agent in its folder and paste:\n\n```text\nDeploy NoteFlare from this folder to my Cloudflare account.\n\n1. Read README.md, docs\u002FARCHITECTURE.md and wrangler.jsonc first.\n2. I need Bun (https:\u002F\u002Fbun.sh) and Node 20+. Check `bun --version` and `node --version`; tell me if one is missing.\n3. Ask me to create a file named `.env` in this folder myself, with these two lines:\n   CLOUDFLARE_ACCOUNT_ID=\u003Cmy account ID>\n   CLOUDFLARE_API_TOKEN=\u003Cmy deploy token>\n   Never ask me to paste the token in the chat, never print, log or commit it, and never pass it as a command argument. `.env` is in .gitignore and Wrangler reads it on its own; check that `git status` does not list it.\n4. Keep the Worker name `noteflare` and the database name `noteflare`. Do not change any other value in wrangler.jsonc.\n5. Run `bun install`, then `bun run deploy` (build, deploy the Worker and create the D1 database, apply migrations). If it fails, show me the error and how to fix it.\n6. Give me the `https:\u002F\u002Fnoteflare.\u003Csubdomain>.workers.dev` link from the deploy output. Tell me to open it and finish on the \"Finish setting up NoteFlare\" screen (README, Deploy, Part 2 and Part 3), then delete `.env` and the deploy token.\n```\n\n### Command line\n\nRequires [Bun](https:\u002F\u002Fbun.sh), Node 20+ and a Cloudflare account.\n\n```bash\nbun install\nbunx wrangler login\nbun run deploy   # build → deploy the Worker (creates D1) → apply migrations (including new ones on upgrade)\n```\n\nThen open the link and follow Part 2 above.\n\n### Set up Cloudflare Access by hand\n\nInstead of the in-app setup in Part 2:\n\n1. In the [Cloudflare dashboard](https:\u002F\u002Fdash.cloudflare.com), open **Zero Trust**. The first time, it asks you to pick a team name and the Free plan. Remember the team name.\n2. Go to **Access controls → Applications → Create new application → Self-hosted and private**.\n   - Name: `NoteFlare`\n   - Select **Add public hostname** and enter your NoteFlare address, e.g. `notes.example.com` or `noteflare.\u003Cyour-subdomain>.workers.dev`\n\n   For a `workers.dev` link you can also turn Access on in **Workers & Pages → noteflare → Settings → Domains & Routes**.\n3. Add a policy: *Allow* → *Emails* → your email address. Save the application. Login by emailed one-time code works right away; Google or GitHub login also work.\n4. Copy the **Application Audience (AUD) Tag**: in **Access controls → Applications**, select **Edit** on NoteFlare, open **Additional settings**, and copy the value (a long string of letters and numbers).\n5. Put both values into `wrangler.jsonc` in place of `todo`. If you used the one-click button, open your new `noteflare` repository on GitHub, open `wrangler.jsonc`, click the pencil icon, and edit these lines:\n\n   ```jsonc\n   \"vars\": {\n     \"ACCESS_TEAM_DOMAIN\": \"https:\u002F\u002F\u003Cyour-team>.cloudflareaccess.com\",\n     \"ACCESS_AUD\": \"\u003CAUD tag>\",\n     \"ALLOWED_EMAILS\": \"you@example.com\"   \u002F\u002F optional second lock, checked by the Worker\n   }\n   ```\n\n6. Deploy again. On GitHub, click **Commit changes** and Cloudflare redeploys by itself in a few minutes. On the command line, run `bun run deploy`.\n7. Open your NoteFlare link. You should now see the Cloudflare login page, then NoteFlare.\n8. Optional, for [shared links](#-share-a-note-by-link): create a second self-hosted application named `NoteFlare shared links` with two public hostnames, your NoteFlare address with path `s` and with path `api\u002Fshare`, and a policy with action **Bypass** and include **Everyone**. Without it, people you share a link with see the Cloudflare login page.\n\nThen run through the [hardening checklist](SECURITY.md#hardening-checklist-for-your-deployment).\n\n## 🔄 Update\n\nNoteFlare tells you when a new version is out: a badge appears on your avatar, and **About and updates** in the account menu shows the release notes. After you update, **What's new** lists what changed.\n\nThe check runs on your Worker, not in your browser. It asks GitHub for the latest release of `homielab\u002Fnoteflare` at most every 6 hours and sends nothing about you or your notes. Set `UPDATE_CHECK_REPO` in `wrangler.jsonc` to your fork's `owner\u002Frepo` to follow your own releases, or to `\"off\"` to turn it off.\n\n**Deployed with the button?** Cloudflare created a copy of this repo in your GitHub account and redeploys on every push. Updating takes one click, after a one-time setup.\n\n*Once: add the update button.* The Deploy button leaves this file out of your copy, so add it yourself:\n\n1. Open [`update.yml`](https:\u002F\u002Fgithub.com\u002Fhomielab\u002Fnoteflare\u002Fblob\u002Fmain\u002F.github\u002Fworkflows\u002Fupdate.yml) and copy its contents (the copy icon at the top right of the file).\n2. In **your** `noteflare` repository on GitHub, choose **Add file → Create new file**.\n3. Name it `.github\u002Fworkflows\u002Fupdate.yml`, paste, and click **Commit changes**.\n\n*Each time: update.*\n\n1. In your repository, open the **Actions** tab and select **Update NoteFlare**.\n2. Click **Run workflow**, then **Run workflow** again.\n3. Cloudflare deploys the new version in a few minutes.\n\n*Optional: update from the app.* With two more settings, **About and updates** shows **Update now**, which runs the same workflow for you:\n\n1. On GitHub, open **Settings → Developer settings → Personal access tokens → Fine-grained tokens → Generate new token**. Give it a name and an expiry, choose **Only select repositories** and pick your `noteflare` repository, then under **Repository permissions** set **Actions** to **Read and write**. Generate it and copy it.\n2. In the Cloudflare dashboard, open **Workers & Pages → noteflare → Settings → Variables and Secrets** and add two values of type **Secret**: `GITHUB_UPDATE_TOKEN` with the token, and `GITHUB_UPDATE_REPO` with your repository as `owner\u002Fnoteflare`.\n3. Reload NoteFlare. When a new version is out, click **Update now**; Cloudflare deploys it in a few minutes and NoteFlare offers to reload.\n\nThe token stays in your Worker and is never sent to the browser. Only you, signed in through Cloudflare Access, can start an update; API tokens can't. The token can only run workflows in that one repository; delete it on GitHub to turn the button off.\n\nThe update keeps the settings in your `wrangler.jsonc` (database id, Cloudflare Access values). If you changed the code yourself, your changes are kept where they don't overlap with the new version; where they do, the new version wins.\n\nPrefer a terminal? In a clone of your copy:\n\n```bash\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002Fhomielab\u002Fnoteflare\u002Fmain\u002Fscripts\u002Fupdate-from-upstream.sh | bash\ngit push                                                         # Workers Builds deploys it\n```\n\n**Deployed from the command line?**\n\n```bash\ngit pull\nbun install\nbun run deploy   # also applies new database migrations\n```\n\nYour notes, keys and settings live in D1 and stay untouched; migrations only ever add to the schema. Read the [changelog](CHANGELOG.md) for anything marked **Breaking** before a minor-version update.\n\n## 🧑‍💻 Develop locally\n\n```bash\ncp dev.vars.sample .dev.vars     # DEV_USER_EMAIL=you@example.com — local only\nbun run db:migrate:local\nbun run dev:api                  # terminal 1: Worker + local D1 on :8787\nbun run dev                      # terminal 2: Vite on :5173, proxies \u002Fapi\nbun run test                         # crypto, Access JWT, offline sync, merging, import, tokens\nbun run build:client             # build the SDK (packages\u002Fclient)\n```\n\n`DEV_USER_EMAIL` is honored only while the Access variables are empty **and** the request is to `localhost`, so it can never open a deployed app. Still, don't set it in production.\n\nThe service worker only exists in production builds. To try offline mode locally, run `bun run build && bun run dev:api` and open http:\u002F\u002Flocalhost:8787.\n\n## 💸 Free-tier budget\n\n| Service | Free allowance | How NoteFlare uses it |\n|---|---|---|\n| Workers | 100,000 requests\u002Fday | One request per save; saves are debounced (~0.7 s) |\n| D1 | 5M rows read, 100k rows written per day; 500 MB per database | Refreshes only fetch notes changed since the last sync |\n| Access | 50 users | One seat per person you let in |\n| Durable Objects | 100,000 requests\u002Fday (incoming WebSocket messages count 1 per 20) | One object per person keeps the sockets of their open devices; it holds no data |\n| R2 (optional) | 10 GB stored | Only if you turn on [images](#️-images); one object per image |\n\nPersonal use stays far below these limits. If a D1 daily limit is ever hit, queries pause until 00:00 UTC — nothing is lost.\n\n## 🎨 Customize\n\n| Want to… | Edit |\n|---|---|\n| Restyle colors, fonts, note palette, motion | `src\u002Findex.css` — tokens at the top, motion at the bottom |\n| Edit UI text or add a language | `src\u002Fi18n\u002Fen.ts` (keys), add e.g. `fr.ts` and register it in `src\u002Fi18n\u002Findex.tsx` |\n| Tune encryption cost | `DEFAULT_KDF` in `packages\u002Fclient\u002Fsrc\u002Fcrypto.ts` |\n| Change auto-lock \u002F autosave timing | `IDLE_LOCK_MS` in `src\u002Flib\u002Fvault.tsx`, `DEBOUNCE_MS` in `src\u002Flib\u002Fsync\u002Fengine.ts` |\n| Highlight more languages in code blocks | `src\u002Flib\u002Fhighlight.ts` |\n| Change how edits from two devices merge | `packages\u002Fclient\u002Fsrc\u002Fmerge.ts` (tested in `tests\u002Fmerge.test.ts`) |\n| Change the app icon or install name | `public\u002Ficons\u002F`, `public\u002Fmanifest.webmanifest` |\n| Change trash retention | `TRASH_TTL_MS` in `worker\u002Findex.ts`, `triggers.crons` in `wrangler.jsonc` |\n| Add API routes | `worker\u002Findex.ts` (Hono); public ones also go in `worker\u002Fopenapi.ts` and `docs\u002FAPI.md` |\n| Change the encryption or wire format | `packages\u002Fclient\u002Fsrc\u002F` — shared by the web app, the Worker and the SDK |\n| Follow your fork's releases, or turn off update checks | `UPDATE_CHECK_REPO` in `wrangler.jsonc` |\n| Add UI components | `bunx shadcn@latest add \u003Ccomponent>` |\n\n## 🚗 Roadmap\n\nContributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md), and open an issue to talk through bigger changes first.\n\n- [x] End-to-end encryption with recovery code\n- [x] Markdown with tickable checklists\n- [x] Labels, pin, archive, trash with auto-purge\n- [x] Decrypt-in-place unlock and View Transitions\n- [x] UI in English, Spanish, French, German, Brazilian Portuguese and Vietnamese\n- [x] Drag-and-drop Markdown import\n- [x] Installable app that works offline\n- [x] Automatic three-way merge across devices\n- [x] Public API, access tokens, TypeScript SDK and CLI\n- [x] Export to Markdown (CLI)\n- [x] Export from the web app, encrypted backup and restore\n- [x] Drag-and-drop reordering\n- [x] Encrypted image and file attachments on R2\n- [x] Google Keep Takeout import\n- [x] Code highlighting via TanStack Highlight\n\n## 🙋 FAQ\n\n**Can Cloudflare read my notes?** No. Notes are encrypted in your browser before they're sent; D1 only holds ciphertext and wrapped keys.\n\n**Can I script it or build my own app?** Yes. See [Integrations and API](#-integrations-and-api): tokens, a TypeScript SDK, a CLI, and a documented encryption format for other languages.\n\n**Is there a mobile app?** NoteFlare installs from the browser as an app (see [Install on your phone](#-install-on-your-phone-use-it-offline)) and works offline. There's no App Store build.\n\n**What if I edit the same note on my phone and laptop?** Changes to different lines are merged automatically. If both devices changed the same line differently, you get both versions: the other device's in the note, yours in a \"conflict copy\" next to it.\n\n**Why Cloudflare Access instead of a password login?** Access handles sign-in, MFA and sessions at Cloudflare's edge for free, so the app ships no auth code to get wrong. Your passphrase is a separate secret used only for encryption.\n\n**Is it really free?** On Cloudflare's free plan, yes, within the limits above. There's no paid service in the stack.\n\n**Can I bring my Obsidian vault?** Yes — drop the vault folder. Frontmatter tags become labels, sub-folders become labels, and `.obsidian\u002F` is ignored. Wiki-links and embeds are kept as plain text.\n\n**I forgot my passphrase.** Use **Forgot passphrase?** on the lock screen with your recovery code. Without either, the data can't be decrypted — by design.\n\n## 📚 Documentation\n\n| Doc | For |\n| --- | --- |\n| [API guide](docs\u002FAPI.md) | Building scripts and apps on `\u002Fapi\u002Fv1`, the SDK and the CLI |\n| [Architecture](docs\u002FARCHITECTURE.md) | How the Worker, D1, encryption and offline sync fit together |\n| [Security](SECURITY.md) | Threat model, what the server can see, reporting vulnerabilities |\n| [Contributing](CONTRIBUTING.md) | Local setup, tests and pull request checklist |\n| [Changelog](CHANGELOG.md) | What changed in each release |\n\n## 💖 Credits\n\n[Cloudflare](https:\u002F\u002Fwww.cloudflare.com\u002F) · [TanStack Markdown](https:\u002F\u002Fgithub.com\u002FTanStack\u002Fmarkdown) · [shadcn\u002Fui](https:\u002F\u002Fui.shadcn.com\u002F) · [Hono](https:\u002F\u002Fhono.dev\u002F) · [hash-wasm](https:\u002F\u002Fgithub.com\u002FDaninet\u002Fhash-wasm) · [Be Vietnam Pro](https:\u002F\u002Ffonts.google.com\u002Fspecimen\u002FBe+Vietnam+Pro)\n\nNoteFlare is an independent project and is not affiliated with Cloudflare or Google. Its orange palette is a nod to the platform it runs on; the logo is original and doesn't use Cloudflare's trademarks.\n\n## 📄 License\n\n[MIT](LICENSE)\n\n## ⭐ Support\n\nNoteFlare is free, with no ads and no tracking, and it stays that way. If it keeps your notes safe:\n\n- **Star the repo** so others can find it.\n- **[Buy me a coffee on Ko-fi](https:\u002F\u002Fko-fi.com\u002Fhomielab)** to fund the time that goes into it.\n- **Tell us you deployed it** in [Discussions](https:\u002F\u002Fgithub.com\u002Fhomielab\u002Fnoteflare\u002Fdiscussions). There's no telemetry, so that's how we know it works.\n\n[![Support NoteFlare on Ko-fi](https:\u002F\u002Fko-fi.com\u002Fimg\u002Fgithubbutton_sm.svg)](https:\u002F\u002Fko-fi.com\u002Fhomielab)\n\n[![Star History Chart](https:\u002F\u002Fapi.star-history.com\u002Fsvg?repos=homielab\u002Fnoteflare&type=Date)](https:\u002F\u002Fstar-history.com\u002F#homielab\u002Fnoteflare&Date)\n","NoteFlare 是一个基于 Cloudflare Workers 和 D1 构建的端到端加密笔记应用，所有加密\u002F解密操作均在浏览器内完成，服务端仅存储密文。核心功能包括 Markdown 编辑（支持代码高亮、待办清单）、标签与文件夹式组织、拖拽导入（Obsidian\u002FEvernote 等格式）、离线使用与智能多设备同步（行级冲突合并），并可选集成 R2 加密存储附件。它完全免费运行于 Cloudflare 免费层，适合注重隐私、需自托管轻量笔记方案的个人用户或小团队。",2,"2026-11-24 04:50:02","CREATED_QUERY"]