Sub-Millisecond Image Delivery: The Engineering Behind CoreReflect

● APR 27, 2026 8 min read

In the modern web, we’ve outsourced too much of our infrastructure. Developers have become accustomed to paying “convenience taxes” to third-party providers for tasks that should be handled at the edge of our own servers.

When I founded Nefsol, I set a rule: our internal systems must prioritize performance and data sovereignty. We needed an image hosting solution that didn’t just store files, but functioned as a high-performance CDN capable of satisfying strict social media scrapers and sub-millisecond delivery requirements.

Existing open-source tools were either too bloated or ignored the nuances of HTTP handshaking. So, I built CoreReflect.

1. Choosing the Database: Why SQLite?

The first decision was the data layer. Most SaaS starters default to PostgreSQL or MongoDB. For a high-performance image metadata store, that’s unnecessary overhead.

I chose better-sqlite3 running in WAL (Write-Ahead Logging) mode. By keeping the database on the same disk as the binary files, we eliminated network latency between the app and the DB. The result is metadata retrieval that is consistently under 0.5ms—faster than most third-party APIs can even acknowledge a request.

2. The Stream vs. Buffer Battle

A common mistake in image processing is loading the entire file into memory (Buffers). If 100 users upload a 10MB file simultaneously, your Node.js process will crash with an “Out of Memory” error.

In CoreReflect, I implemented a fully streamed pipeline using Fastify-Multipart and Sharp. The binary data flows directly from the network socket, through the processing engine, and onto the disk. Memory usage stays flat, regardless of file size. This is the difference between a “script” and “infrastructure.”

3. Solving the Instagram Scraper Handshake

The hardest problem we faced wasn’t the code—it was the scrapers.

Meta’s scrapers (Instagram, Facebook) are notoriously strict. While building CoreReflect, we realized they were rejecting our URIs. Through deep-level packet inspection and header analysis, I identified three “silent killers”:

  1. CORS Mismatch: You cannot send Access-Control-Allow-Origin: * alongside Allow-Credentials: true.
  2. Range Headers: Scrapers probe for HTTP 206 Partial Content to verify file signatures.
  3. Encoding: URLs must be strictly US-ASCII.

I refactored our delivery engine using Plugin Encapsulation. We isolated the “Clean Zone” for image delivery, stripping every non-essential header and ensuring perfect IETF compliance. We didn’t just fix the bug; we optimized the handshake.

4. The Nefsol Philosophy

CoreReflect is an open-source reflection of how we work at Nefsol. We don’t believe in “black box” engineering. We believe in lean, functional code that gives developers total control over their assets.

We implemented a Local Vault system for API keys. Instead of the server re-exposing your secrets, your browser acts as the secure store. It’s a decentralized approach to security that keeps the backend simple and the developer in control.

Let’s Talk Infrastructure

I open-sourced CoreReflect because I believe the community deserves better self-hosted tools. But more than that, I want to show you the level of technical integrity we bring to every project at Nefsol.

If you’re struggling with infrastructure performance, or if you’re looking for a team that understands the difference between “working code” and “optimized systems,” let’s connect. I’m always open to discussing high-performance Node.js architecture or custom media solutions.

Connect with me:

Let’s stop settling for “good enough” and start building for performance.