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
Build native sidecar
native/sidecar/index.node.Available Scripts
Development Scripts
Development Scripts
Production Build Scripts
Production Build Scripts
Building for Production
Build the renderer
out/ directory with:assetPrefix: "./"for relative pathstrailingSlash: truefor file:// protocoloutput: "export"for static generation
Configuration
Environment Variables
Create a.env file in the app root:
.env.production in the resources/ directory.
Next.js Configuration
Thenext.config.mjs is optimized for Electron:
Electron Builder Configuration
Theelectron-builder.json5 defines package settings:
Features
Intent Detection
The desktop client supports multiple intent detection backends:- Automatic
- SLM (Local)
- LLM (Remote)
- NLP (Fallback)
Chooses the best option based on hardware and configuration:
- SLM if available and hardware supports it
- LLM if remote service is configured
- NLP as fallback
Document Context
Users can configure a document folder for context:.txt- Plain text.md- Markdown.json- JSON data.csv- CSV files
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
Native Module Build Failures
Native Module Build Failures
Problem: Errors building Rust sidecarSolution:
Electron Packaging Errors
Electron Packaging Errors
Problem:
EPERM error with keytar.nodeSolution:- Close all Electron instances
- Kill any Node processes:
taskkill /F /IM electron.exe(Windows) - Run
pnpm run install-app-deps - Try packaging again:
pnpm run package
Dev Server Not Loading
Dev Server Not Loading
Problem: Electron opens but shows blank windowSolution:
- Ensure Next.js dev server is running on port 3000
- Check
electron/main.tsloads correct URL - Open DevTools:
Ctrl+Shift+I(Windows) orCmd+Option+I(Mac) - Check console for errors
PowerShell Script Execution
PowerShell Script Execution
Problem: PowerShell blocks script executionSolution:
Best Practices
Development
- Use
electron:devfor 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