AM
Ayoub Mouakkir
LaynFlow — Building a Privacy-First, On-Device File Compression App
flutterdartiosandroidmacosswiftkotlin

LaynFlow — Building a Privacy-First, On-Device File Compression App

Project Details

LaynFlow — Building a Privacy-First, On-Device File Compression App

LaynFlow is a privacy-first file optimization app built to compress PDFs and images without uploading them to a server.

Designed and developed by AMAFsoft, LaynFlow processes files directly on the user’s device, combining Flutter with native iOS and macOS technologies to deliver a fast, offline-first compression workflow.

Reduce size. Keep quality. Stay in flow.

Download LaynFlow

Experience compressing PDF files and images directly on your device, without the need to upload your files to an external server.

Reduce size. Maintain quality. Stay in the flow.


Want to learn more about how it was built?

Read the case study to learn about the technical architecture, local file processing, and using Flutter with native technologies to build a privacy-first app.

The Idea

File compression is usually presented as a simple problem:

Select a file → upload it → compress it → download it.

The problem is what happens in between.

Uploading a document means sending it to a remote service. For ordinary images, that may be acceptable. But PDFs can contain contracts, invoices, financial documents, identification documents, business information, or other private material.

I wanted a different approach:

What if compression didn’t require uploading the file anywhere at all?

That question became the foundation of LaynFlow.


A Different Architecture

LaynFlow has no compression backend.

There is no file-upload API sitting between the user and the compression engine. The application performs its work locally and saves the resulting file back to the device.

The high-level architecture looks like this:

User selects files
       │
       ▼
   File detection
       │
       ├── JPG / PNG / WebP
       │       ↓
       │   Dart isolate
       │       ↓
       │   Decode → Compress → Encode
       │
       ├── HEIC / HEIF
       │       ↓
       │   Native ImageIO
       │
       └── PDF
               ↓
           Native PDFKit
               ↓
        Render → Compress → Write
       │
       ▼
   Size validation
       │
       ▼
   Save locally

This architecture also means the application can work without an internet connection.

For a file utility, that is an important property rather than simply a technical novelty.


Flutter Where It Makes Sense, Native APIs Where They Matter

LaynFlow is built with Flutter, which provides the application UI, navigation, state management and cross-platform foundation.

The stack includes:

  • Flutter

  • Dart

  • Riverpod

  • GoRouter

  • RevenueCat

  • Native iOS/macOS APIs

  • Firebase Analytics

  • Firebase Crashlytics

But the goal wasn’t to force every part of the application through Flutter.

Compression is exactly the kind of area where native platform capabilities can provide important advantages.

LaynFlow therefore uses Flutter for the application layer while bridging to native technologies when the platform provides a better tool for the job.

For example, HEIC/HEIF processing on Apple platforms uses ImageIO, while PDF processing uses PDFKit.

This creates a hybrid architecture:

Flutter
   │
   ├── UI
   ├── Navigation
   ├── State
   ├── Product logic
   └── Subscription management
          │
          ▼
     Method Channels
          │
          ├── ImageIO
          └── PDFKit

The result is a cross-platform application without sacrificing access to important native capabilities.


Compression Without Blocking the UI

Compression can be computationally expensive, particularly when processing large images or documents.

A utility application should not become unresponsive simply because the user selected a large file.

For standard image formats such as JPG, PNG and WebP, LaynFlow performs processing in background Dart isolates.

Conceptually:

Main Isolate
     │
     │  compression job
     ▼
Background Isolate
     │
     ├── Decode
     ├── Process
     ├── Encode
     └── Return result

This keeps heavy processing away from the main UI execution path.

For Apple-specific formats and PDFs, native APIs are used through platform channels.


PDFs Are a Different Problem

Image compression is relatively straightforward compared with PDF optimization.

A PDF is a document container rather than simply a single bitmap.

LaynFlow therefore uses a native PDF pipeline on Apple platforms.

Pages are rendered at a controlled resolution, with a maximum edge size, and then written into a new PDF using compressed image representations.

The pipeline is designed around memory safety:

PDF
 │
 ├── Page 1 → Render → Compress → Write
 ├── Page 2 → Render → Compress → Write
 ├── Page 3 → Render → Compress → Write
 └── ...

Rather than attempting to keep an entire large document in memory at once, the implementation uses streaming disk writes through the native PDF pipeline.

This becomes especially important when users process large documents on devices with limited available memory.


The “Already Optimized” Problem

One subtle problem with compression tools is that compression does not always make a file smaller.

For example, a JPEG that has already been aggressively compressed may become larger if it is decoded and encoded again.

A naive compressor might simply replace the original file with the new output.

LaynFlow doesn’t.

After compression, the application compares the resulting file size with the original:

Output < Original?
       │
   ┌───┴───┐
  YES      NO
   │        │
   ▼        ▼
Accept    Discard
output    output
   │        │
   ▼        ▼
Save      Keep original
          "Already optimized"

If the resulting file isn’t smaller, the generated output is discarded.

The original file remains untouched.

This is a small implementation detail, but it reflects an important product principle:

A compression tool should never make the user’s file worse just because compression was requested.


Privacy by Architecture

Privacy is not implemented as a settings-page checkbox in LaynFlow.

It is built into the architecture.

The application does not need to upload the user’s files to a compression server because there is no compression server.

That means the core workflow is:

File
 ↓
Device memory / local processing
 ↓
Compressed file
 ↓
Local storage

Rather than:

File
 ↓
Internet
 ↓
Remote server
 ↓
Processing
 ↓
Internet
 ↓
Device

This also eliminates the need for users to create an account simply to compress a document.


A Simple Product Model

LaynFlow uses an accountless Free/Pro model.

The Free tier is intentionally useful rather than being a trial disguised as a product.

Free users can compress files individually and use the standard quality presets.

Pro unlocks workflow-oriented features such as:

  • Batch processing

  • Larger files

  • Custom quality control

  • Metadata controls

  • Format conversion

The idea is simple:

The basic utility should remain useful. Pro removes friction for people who use it heavily.

LaynFlow also offers a one-time Lifetime purchase alongside subscription options.


Desktop Is More Than a Larger Phone

The desktop experience was designed around desktop workflows rather than simply scaling the mobile interface.

On macOS, LaynFlow supports integrations such as:

  • Finder file selection

  • Drag-and-drop

  • Desktop drop zones

  • Native file saving

  • Finder reveal

  • ZIP export

This allows the application to fit naturally into a workflow such as:

Finder
  ↓
Drag files into LaynFlow
  ↓
Batch compression
  ↓
ZIP / Save
  ↓
Continue working

The objective is to make compression feel like a normal desktop utility rather than a mobile application running on a larger screen.


Why There Is No Backend

A backend could have simplified some aspects of the architecture.

Centralized processing could make it easier to add certain compression engines or manage processing workloads.

But it would introduce other costs:

  • File uploads

  • Storage considerations

  • Server infrastructure

  • Bandwidth costs

  • Data retention concerns

  • Authentication

  • Privacy considerations

  • Network dependency

For LaynFlow, those trade-offs weren’t necessary.

The product is fundamentally a file utility.

The user’s file already exists on their device.

So the simplest place to process it is often the same place it already is.


The Engineering Challenge

The most interesting part of LaynFlow wasn’t creating a button that says “Compress.”

The challenge was building a system that could make compression:

Fast.

Predictable.

Memory-conscious.

Offline.

Cross-platform.

Safe for the original file.

And simple enough that the user doesn’t need to understand any of the underlying technology.

That required combining Flutter’s cross-platform capabilities with native platform APIs rather than treating the application as a purely Flutter-only project.


The Result

LaynFlow turns a technically complex process into a simple workflow:

Select
   ↓
Compress
   ↓
Save

Underneath that simple interface is a system combining:

  • Flutter

  • Dart isolates

  • native ImageIO

  • PDFKit

  • MethodChannels

  • streaming PDF generation

  • local file processing

  • RevenueCat entitlement verification

  • desktop integrations

  • memory-conscious processing

But users don’t need to see any of that.

They simply get a smaller file.

And their original file never needed to leave their device.


LaynFlow

PDF & Image Compression — 100% On-Device

Reduce size. Keep quality. Stay in flow.

Platforms: iOS · macOS · Android
Built with: Flutter · Dart · Native Apple APIs
Developed by: AMAFsoft

Next Step

Turn your idea into a production-ready experience

If this project direction matches your goals, let's scope your requirements and move quickly to delivery.

Testimonials

"Superb work by Ayoub Mouakkir on my site i Fix Smart Pro! A team that is attentive, responsive, and highly competent. If you are looking for quality for your web project, go for it without hesitation."

I
IDRISSI MOULAY ABDELAZIZ
Founder

"I had the honor of working with Ayoub on several strategic projects, and he was always a reliable partner. He stands out with a clear technological vision and speed in execution without compromising quality, in addition to a creative sense in finding innovative solutions to any challenges. His ability to solve problems efficiently, along with his continuous and unhesitant collaboration, made every experience working with him smooth and successful. I strongly recommend him to anyone looking for a serious, committed technical partner capable of bringing real value to projects."

I
Iman Al-Hajri
Executive Director

"I worked with Ayoub and he was extremely professional. He stands out for his speed in execution, precise error correction, and openness to feedback and improvements. He has a strong creative sense and always delivers practical and smart solutions, which makes the implementation smooth and results in a stable website with an elegant interface and an excellent user experience. I highly recommend working with him for his seriousness and efficiency."

S
Souhail Douimi
Co-founder