Files
new-api-custom/electron/README.md
T
Codex bb7968b612
Publish Docker image (Multi-arch) / Build & push (amd64) (push) Failing after 9m20s
Release (Linux, macOS, Windows) / Linux Release (push) Failing after 55m7s
Publish Docker image (Multi-arch) / Build & push (arm64) (push) Canceled after 0s
Release (Linux, macOS, Windows) / macOS Release (push) Canceled after 0s
Release (Linux, macOS, Windows) / Windows Release (push) Canceled after 0s
Publish Docker image (Multi-arch) / Create multi-arch manifests (push) Canceled after 0s
feat: publish v1.0.0-rc.36-custom.1
2026-09-11 05:07:48 +08:00

1.9 KiB
Vendored

New API Electron Desktop App

This directory contains the Electron wrapper for New API, providing a native desktop application with system tray support for Windows, macOS, and Linux.

Prerequisites

1. Go Binary (Required)

The Electron app requires the compiled Go binary to function. You have two options:

Option A: Use existing binary (without Go installed)

# If you have a pre-built binary (e.g., new-api-macos)
cp ../new-api-macos ../new-api

Option B: Build from source (requires Go) TODO

2. Electron Dependencies

cd electron
npm install

Development

Start the backend, the frontend, and Electron in separate terminals:

# Repository root
go run main.go

# Repository root
make dev-web

# electron/
npm run dev-app

This will:

  • Use the Go backend on port 3000
  • Use the Rsbuild frontend development server on port 5173
  • Open an Electron window with DevTools enabled
  • Create a system tray icon (menu bar on macOS)
  • Store database in ../data/new-api.db

Building for Production

Quick Build

# From electron/, build the frontend, Go binary, and desktop package
./build.sh

# Or package an existing binary for the current platform
npm run build

# Platform-specific builds
npm run build:mac    # Creates .dmg and .zip
npm run build:win    # Creates .exe installer
npm run build:linux  # Creates .AppImage and .deb

Build Output

  • Built applications are in electron/dist/
  • macOS: .dmg (installer) and .zip (portable)
  • Windows: .exe (installer) and portable exe
  • Linux: .AppImage and .deb

Configuration

Port

Default port is 3000. To change, edit main.js:

const PORT = 3000; // Change to desired port

Database Location

  • Development: ../data/new-api.db (project directory)
  • Production:
    • macOS: ~/Library/Application Support/New API/data/
    • Windows: %APPDATA%/New API/data/
    • Linux: ~/.config/New API/data/