Skip to main content

Overview

The Olis Desktop Client is an Electron-based application that provides a native desktop experience for the Olis AI assistant. It combines Electron’s native capabilities with Next.js for a modern React-based UI.

Technology Stack

Electron

Native desktop wrapper for cross-platform support

Next.js 14

React framework with App Router and static export

TypeScript

Type-safe development across the entire stack

Tailwind CSS

Utility-first CSS framework for styling

Project Structure

Development Setup

Prerequisites

  • Node.js 18+
  • pnpm 9.15.4+
  • Rust (for native sidecar)

Installation

1

Navigate to the client directory

2

Install dependencies

3

Build native sidecar

This compiles the Rust native module and copies it to native/sidecar/index.node.
4

Start development server

This starts:
  1. Next.js dev server on http://localhost:3000
  2. Electron app that loads the dev server

Available Scripts

Building for Production

1

Build the renderer

Creates a static Next.js export in the out/ directory with:
  • assetPrefix: "./" for relative paths
  • trailingSlash: true for file:// protocol
  • output: "export" for static generation
2

Compile the main process

Compiles TypeScript to JavaScript in dist-electron/.
3

Package the application

Uses electron-builder to create installers in release/:
  • Windows: NSIS installer (.exe)
  • macOS: DMG and ZIP
  • Linux: AppImage, Snap, DEB
Windows Note: Stop all running Electron instances before packaging. Running instances can lock keytar.node and cause EPERM errors during the build.

Configuration

Environment Variables

Create a .env file in the app root:
For production builds, place .env.production in the resources/ directory.

Next.js Configuration

The next.config.mjs is optimized for Electron:

Electron Builder Configuration

The electron-builder.json5 defines package settings:

Features

Intent Detection

The desktop client supports multiple intent detection backends:
Chooses the best option based on hardware and configuration:
  1. SLM if available and hardware supports it
  2. LLM if remote service is configured
  3. NLP as fallback

Document Context

Users can configure a document folder for context:
Supported formats:
  • .txt - Plain text
  • .md - Markdown
  • .json - JSON data
  • .csv - CSV files
Documents are automatically loaded and used as context for queries.

Settings Interface

The settings interface provides three main sections:

General

  • Theme selection
  • Language preferences
  • Default behaviors
  • Notification settings

Integrations

  • API connections
  • Third-party services
  • OAuth configurations
  • Webhook settings

Security

  • Authentication
  • Encryption settings
  • Privacy controls
  • Data retention

Native Sidecar (Rust)

The native sidecar provides high-performance native operations:

Building the Sidecar

Using in Electron

Troubleshooting

Problem: Errors building Rust sidecarSolution:
Problem: EPERM error with keytar.nodeSolution:
  1. Close all Electron instances
  2. Kill any Node processes: taskkill /F /IM electron.exe (Windows)
  3. Run pnpm run install-app-deps
  4. Try packaging again: pnpm run package
Problem: Electron opens but shows blank windowSolution:
  1. Ensure Next.js dev server is running on port 3000
  2. Check electron/main.ts loads correct URL
  3. Open DevTools: Ctrl+Shift+I (Windows) or Cmd+Option+I (Mac)
  4. Check console for errors
Problem: PowerShell blocks script executionSolution:

Best Practices

Development

  • Use electron:dev for hot reloading
  • Test on all target platforms
  • Keep native modules updated
  • Profile performance regularly

Production

  • Test packaged builds before release
  • Code sign applications
  • Use auto-update mechanism
  • Monitor crash reports

Security

  • Enable context isolation
  • Disable Node integration in renderer
  • Validate all IPC messages
  • Use secure storage (keytar)

Performance

  • Lazy load components
  • Optimize bundle size
  • Cache expensive operations
  • Use native modules wisely

Next Steps

API Server

Learn about the backend API

Intent Detection

Deep dive into intent detection