<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: William</title>
    <description>The latest articles on DEV Community by William (@william_b898ff4ee6a7e992f).</description>
    <link>https://dev.to/william_b898ff4ee6a7e992f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3861123%2Fde9ba202-a783-46be-8c94-40a8292b39cf.jpg</url>
      <title>DEV Community: William</title>
      <link>https://dev.to/william_b898ff4ee6a7e992f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/william_b898ff4ee6a7e992f"/>
    <language>en</language>
    <item>
      <title>How I Built a Desktop Trading Journal with Electron, React, and SQLite</title>
      <dc:creator>William</dc:creator>
      <pubDate>Sat, 04 Apr 2026 14:39:53 +0000</pubDate>
      <link>https://dev.to/william_b898ff4ee6a7e992f/how-i-built-a-desktop-trading-journal-with-electron-react-and-sqlite-5hlo</link>
      <guid>https://dev.to/william_b898ff4ee6a7e992f/how-i-built-a-desktop-trading-journal-with-electron-react-and-sqlite-5hlo</guid>
      <description>&lt;p&gt;Last week I shipped a desktop app called Aurafy. It's a trading journal for futures traders that runs entirely locally. No cloud, no accounts, no subscription. I wanted to share the technical decisions behind it because I think the "local first" approach is underrated for tools that handle sensitive financial data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Stack
&lt;/h2&gt;

&lt;p&gt;The app is built as a monorepo with three pieces:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server:&lt;/strong&gt; Express.js + better-sqlite3. The server runs inside the Electron process (no child process spawn, which cuts startup time to under 2 seconds). SQLite with WAL mode handles all persistence. Every write uses &lt;code&gt;synchronous = FULL&lt;/code&gt; because losing trade data is unacceptable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Client:&lt;/strong&gt; React + Vite + Tailwind CSS + Recharts. Standard SPA that talks to the Express server over localhost. TanStack Query handles all data fetching and caching.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Electron wrapper:&lt;/strong&gt; The main process starts the Express server in-process, opens a BrowserWindow pointing to localhost, and handles native features like screen recording permissions and floating camera windows.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Local First?
&lt;/h2&gt;

&lt;p&gt;Trading data is sensitive. Your P&amp;amp;L, your account sizes, your mistakes. Most trading journals upload all of this to their cloud. I didn't want that.&lt;/p&gt;

&lt;p&gt;With SQLite, everything lives in &lt;code&gt;~/Library/Application Support/aurafy/data/journal.db&lt;/code&gt;. The user can back it up, move it, or delete it. No API keys, no OAuth flows, no "please log in again."&lt;/p&gt;

&lt;p&gt;The tradeoff is no cross-device sync. But for a trading journal that you use at your desk, this hasn't been an issue. Traders don't journal on their phones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Screen Recording in Electron
&lt;/h2&gt;

&lt;p&gt;One feature I'm proud of is the built-in screen recorder. Traders record their sessions to review later, similar to how athletes watch game film.&lt;/p&gt;

&lt;p&gt;Electron's &lt;code&gt;desktopCapturer&lt;/code&gt; API provides screen capture. I combine it with &lt;code&gt;getUserMedia&lt;/code&gt; for microphone input, mix both audio streams using the Web Audio API, and feed everything into a &lt;code&gt;MediaRecorder&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The camera overlay is a separate &lt;code&gt;BrowserWindow&lt;/code&gt; with &lt;code&gt;transparent: true&lt;/code&gt;, &lt;code&gt;alwaysOnTop: true&lt;/code&gt;, and &lt;code&gt;frame: false&lt;/code&gt;. It floats above all apps like Loom's camera bubble. The HTML is dead simple: a circular div with a video element showing the webcam feed.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSV Import with Auto-Detection
&lt;/h2&gt;

&lt;p&gt;Traders export their data from platforms like Tradovate and NinjaTrader as CSV files. The challenge is that every platform uses different column names, date formats, and instrument naming conventions.&lt;/p&gt;

&lt;p&gt;Tradovate calls the instrument "MNQM6" while NinjaTrader calls it "MNQ 06-26". Both mean the same thing: Micro Nasdaq futures, June 2026 contract.&lt;/p&gt;

&lt;p&gt;I wrote a parser that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Auto-detects the platform by checking column headers&lt;/li&gt;
&lt;li&gt;Normalizes instrument names using regex (strip the contract month code)&lt;/li&gt;
&lt;li&gt;Matches to a local instruments table with tick sizes and point values&lt;/li&gt;
&lt;li&gt;Pairs entry/exit executions and calculates P&amp;amp;L&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The whole import flow is: drop CSV → see preview with detected trades → confirm. No manual mapping.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lessons Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Run the server in-process.&lt;/strong&gt; My first version spawned a Node child process for the Express server. This added 3+ seconds to startup and caused issues with macOS code signing (the OS saw it as two separate apps). Running Express inside Electron's main process using &lt;code&gt;require()&lt;/code&gt; fixed both problems.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SQLite's WAL mode matters.&lt;/strong&gt; Without it, writes block reads. With &lt;code&gt;journal_mode = WAL&lt;/code&gt; and &lt;code&gt;synchronous = FULL&lt;/code&gt;, you get concurrent reads during writes and guaranteed durability on crash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Electron auto-update is fragile.&lt;/strong&gt; &lt;code&gt;electron-updater&lt;/code&gt; creates draft releases on GitHub, which means download URLs return 404 until you manually publish them. I added a CI step that auto-publishes after both Mac and Windows builds complete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;ELECTRON_RUN_AS_NODE&lt;/code&gt; will haunt you.&lt;/strong&gt; If this env var is set (which it is in some development environments), Electron runs as plain Node.js and &lt;code&gt;require('electron')&lt;/code&gt; returns a string instead of the module. I spent hours debugging this.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;Aurafy is free and available at &lt;a href="https://aurafy.dev" rel="noopener noreferrer"&gt;aurafy.dev&lt;/a&gt;. The code handles futures contracts (ES, NQ, CL, MES, MNQ) with proper point values and tick sizes.&lt;/p&gt;

&lt;p&gt;If you're interested in the Electron + Express + SQLite architecture pattern, happy to answer questions in the comments.&lt;/p&gt;

</description>
      <category>electron</category>
      <category>opensource</category>
      <category>react</category>
      <category>trading</category>
    </item>
  </channel>
</rss>
