Technology Stack
| Technology | Purpose | Version |
|---|---|---|
| Vue 3 | Reactive UI framework | Latest (Composition API) |
| Naive UI | Component library | Latest |
| Tailwind CSS | Utility-first styling | Latest |
| Vue Router | Client-side routing | Latest (Hash mode) |
| TypeScript | Type safety for composables | Latest |
| Vite | Build tool | Latest |
| Wails Runtime | Go ↔ JS bridge | v3 |
Application Structure
Component Architecture
View Components
Home.vue
Location:views/Home.vueRoute:
/Window: Main window The primary query interface. Composed of: Key Features:
- Resizable Layout: 2-column + footer with draggable dividers
- Event Listeners: Subscribes to
app:logandmenu:logs-toggled - State Management: Connection selection, active tabs, log entries
views/Home.vue:24):
views/Home.vue
Connections.vue
Location:views/Connections.vueRoute:
/connectionsWindow: Connections window (secondary) Manages connection CRUD operations:
- List all connections
- Create new connection (dynamic auth forms)
- Test connection (before saving)
- Delete connection
- Listens for
connection:created→ Adds to list without refetch - Listens for
connection:deleted→ Removes from list
Plugins.vue
Location:views/Plugins.vueRoute:
/pluginsWindow: Plugins window (secondary) Displays discovered plugins with metadata:
- Plugin name, version, description
- Author, license, capabilities
- Error state if probe failed
- Listens for
plugins:ready→ Reloads list when scan completes
Core Components
ConnectionsPanel
Location:components/ConnectionsPanel.vuePurpose: Left sidebar with connection tree Features:
- List all saved connections
- Expand connection → Fetch tree via
GetConnectionTree() - Right-click node → Context menu with actions
- Execute tree action → Calls
ExecTreeAction()
components/ConnectionsPanel.vue
WorkspacePanel
Location:components/WorkspacePanel.vuePurpose: Tab-based query workspace Features:
- Welcome Tab: Shown when no tabs open
- Query Tabs: One per query execution
- Tab Management: Close, switch, reorder
- Refresh Tab: Re-run query (for tree actions with “refresh” support)
views/Home.vue:57):
components/WorkspacePanel.vue
QueryEditor
Location:components/QueryEditor.vuePurpose: SQL/query input editor Features:
- Syntax highlighting (via
<textarea>with manual styling) - Execute query (Cmd/Ctrl+Enter)
- Query history (future)
- Autocomplete (future, using
useConnectionTreecomposable)
components/QueryEditor.vue
ResultViewer
Location:components/ResultViewer.vuePurpose: Multi-format result renderer Architecture: Props:
components/ResultViewer.vue
ResultViewerRdbms
Location:components/ResultViewerRdbms.vuePurpose: Table grid for SQL results Features:
- Scrollable table with fixed header
- Cell copy on click
- NULL value rendering
- Export to CSV (future)
components/ResultViewerRdbms.vue
LogsPanel
Location:components/LogsPanel.vuePurpose: Event log stream Features:
- Real-time log streaming via
app:logevent - Log levels:
info,warn,error - Clear logs button
- Auto-scroll to bottom
services/events.go:42):
views/Home.vue:115):
components/LogsPanel.vue
TwoColumnLayout
Location:components/TwoColumnLayout.vuePurpose: Resizable 2-column container Props:
components/TwoColumnLayout.vue
Paired with useResize composable for drag handling.
AuthFormRenderer
Location:components/AuthFormRenderer.vuePurpose: Dynamic form generator for plugin auth forms Features:
- Render form fields from
GetPluginAuthForms()response - Field types:
text,password,number,file - Validation (required fields)
- File picker integration (for SQLite file paths)
components/AuthFormRenderer.vue
Layout Components
SafeZone
Location:components/SafeZone.vuePurpose: macOS drag zone wrapper Wraps content in a non-draggable zone when
data-wails-drag is set on parent.
Implementation: components/SafeZone.vue
Composables
useResize
Location:composables/useResize.tsPurpose: Resizable panel drag logic Exports:
views/Home.vue:39):
composables/useResize.ts
useConnectionTree
Location:composables/useConnectionTree.tsPurpose: Connection tree cache and client-side completion Exports:
components/ConnectionsPanel.vue):
- Global reactive map:
Record<connectionId, TreeNode[]> - Fetch on first access, reuse thereafter
- Cache shared across all components
- No automatic invalidation (requires app restart or manual rescan)
node_type (number) to lowercase string:
composables/useConnectionTree.ts
State Management
No Global Store
QueryBox does not use Vuex or Pinia. State is managed via:- Component-local state:
ref()andreactive()within components - Event-driven updates: Backend events update UI state
- Composable caches: Shared state via composables (e.g.,
useConnectionTree)
Event-Driven Updates
Backend → Frontend (no polling, no refetching):- No stale data (backend is source of truth)
- No redundant API calls
- Instant UI updates
Routing
Router Mode: Hash (/#/connections)Reason: Works without server-side routing Routes (
main.js:33):
- Main window (
main): Displays/(Home) - Connections window (
connections): Displays/connections - Plugins window (
plugins): Displays/plugins
Styling
Tailwind CSS
Config:frontend/tailwind.config.jsImports:
frontend/src/styles/tailwind.css
Utility Classes:
Naive UI Theme
Config:App.vue:7
Wails Integration
Auto-Generated Bindings
Wails generates TypeScript bindings from Go service methods: Go Service (services/connection.go:177):
bindings/.../connectionservice.js):
Event System
Subscribe to Events (views/Home.vue:115):
main.go:30):
Build Process
Development
Production
- macOS:
build/bin/QueryBox.app - Windows:
build/bin/querybox.exe - Linux:
build/bin/querybox
//go:embed all:frontend/dist (main.go:20).
Platform-Specific UI
macOS
- No menu bar component: Uses native application menu
- Translucent backdrop: Blurred window background
- Title bar: Hidden inset style (50px drag zone)
Windows / Linux
- AppMenuBar component: Rendered menu bar (
components/AppMenuBar.vue) - Standard title bar: OS-native window chrome
views/Home.vue:142):
Performance Considerations
Lazy Window Creation
Strategy (main.go:78):
Tree Caching
Connection trees are fetched once and cached globally (useConnectionTree):
Event Cleanup
Pattern:Next Steps
- System Architecture Overview - High-level system design
- Core Services - Backend API documentation
- Event System - Event contracts and patterns