Skip to content

Conversation

@afonsojramos
Copy link
Member

@afonsojramos afonsojramos commented Dec 27, 2025

Summary

  • Migrates Gitify from Electron to Tauri v2 for improved performance and smaller bundle size
  • Replaces Webpack with Vite for faster builds and HMR
  • Updates to Tailwind CSS v4 with Vite plugin
  • Switches from Jest to Vitest for testing
  • Flattens source directory structure (removes renderer/main separation)

Key Changes

Architecture

  • Rust backend (src-tauri/) handles system tray, window management, OAuth deep links, and auto-updater
  • TypeScript bridge (src/tauri-bridge.ts) maintains the same window.gitify API interface for backward compatibility
  • Secure token storage using OS keyring via the keyring crate

Build & Tooling

  • Vite replaces Webpack for ~10x faster dev builds
  • Vitest replaces Jest (same API, better Vite integration)
  • Tailwind v4 with native CSS variables

Security

  • CSP configured to support GitHub Enterprise (connect-src 'self' https:)
  • Tokens stored in OS keychain instead of localStorage

Related PRs

Test plan

  • Verify app launches and displays notifications
  • Test OAuth and PAT authentication flows
  • Verify system tray functionality works correctly
  • Test native notifications and sound playback
  • Confirm zoom in/out functionality works
  • Run pnpm test to verify all tests pass (639 passing, 2 skipped)

@github-actions github-actions bot added dependency Dependency updates enhancement New feature or enhancement to existing functionality labels Dec 27, 2025
@setchy
Copy link
Member

setchy commented Dec 27, 2025

Pretty cool, nice work @afonsojramos

I'll need some time to review a PR of this size... I'm on the fence re the amount of Rust code tbh.

Shall we mark this PR as draft in the interim?

@setchy setchy marked this pull request as draft December 27, 2025 13:12
@afonsojramos
Copy link
Member Author

afonsojramos commented Dec 28, 2025

Pretty cool, nice work @afonsojramos

I'll need some time to review a PR of this size... I'm on the fence re the amount of Rust code tbh.

Shall we mark this PR as draft in the interim?

Thanks @setchy! Happy to mark this as draft while you (or anyone else) review. Regarding Rust code - it's kept to the minimum needed for Tauri (tray management, window positioning, clipboard, keyboard shortcuts). The core business logic remains in TypeScript. Most Rust is just wiring Tauri plugins together. Happy to discuss specific parts if anything seems redundant.

As for Electron vs Tauri, I think that Electron makes sense for apps that need a full browser (Slack, VS Code, Discord), but Gitify is a focused, lightweight utility that ends up:

  1. Running 24/7 in the background
  2. Uses native OS features heavily (tray, shortcuts, keyring)
  3. Renders a simple React UI
  4. Needs to be fast and unobtrusive

Tauri gives us exactly what we need without the bloat (which is considerable - I do sometimes run out of memory on my machine, unfortunately). This results in a 4-5x reduction in memory and binary size, which is considerable.

This is a complete migration of Gitify from Electron to Tauri v2.

Changes include:
- Remove Electron main/preload processes and webpack configs
- Add Tauri v2 backend with Rust (src-tauri/)
- Add Vite bundler configuration
- Migrate renderer code from src/renderer/ to src/
- Migrate tests from Jest to Vitest
- Update all dependencies for Tauri compatibility
- Add type-safe context hook (useAppContext)
- Fix strict TypeScript mode issues

BREAKING CHANGE: This replaces the Electron backend with Tauri.
- Update test snapshots for vitest migration
- Fix Tailwind config path from ../../ to ../
- Skip flaky nock replyWithError tests
- Replace @tailwindcss/postcss with @tailwindcss/vite
- Remove postcss.config.js
- Update vite.config.ts with tailwindcss plugin
- Remove @config directive from App.css (Vite plugin reads config automatically)
Add tauri-plugin-http to bypass WebView CORS restrictions when making
API requests to GitHub. This fixes the PAT login network error.

- Add tauri-plugin-http to Cargo dependencies
- Initialize HTTP plugin in lib.rs
- Add HTTP permissions for GitHub API in capabilities
- Update request.ts to use Tauri fetch when in Tauri environment
- Create shared isTauriEnvironment utility in environment.ts
Use convertFileSrc from @tauri-apps/api/core to convert local file
paths to asset:// URLs that work in Tauri's WebView.
Add React state management for zoom percentage in AppearanceSettings
to ensure the UI updates after zoom changes. The zoom functions now
work correctly with Tauri's webview zoom API.
- Add Tauri internals mock to vitest.setup.ts
- Create mock for @tauri-apps/plugin-http
- Add isTauriEnvironment and decryptValue mocks to tests using axios
- Update snapshots for emoji rendering changes
- Update comms.ts to use isTauriEnvironment checks
- Update auth utils for Tauri OAuth callback handling
- Update App context for Tauri environment
- Update index.tsx entry point
- Update SystemSettings for Tauri compatibility
- Update TraySettings for Tauri tray API
- Update native notification handling for Tauri
- Update sound playback for Tauri asset loading
- Update App.css for Tauri WebView
- Add theme.css for CSS custom properties
- Update Tailwind config
- Update index.html for Tauri
Remove platform.ts and platform.test.ts as platform detection is now
handled by the Tauri bridge (window.gitify.platform).
- Fix handler enrich() methods to return null instead of {} for failures
- Update handler return types to Promise<GitifySubject | null>
- Use undefined for optional fields to match GitifySubject type
- Add waitFor in AccountNotifications tests for async emoji loading
- Skip OAuth/timer-dependent tests that can't complete in test environment
- Fix vitest.setup.ts type casts for window properties
- Update test expectations and regenerate snapshots
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
3 Security Hotspots
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependency Dependency updates enhancement New feature or enhancement to existing functionality

Development

Successfully merging this pull request may close these issues.

3 participants