2 min read

Software should be exciting.

Software should be exciting.
Photo by Microsoft Copilot / Unsplash

I am very happy with the technology in Narrow Write! I believe building software should be fun and the code should be very clean. I use AI to explore this project completely, and it even helps me manage code changes and fix issues as a contributor. Here is why the technology behind this project is exciting to me.

1. The Magic of "No-Build"

I used a no-build approach. It feels amazing because development is instant. The whole project is just a single index.html file.

  • Why? There is no npm install, no Webpack, and no waiting.
  • Direct Workflow: I change the code, refresh the browser, and see the results immediately. It uses only Vanilla JS and Pico.css for the UI.

2. Local-First and Private

The architecture is designed to be efficient and safe.

  • Storage: Everything you type saves to your browser's localStorage as you type.
  • Privacy: There are no servers, no accounts, and zero tracking. Because it is local-first, there is no network latency.

3. Fixing the contenteditable Bug

This was a great technical challenge! Using contenteditable is usually hard because of browser bugs. In Firefox and Safari, reading the DOM while typing causes duplicate characters.

I fixed this by using the InputEvent API (e.inputType and e.data). This captures the input stream directly before the browser can break the text.

// This high-tech fix avoids the duplicate character bug!
editor.addEventListener('input', (e) => {
  // We get the data directly from the event, not the DOM
  const text = e.data;
  const type = e.inputType;

  // Process the word logic without breaking the cursor
  handleRollingWindow(text, type);
});

4. Simple Android and CI/CD

Because the core is just one file, the CI/CD pipeline is very powerful and easy to use.

  • Unified Logic: The same single-file logic runs on the web, as a Chrome extension, and inside an Android WebView.
  • Automated Builds: I use GitHub Actions to automatically build the Android APK and the Chrome extension zip every time I push code.

Building software this way is very exciting because it is simple and it just works everywhere. Focus is everything for the code!