Skip to content

EHRS Desktop Application Development & Windows Cross-Compilation Setup Using Tauri v2

Greeshma Kanukunta requested to merge feature/tauri-desktop-setup into develop

Project Overview

The EHRS Desktop Application project involved converting the existing EHRS web platform into a professional cross-platform desktop application using:

  • Tauri v2
  • React + Vite + TypeScript
  • FastAPI
  • PostgreSQL
  • Docker

The primary objective was to create a stable native desktop experience for Ubuntu Linux while also enabling Windows cross-compilation support from the same Ubuntu development environment without disturbing the Linux workflow.


Existing Architecture

Frontend

  • React
  • Vite
  • TypeScript
  • Tailwind CSS

Backend

  • FastAPI
  • PostgreSQL
  • Docker
  • JWT Authentication

Final Architecture

Tauri Desktop Application

React + Vite Frontend

FastAPI Backend APIs

PostgreSQL Database

Developer Responsibility

👨💻 Sole Developer — Full Stack Desktop Application Development

Frontend & Desktop Integration

  • Tauri v2 setup
  • Ubuntu desktop integration
  • React + Vite integration
  • Desktop UI optimization
  • Native desktop notifications
  • File upload/download support
  • Packaging and distribution
  • Windows cross-compilation support

Backend Integration

  • FastAPI API integration
  • JWT authentication handling
  • PostgreSQL connectivity
  • Docker environment setup
  • Session management

Ubuntu Desktop Application Development

DAY 1 — Tauri Setup & Backend Integration

Tasks

  • Installed Rust and Tauri dependencies on Ubuntu
  • Initialized Tauri v2 project
  • Integrated React + Vite frontend with Tauri
  • Configured desktop application window
  • Ran FastAPI backend using Docker
  • Connected frontend to backend APIs
  • Verified API communication

Output

EHRS frontend launches as Ubuntu desktop application

Backend APIs connected successfully


DAY 2 — Authentication & Core Features

Tasks

  • Implemented login screen
  • Configured JWT authentication flow
  • Added protected routes
  • Enabled persistent user sessions
  • Implemented desktop notifications
  • Secured API communication

Output

Secure authentication system functioning

Desktop application communicates securely with backend


DAY 3 — Desktop Optimization & Native Features

Tasks

  • Optimized layouts for desktop usage
  • Improved window sizing and responsiveness
  • Added Ubuntu/Linux application icons
  • Implemented file upload/download functionality
  • Added export support
  • Improved application performance

Output

Desktop-optimized EHRS workflow

Native Ubuntu desktop functionality integrated


DAY 4 — Packaging, Testing & Final Release

Packaging

Generated Ubuntu application packages:

  • .AppImage
  • .deb

Testing

  • Login testing
  • API integration testing
  • File handling testing
  • Ubuntu compatibility testing

Final Polish

  • Fixed UI and functional bugs
  • Generated production build
  • Prepared project documentation

Output

Production-ready EHRS Ubuntu Desktop MVP


Windows Cross-Compilation Setup (Ubuntu → Windows)

Objective

Added Windows cross-compilation support to the same:

feature/tauri-desktop-setup

branch while ensuring the existing Ubuntu/Linux setup remained stable and untouched.

The implementation allows building Windows binaries (.exe) directly from Ubuntu Linux.


Windows Cross-Compilation Setup

Step 1 — Install Windows Rust Target

rustup target add x86_64-pc-windows-gnu

Step 2 — Install MinGW Compiler

sudo apt update

sudo apt install gcc-mingw-w64

Step 3 — Verify MinGW Installation

x86_64-w64-mingw32-gcc --version

Step 4 — Configure Windows Target

Created:

src-tauri/.cargo/config.toml

Configuration

[target.x86_64-pc-windows-gnu]
linker = "x86_64-w64-mingw32-gcc"

rustflags = [
  "-Clink-arg=-Wl,--exclude-all-symbols"
]

Technical Issues Resolved

Export Ordinal Limit Error

Error

export ordinal too large: 94420

Solution

Applied:

-Wl,--exclude-all-symbols

to reduce exported symbol count during Windows linking.


Cargo Metadata & Workspace Errors

Error

failed to run 'cargo metadata'
No such file or directory (os error 2)

Cause

Tauri commands were executed inside:

src-tauri

instead of the frontend root directory.

Solution

Always run Tauri commands from:

ehrs-frontend-vite

package.json Script Fix

Correct Configuration

"scripts": {
  "dev": "vite",
  "build": "vite build",
  "preview": "vite preview",
  "tauri": "bunx tauri"
}

Cargo Environment Fix

Solution

source $HOME/.cargo/env

Persisted environment:

echo 'source $HOME/.cargo/env' >> ~/.bashrc

Cargo Optimization

File

src-tauri/Cargo.toml

Added

[profile.release]
panic = "abort"

Benefits

  • Reduced binary size
  • Improved Windows linking stability

Final Workflow Commands

Backend

cd ~/ehrsbackend/ehrs-fastapi

docker compose up --build

Frontend

Go to Frontend Root

cd ~/ehrsfrontend/ehrs-frontend-vite

Install Dependencies

bun install

Load Rust Environment

source $HOME/.cargo/env

Linux Workflow

Run Ubuntu Desktop App

bun run tauri dev

Build Ubuntu Desktop App

bun run tauri build

Generated Outputs

src-tauri/target/release/bundle/

Contains:

  • .AppImage
  • .deb

Windows Workflow

Build Windows Desktop Application

bun run tauri build -- --target x86_64-pc-windows-gnu

Generated Output

src-tauri/target/x86_64-pc-windows-gnu/release/

Contains:

  • .exe
  • Windows binaries

Linux Stability Assurance

The Windows setup was implemented in a way that:

Does NOT disturb Ubuntu/Linux workflow

Does NOT affect backend APIs

Keeps Linux development stable

Allows Linux and Windows support in the same branch


Final Deliverables

Ubuntu Deliverables

Ubuntu Desktop Application

FastAPI Backend Integration

PostgreSQL Integration

Secure JWT Authentication

Native Desktop Notifications

File Upload/Download Support

.AppImage Package

.deb Package


Windows Deliverables

Windows Cross-Compilation Support

Windows .exe Build Support

Shared Cross-Platform Codebase


Final Tech Stack

Desktop

  • Tauri v2

Frontend

  • React
  • Vite
  • TypeScript
  • Tailwind CSS
  • Bun

Backend

  • FastAPI

Database

  • PostgreSQL

Containerization

  • Docker

Conclusion

Successfully transformed the EHRS web platform into a professional cross-platform desktop application with:

  • Stable Ubuntu desktop support
  • Windows cross-compilation support
  • Integrated FastAPI backend
  • PostgreSQL connectivity
  • Native desktop functionality
  • Secure authentication workflow

while maintaining Linux workflow stability within the same development branch.

Issue Closes: #341

Edited by Greeshma Kanukunta

Merge request reports

Loading