Skip to content

perf(packaging): reduce production bundle size by scoping googleapis / @googleapis/drive #417

Closed

Description

@khaira777

Problem Description

During build artifact analysis of the cross-platform packaging workflow, uncompressed bundle sizes across platforms were measured:

  • macOS (Flo Cafe.app): ~377–379 MB
  • Windows (win-unpacked): ~166 MB
  • Linux (linux-unpacked): ~147 MB

A disk usage audit of production node_modules packaged into app.asar revealed that googleapis alone accounts for 202 MB (out of ~760 MB total node_modules):

Package Size on Disk Role in FloCafe
googleapis 202 MB Google Drive backups (main/services/google-drive.ts)
better-sqlite3 26 MB SQLite offline DB engine (required)
@whiskeysockets/baileys 14 MB WhatsApp receipt notifications (required)
decimal.js / bcryptjs / pino / libphonenumber-js ~5 MB Core utilities

Root Cause

The monolithic googleapis package includes generated API definitions and schemas for 150+ Google Cloud & Workspace services (BigQuery, YouTube, Compute Engine, AI Platform, etc.).

FloCafe currently only uses:

  1. Google Drive API (v3) for encrypted backup upload and restoration (main/services/google-drive.ts)
  2. OAuth2 client for user authentication and token refresh (main/services/google-drive.ts)

Proposed Remediation

  1. Option A (Recommended): Replace googleapis dependency with targeted scoped packages:
    • @googleapis/drive (or googleapis/build/src/apis/drive)
    • google-auth-library (already bundled as standard sub-dependency)
  2. Option B (Packaging Filter): Configure package.json build.files / electron-builder ignore rules to exclude unused googleapis/build/src/apis/* subfolders other than drive and oauth2.

Expected Impact

  • ~190 MB reduction in unpacked application footprint.
  • Faster electron packaging times in CI and release workflows.
  • Smaller download/installation footprint for end users.

Activity

  1. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Research is underway. The implementation will follow the scout recommendation through a no-mistakes-validated PR, with dependency/runtime compatibility, package footprint, and Google Drive backup/restore behavior covered before merge.

  2. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Implementation is ready in #493. The no-mistakes run is green with 13 checks passed. It replaces the monolithic googleapis dependency with @googleapis/drive, preserves OAuth/token/backup behavior, and adds offline API-contract and refreshed-token regression coverage.

  3. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Completed: #493 is now squash-merged. FloCafe now uses the scoped @googleapis/drive package while preserving OAuth/token refresh, Drive backup/retention, local restore boundaries, and the added offline contract coverage.

  4. khaira777 commented on Aug 23, 2026

    @khaira777
    ContributorAuthor

    Completed by #493 (squash-merged). FloCafe now uses the scoped @googleapis/drive package, preserving OAuth/token refresh, Drive backup/retention, local restore boundaries, and offline/refreshed-token regression coverage.

  5. self-assigned this
    on Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions