Skip to content

Ataraxy-Labs/electrobun-react-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ electrobun-react-starter

A batteries-included starter template for building native desktop apps with Electrobun, React 19, TanStack Router, and Tailwind CSS v4.

Electrobun = Bun + WKWebView β€” blazing fast, zero-Electron desktop apps for macOS (Linux & Windows coming soon).

What's inside

Layer Tech Role
Runtime Electrobun Native window, webview, menus, file dialogs
Backend Bun Backend process with typed RPC handlers
Frontend React 19 + React Compiler UI with automatic memoization
Routing TanStack Router Type-safe, code-based routing
Data TanStack Query Async state management for RPC calls
Styling Tailwind CSS v4 Utility-first CSS
Build Vite 7 HMR dev server + production bundling

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  BrowserWindow (native frame, titleBarStyle)    β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚  mainview (shell)                         β”‚  β”‚
β”‚  β”‚  β€’ Tab bar UI                             β”‚  β”‚
β”‚  β”‚  β€’ Keyboard shortcuts                     β”‚  β”‚
β”‚  β”‚  β€’ Manages <electrobun-webview> tags       β”‚  β”‚
β”‚  β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚  β”‚
β”‚  β”‚  β”‚  tabview (per-tab OOPIF webview)    β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ TanStack Router + Query          β”‚  β”‚  β”‚
β”‚  β”‚  β”‚  β€’ Your app pages live here         β”‚  β”‚  β”‚
β”‚  β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–²                           β–²
         β”‚  Shell RPC                β”‚  Tab RPC
         β–Ό                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Bun process (src/bun/index.ts)                 β”‚
β”‚  β€’ Tab state management                         β”‚
β”‚  β€’ Application menu                             β”‚
β”‚  β€’ RPC handlers (ping, system info, dialogs)    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Two RPC channels keep things clean:

  • Shell RPC β€” Bun ↔ mainview: pushes tab state, receives tab actions
  • Tab RPC β€” Bun ↔ each tab webview: handles app-level requests (ping, system info, file dialogs)

Quick start

Prerequisites

  • macOS (Electrobun currently supports macOS, with Linux & Windows on the roadmap)
  • Bun β‰₯ 1.1

Setup

# Clone the template
gh repo create my-app --template Ataraxy-Labs/electrobun-react-starter --clone
cd my-app

# Install dependencies
bun install

# Start developing (Vite HMR + Bun watcher in one process)
bun run dev

Or use the two-terminal workflow for more control:

# Terminal 1: Vite dev server with HMR
bun run dev:vite

# Terminal 2: Bun backend with auto-rebuild on save
bun run dev:bun

Build for production

bun run build

Project structure

src/
β”œβ”€β”€ bun/
β”‚   └── index.ts          # Bun backend β€” tab manager, menus, RPC handlers
β”œβ”€β”€ mainview/
β”‚   β”œβ”€β”€ App.tsx            # Shell β€” tab bar + webview container
β”‚   β”œβ”€β”€ main.tsx           # Shell entrypoint
β”‚   β”œβ”€β”€ index.html
β”‚   └── index.css
β”œβ”€β”€ tabview/
β”‚   β”œβ”€β”€ tabview-main.tsx   # Tab entrypoint β€” sets up RPC, Query, Router
β”‚   β”œβ”€β”€ index.html
β”‚   └── app/
β”‚       β”œβ”€β”€ router.tsx     # TanStack Router config
β”‚       β”œβ”€β”€ rpc.ts         # RPC bridge with browser-mode mock fallbacks
β”‚       β”œβ”€β”€ index.css
β”‚       └── pages/
β”‚           β”œβ”€β”€ HomePage.tsx
β”‚           β”œβ”€β”€ PingPage.tsx
β”‚           └── SystemInfoPage.tsx
└── stubs/
    └── types.ts           # Shared RPC type contracts (Tab, ShellRPC, TabRPC)

Demo pages

The starter ships with three demo pages to show how things work:

Page What it shows
Home Landing page with links to demos and a stack overview
Ping Round-trip RPC β€” send a message to Bun, get a response back
System Info TanStack Query fetching system details from Bun (platform, arch, PID, etc.)

Adding a new page

  1. Create src/tabview/app/pages/MyPage.tsx
  2. Add an RPC handler in src/bun/index.ts (if it needs backend data)
  3. Add the RPC call in src/tabview/app/rpc.ts
  4. Register the route in src/tabview/app/router.tsx

RPC mock fallbacks

The RPC bridge (src/tabview/app/rpc.ts) includes mock fallbacks so you can develop the frontend in a regular browser without running Electrobun β€” just open http://localhost:5173/tabview/index.html directly.

Scripts

Command Description
bun run dev Start everything (Vite + Bun watcher) in one process
bun run dev:vite Start only the Vite dev server
bun run dev:bun Start only the Bun backend with file watching
bun run build Production build (Vite bundle + Electrobun package)

License

MIT


Built with πŸ”© by Ataraxy Labs

About

Minimal starter kit for building desktop apps with Electrobun + React + TanStack Router + Vite

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors