Skip to content

Add Tauri v2 desktop wrapper with Rust SQLite backend and Windows MSI CI#1

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/add-tauri-v2-desktop-wrapper
Draft

Add Tauri v2 desktop wrapper with Rust SQLite backend and Windows MSI CI#1
Copilot wants to merge 2 commits into
mainfrom
copilot/add-tauri-v2-desktop-wrapper

Conversation

Copilot AI commented Mar 26, 2026

Copy link
Copy Markdown

Wraps the existing Vite+React+TS app in a Tauri v2 desktop shell with a Rust-only backend (bundled SQLite, background job runner, progress events) and a GitHub Actions pipeline that produces a downloadable Windows MSI artifact.

Rust backend (src-tauri/)

  • Cargo.toml: added rusqlite (bundled), tokio, thiserror, uuid
  • src/lib.rs: full backend replacing the stub —
    • SQLite schema init on startup: projects, project_notes, project_text_fts (FTS5 virtual table), WAL mode
    • Commands: get_app_paths, sqlite_status, start_demo_job
    • start_demo_job spawns a Tokio task emitting job_progress (percent/stage/message) and job_done events; cleans up the active-job list on completion
  • tauri.conf.json: product name Binary Books E-Crafter, identifier com.binarybooks.ecrafter, window 1280×800, bundle target narrowed to msi with WiX en-US

TypeScript bridge (src/tauri/backend.ts) — new

Typed wrappers over @tauri-apps/api:

await startDemoJob(5);           // → job ID string
const unlisten = onJobProgress(e => console.log(e.percent, e.message));
const paths = await getAppPaths(); // → { appDataDir }

CI (.github/workflows/build-windows.yml) — new

  • Triggers on push to main and workflow_dispatch
  • windows-latest runner; caches ~/.cargo + src-tauri/target keyed on Cargo.lock
  • npm cinpm run tauri:build → uploads *.msi as artifact windows-msi

README

Added Desktop App (Tauri v2) section: prerequisites table (Rust, Node, WebView2, VS Build Tools), npm run tauri:dev quickstart, and CI artifact download steps.

Original prompt

Add a full Tauri v2 desktop wrapper to the fork crazyrob425/KDP-E-Book-Generator (base branch main), matching the existing Vite+React+TypeScript app structure and keeping UI changes minimal.

Requirements:

  • Create src-tauri/ scaffold for Tauri v2: Cargo.toml, src/main.rs, tauri.conf.json, build.rs, and required manifest files.
  • Implement a Rust-only backend with:
    • Bundled SQLite database stored under the app data directory.
    • Schema initialization on startup including at least: projects, project_notes, and an FTS5 virtual table for full-text search.
    • A simple background job runner that emits progress events to the frontend (e.g., job_progress, job_done).
    • Tauri commands: get_app_paths, sqlite_status, start_demo_job (or equivalent) callable from frontend.
  • Add a small TypeScript bridge module using @tauri-apps/api that wraps the commands and event listeners.
  • Update package.json to include Tauri scripts and add @tauri-apps/cli and @tauri-apps/api (v2) as devDependencies.
  • Add GitHub Actions workflow(s) to build and package Windows MSI artifacts on push and on manual dispatch, caching npm and Rust dependencies, and uploading the MSI as an artifact.
  • Update README.md with:
    • Windows prerequisites for local builds (Rust, Node, WebView2).
    • How to run npm run tauri:dev.
    • How to trigger/download CI MSI artifacts.

Constraints:

  • Do NOT add optional/"maybe" integrations unless strongly necessary.
  • Keep changes minimal and aligned with current repo structure (Vite + React + TS).
  • Ensure the workflow and configuration are Windows-focused (user target OS: Windows).

Deliverable: Open a PR against main in crazyrob425/KDP-E-Book-Generator with all changes, passing CI where applicable.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: os: windows | name: Binary Books E-Crafter | method: upload

Assistant: Below is a ready-to-upload Tauri wrapper (Rust-only backend) that wraps your existing Vite/React app and adds:

  • src-tauri/ scaffold
  • a Windows-ready Tauri config (tauri.conf.json)
  • Rust backend commands for:
    • app data directory
    • SQLite init (backend-only, no UI)
    • a simple background job runner + progress events (so generation/export won’t freeze UI)
  • a small TS bridge you can call from React (src/tauri/backend.ts)

You chose method: upload, so you will:

  1. Create these files locally (same paths)
  2. Upload them to your repo via GitHub web UI (Add file → Upload files) and commit
  3. Run npm install
  4. Run npm run tauri dev

Note: Your repo currently doesn’t include any Tauri deps; this adds them. Also, this is Windows-targeted, but it’ll be easy to expand later.


1) Add/Update package.json

Add these scripts and devDependencies. Keep your existing deps as-is; just merge in the new parts.

{
  "name": "fraudrob's-ai-book-factory",
  "private": true,
  "version": "0.0.0",
  "type": "module",
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview",

    "tauri": "tauri",
    "tauri:dev": "tauri dev",
    "tauri:build": "tauri build"
  },
  "dependencies": {
    "react-dom": "^19.2.0",
    "@google/genai": "^1.28.0",
    "react": "^19.2.0",
    "jszip": "3.10.1",
    "epub-gen-es": "1.0.1",
    "fabric": "^6.9.0",
    "express": "^5.1.0",
    "http": "^0.0.1-security",
    "ws": "^8.18.3",
    "playwright": "^1.56.1",
    "fs": "^0.0.1-security",
    "path": "^0.12.7",
    "os": "^0.1.2",
    "buffer": "^6.0.3"
  },
  "devDependencies": {
    "@types/node": "^22.14.0",
    "@vitejs/plugin-react": "^5.0.0",
    "typescript": "~5.8.2",
    "vite": "^6.2.0",

    "@tauri-apps/api": "^2.0.0",
    "@tauri-apps/cli": "^2.0.0"
  }
}

If you prefer, you can add the Tauri deps without changing anything else.


2) Create src-tauri/ (entire folder)

2.1 src-tauri/Cargo.toml

[package]
name = "binary-books-e-crafter"
version = "0.1.0"
description = "Binary Books E-Crafter"
authors = ["Binary Books"]
edition = "2021"

[build-dependencies]
tauri-build = { version = "2", features = [] }

[dependencies]
tauri = { version = "2", features = [] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
tokio = { version = "1", features = ["rt-multi-thread", "macros", "time"] }

# SQLite (backend-only)
rusqlite = { version = "0.31", features = ["bundled"] }

# Convenience
thiserror = "1"
uuid = { version = "1", features = ["v4", "serde"] }

2.2 src-tauri/build.rs

fn main() {
  tauri_build::build()
}

2.3 src-tauri/tauri.conf.json

This points Tauri at your Vite dev server and build output (dist). If your Vite build output differs, adjust frontendDist.

{
  "productName": "Binary Books E-Crafter",
  "version": "0.1.0",
  "identifier": "com.binarybooks.ecrafter",
...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Copilot AI changed the title [WIP] Add full Tauri v2 desktop wrapper to KDP-E-Book-Generator Add Tauri v2 desktop wrapper with Rust SQLite backend and Windows MSI CI Mar 26, 2026
Copilot AI requested a review from crazyrob425 March 26, 2026 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants