<?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: Omar Afifi</title>
    <description>The latest articles on DEV Community by Omar Afifi (@omarafifi).</description>
    <link>https://dev.to/omarafifi</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%2F3954903%2F1b239da9-6bec-4707-b255-626d891d9dd7.png</url>
      <title>DEV Community: Omar Afifi</title>
      <link>https://dev.to/omarafifi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/omarafifi"/>
    <language>en</language>
    <item>
      <title>Reviving Daphq: How I Built an Open-Source, Bare-Metal File Transfer Engine Solo with GitHub Copilot</title>
      <dc:creator>Omar Afifi</dc:creator>
      <pubDate>Wed, 27 May 2026 21:12:32 +0000</pubDate>
      <link>https://dev.to/omarafifi/reviving-daphq-how-i-built-an-open-source-bare-metal-file-transfer-engine-solo-with-github-copilot-5cd8</link>
      <guid>https://dev.to/omarafifi/reviving-daphq-how-i-built-an-open-source-bare-metal-file-transfer-engine-solo-with-github-copilot-5cd8</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/github-2026-05-21"&gt;GitHub Finish-Up-A-Thon Challenge&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Daphq&lt;/strong&gt; is a robust, open-source, cross-platform file transfer application engineered entirely from scratch to deliver hardware-saturating speeds over local area networks (LAN), Wi-Fi, and Mobile Hotspots. &lt;/p&gt;

&lt;p&gt;As a solo developer, I built Daphq to solve a personal frustration: the bloated overhead, privacy concerns, and artificial speed limits of conventional HTTP-based or cloud-reliant file-sharing tools. Daphq bypasses the standard Web/REST layer completely, establishing direct, bare-metal &lt;strong&gt;TCP Sockets&lt;/strong&gt; (&lt;code&gt;Socket&lt;/code&gt; &amp;amp; &lt;code&gt;ServerSocket&lt;/code&gt;) with &lt;code&gt;SocketOption.tcpNoDelay&lt;/code&gt; enabled to eliminate protocol latency and push network hardware to its absolute physical limits.&lt;/p&gt;

&lt;p&gt;Built using &lt;strong&gt;Flutter (Dart)&lt;/strong&gt; for seamless cross-platform performance (currently native on Android and Windows), Daphq features a highly decoupled architecture using the &lt;strong&gt;BLoC/Cubit&lt;/strong&gt; pattern, multi-gigabyte memory protection guards, and background network synchronization, and intelligent user guidance. &lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;The entire project is completely open-source and free to review, fork, or run locally:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;🌐 &lt;strong&gt;Official Product Website:&lt;/strong&gt; &lt;a href="https://omarafifi-cse.github.io/daphq/" rel="noopener noreferrer"&gt;omarafifi-cse.github.io/daphq/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;💻 &lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/omarafifi-cse/daphq" rel="noopener noreferrer"&gt;github.com/omarafifi-cse/daphq&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Screenshots in Action
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Android UI Layout&lt;/th&gt;
&lt;th&gt;Windows Desktop Experience&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuhthhu31i9z3r5zp4c2v.png" alt="Android Interface" width="800" height="1666"&gt;&lt;/td&gt;
&lt;td&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6s9qm7a2y59mo7hxic2o.png" alt="Windows Interface" width="799" height="510"&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;em&gt;Clean, robust mobile layout with active background service tracking.&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;Fluid, modern, and highly responsive desktop experience.&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The Comeback Story
&lt;/h2&gt;

&lt;p&gt;Daphq was born under high pressure, but after shipping the bare bones of version &lt;strong&gt;v1.0.0&lt;/strong&gt;, it was essentially abandoned in my local repository directory. The project had immense raw speed potential, but it was plagued by architectural gaps, clunky user workflows, and high-stress bugs that made it unviable for everyday users. &lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;GitHub Finish-Up-A-Thon Challenge&lt;/strong&gt; was the exact catalyst I needed to dust off the codebase and transform it from a fragile command-like utility into a highly polished, resilient consumer application (&lt;code&gt;v2.2.0&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  The Deep Evolution: v1.0.0 vs. v2.2.0
&lt;/h3&gt;

&lt;p&gt;Here is exactly how the architecture and UX matured over the course of this challenge:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Discovery &amp;amp; Connectivity:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Zero automation. Users had to manually look up and type cryptic local IPv4 addresses.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.2.0):&lt;/em&gt; A custom &lt;strong&gt;UDP Auto-Discovery Service&lt;/strong&gt; that actively scans subnets and features an integrated watchdog mechanism to instantly heal connections during IP changes.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;User Interface &amp;amp; Fluidity:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Rigid layouts and main-thread hangs (UI freezing) when selecting massive directories.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.2.0):&lt;/em&gt; A unified dashboard anchored by a premium &lt;strong&gt;"Orbital Radar"&lt;/strong&gt;, coupled with &lt;strong&gt;Non-Blocking Asynchronous UI&lt;/strong&gt;. Directory resolution is now fully offloaded from the main thread, accompanied by a persistent &lt;strong&gt;Transfer History&lt;/strong&gt; system.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Smart User Guidance:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Users often suffered from slow transfers due to ISP router bottlenecks without knowing why.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.2.0):&lt;/em&gt; Integrated a real-time speed monitor that triggers a &lt;strong&gt;Smart Hotspot Guide&lt;/strong&gt; if speeds drop below 2.0 MB/s, guiding users to utilize 5GHz direct hotspots for up to 10x faster speeds.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;Memory Safety &amp;amp; Disk I/O Flow Control:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; High risk of Out-Of-Memory (OOM) crashes when streaming multi-gigabyte files due to unthrottled asynchronous disk reads.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.2.0):&lt;/em&gt; Implemented zero-copy byte slicing (&lt;code&gt;Uint8List.sublistView&lt;/code&gt;) and &lt;strong&gt;Natural Socket Backpressure&lt;/strong&gt; (&lt;code&gt;await socket.flush()&lt;/code&gt;). Daphq now self-throttles to match real-time network speeds, saving physical RAM.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;

&lt;strong&gt;System-Wide Integrations:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Before (v1.0.0):&lt;/em&gt; Isolated sandboxed app.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;After (v2.2.0):&lt;/em&gt; Deployed deep OS hooks, including native &lt;strong&gt;Android Share Menu&lt;/strong&gt; entry, background execution via Android Foreground Services, and a &lt;strong&gt;Windows Context Menu Shell Extension&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  My Experience with GitHub Copilot
&lt;/h2&gt;

&lt;p&gt;As a solo developer, you are the software architect, the UI designer, the QA technician, and the DevOps engineer all at once. Time is your greatest bottleneck. Throughout this sprint, GitHub Copilot didn’t just autocomplete lines of boilerplate—it acted as an incredibly knowledgeable senior engineering peer, unlocking complex architectural problems.&lt;/p&gt;

&lt;p&gt;Here are three distinct breakthroughs where GitHub Copilot completely changed the trajectory of the project:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Solving the Math of the Orbital Radar UI
&lt;/h3&gt;

&lt;p&gt;I wanted the home dashboard to feel alive with an evenly distributed, deterministic "Orbital Radar" circle showing available peer devices. Distributing dynamic widgets symmetrically on a circular plane without them overlapping can quickly become a headache.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; By providing Copilot with my layout boundaries and device state arrays, it instantly mapped out the exact trigonometric distribution math using &lt;code&gt;cos&lt;/code&gt; and &lt;code&gt;sin&lt;/code&gt; over a mapped index. Furthermore, it proactively recommended assigning unique &lt;code&gt;ValueKey&lt;/code&gt;s to the dynamically generated widgets, preventing unnecessary re-paints and maximizing rendering performance on low-end hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. Eliminating the Windows FFI Mutex Deadlock
&lt;/h3&gt;

&lt;p&gt;A critical, highly frustrating platform bug on Windows caused Daphq to accidentally trigger background execution loops whenever a user performed completely unrelated right-click shell actions elsewhere in the OS. Worse, exiting the app caused a stubborn Dart VM deadlock.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; I explained the process conflict to Copilot. It guided me through structuring a clean, platform-specific local session mutex check. When it came to bypassing the Dart VM shutdown hang, Copilot instantly generated the safe native Windows FFI code block to execute a clean &lt;code&gt;ExitProcess&lt;/code&gt; command, killing the deadlocks instantly and safely.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Engineering Flow-Safe Dynamic Streaming Buffer
&lt;/h3&gt;

&lt;p&gt;To stop aggressive disk-read bursts from triggering Out-Of-Memory exceptions, I needed a way to throttle file streams smoothly based on network capacity.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Copilot's Intervention:&lt;/strong&gt; Copilot analyzed my asynchronous data-sync loop and suggested transitioning away from arbitrary chunk delay timers. It helped refactor the code to explicitly await &lt;code&gt;socket.flush()&lt;/code&gt; based on monitored &lt;code&gt;bytesBuffered&lt;/code&gt; thresholds. The result was an automated backpressure loop that scales throughput up or down safely based on real-time network conditions.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Standard path for larger files: stream in chunks&lt;/span&gt;
&lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fileToRead&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;openRead&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="n"&gt;reader&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Transfer Cancelled"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;chunk&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;AppConstants&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;socketFlushThresholdBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Awaited flush: provides backpressure so the disk read loop&lt;/span&gt;
        &lt;span class="c1"&gt;// runs at network speed, not disk speed. Without this, a fast&lt;/span&gt;
        &lt;span class="c1"&gt;// UFS device would read the entire file in &amp;lt;500ms before any&lt;/span&gt;
        &lt;span class="c1"&gt;// onUpdate fires, causing the snapshot/stutter UI bug.&lt;/span&gt;
        &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;socket&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;flush&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
        &lt;span class="n"&gt;bytesBuffered&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_isCancelled&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Transfer Cancelled"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;SocketException&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"reset by peer"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="s"&gt;"Receiver disconnected during transfer."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="k"&gt;rethrow&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// ... UI update logic &lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  The Verdict
&lt;/h2&gt;

&lt;p&gt;Building Daphq independently meant encountering dozens of architectural edge cases. Having GitHub Copilot available to instantly generate platform-specific guards, analyze multi-threaded socket behavior, and handle tedious Win32 registry bindings allowed me to focus on what mattered most: delivering a breathtakingly fast file transfer engine. &lt;/p&gt;

&lt;p&gt;Daphq went from an unpolished repository artifact to a production-grade open-source engine capable of hitting &lt;strong&gt;80-90 MB/s (~93% bandwidth saturation)&lt;/strong&gt; over a standard local Wi-Fi 5 connection. I couldn't be prouder of how this challenge ended.&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>githubchallenge</category>
      <category>flutter</category>
    </item>
  </channel>
</rss>
