Desktop app

Brisa Desktop Applications (Tauri integration)

This documentation outlines the process of building a Brisa desktop application using Tauri. Tauri is seamlessly integrated into Brisa by configuring the brisa.config.ts file as follows:

import type { Configuration } from "brisa";

export default {
  output: "desktop",
} satisfies Configuration;

Prerequisits: you need to have cargo installed.

To initialize the development environment, run the following command:

brisa dev

Executing this command launches a desktop app, integrating your web application. The development environment supports hot-reloading, mirroring the behavior of a browser. Notably, the integration creates a src-tauri folder, representing the fusion of Brisa with Tauri.

Customizing the window size, icons, title, and other attributes can be achieved by modifying the src-tauri/tauri.conf.json file.

Explore Tauri's configuration fields here.

Building your Brisa Desktop App

When the output: "desktop" configuration is set in your brisa.config.ts, execute the following command to build the application:

bun run build

This command generates the corresponding executables tailored to your operating system. The supported platforms include:

The build behavior is akin to static export, as there won't be an active server, and the desktop app is created with the bundled assets (HTML, CSS, JS).

Pure server-related functionalities, such as API endpoints and server interactions, will not function at runtime. All interactions should be encapsulated within web components.

Cross-Platform Build

Tauri relies on native libraries for each OS, preventing a direct cross-platform build. A cross-platform build can be achieved through a matrix-based pipeline.

# ...
strategy:
  fail-fast: false
  matrix:
    platform: [macos-latest, ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.platform }}
# ...

Here's the full example YAML configuration for GitHub Actions.

The GitHub Token is automatically issued by GitHub for each workflow run without further configuration, ensuring no risk of secret leakage.

For more details, refer to the Tauri documentation on cross-platform builds.