🚧 VeloxKit is pre-release software. APIs may change before v1.0. Get started →
Documentation
Guides
Auto-Updater

Auto-Updater Stable

VeloxKit's built-in updater ships updates via GitHub Releases. No server infrastructure required — publish a release and your app finds it automatically.

Requires capability: "updater"

Import

import { updater } from 'veloxkit'

Check for updates

const result = await updater.check('your-org', 'your-repo', '1.0.0')
 
if (result.hasUpdate) {
  console.log(`Update available: ${result.latestVersion}`)
  console.log(result.body)   // release notes
}

updater.check(owner, repo, currentVersion){ hasUpdate: boolean, latestVersion: string, body: string }

Compares the current version against the latest GitHub Release tag. Returns immediately — no download.

Download and install

const result = await updater.update('your-org', 'your-repo', 'my-app', '1.0.0')
 
if (result.updated) {
  console.log(`Updated to ${result.latestVersion}`)
  // Prompt user to relaunch
}

updater.update(owner, repo, binName, currentVersion){ updated: boolean, latestVersion: string }

Downloads the matching release asset for the current platform, replaces the binary, and returns. The app must be relaunched to run the new version.

binName must match the asset filename prefix in your GitHub Release. For a release with assets my-app-windows.exe, my-app-macos, my-app-linux, pass binName: 'my-app'.

Full example

import { updater, veloxWindow } from 'veloxkit'
import { useState, useEffect } from 'react'
import { View, Text, Pressable } from 'veloxkit'
 
const OWNER   = 'your-org'
const REPO    = 'your-repo'
const BIN     = 'my-app'
const VERSION = '1.0.0'   // replace with your app's current version
 
function UpdateBanner() {
  const [updateInfo, setUpdateInfo] = useState<{ latestVersion: string; body: string } | null>(null)
  const [updating, setUpdating] = useState(false)
 
  useEffect(() => {
    updater.check(OWNER, REPO, VERSION).then((result) => {
      if (result.hasUpdate) setUpdateInfo(result)
    }).catch(() => {})   // silently ignore network errors
  }, [])
 
  if (!updateInfo) return null
 
  return (
    <View style={{ backgroundColor: '#1a3a2a', padding: 12, borderRadius: 8 }}>
      <Text style={{ color: '#00A878', fontWeight: 700 }}>
        Update available: v{updateInfo.latestVersion}
      </Text>
      <Text style={{ color: '#aaa', fontSize: 13, marginTop: 4 }}>
        {updateInfo.body}
      </Text>
      <Pressable
        onPress={async () => {
          setUpdating(true)
          await updater.update(OWNER, REPO, BIN, VERSION)
          setUpdating(false)
          // Ask user to relaunch
        }}
        style={{ marginTop: 8, paddingVertical: 8, paddingHorizontal: 16, backgroundColor: '#00A878', borderRadius: 6 }}
      >
        <Text style={{ color: '#fff', fontWeight: 600 }}>
          {updating ? 'Updating...' : 'Install update'}
        </Text>
      </Pressable>
    </View>
  )
}

GitHub Release setup

Create a release with platform-specific assets. The updater picks the right one by platform:

PlatformExpected asset pattern
Windows{binName}-windows.exe or {binName}.exe
macOS{binName}-macos or {binName}
Linux{binName}-linux or {binName}

veloxkit package produces correctly named artifacts. Attach the output of veloxkit package --target windows / macos / linux directly to the release.

Check on launch

// src/main.ts
import { createApp } from 'veloxkit'
import { updater } from 'veloxkit'
import App from './App'
import { checkForUpdate } from './update'
 
async function start() {
  createApp({ component: App })
 
  // Check after a short delay so the app is responsive first
  setTimeout(() => {
    updater.check('your-org', 'your-repo', '1.0.0')
      .then((r) => { if (r.hasUpdate) console.log('Update available:', r.latestVersion) })
      .catch(() => {})
  }, 3000)
}
 
start()

API reference

See updater API for the complete reference.