A professional desktop application for managing and modeling SQLite databases, developed with Electron, React, and TypeScript.
The application follows a strict separation between the Main Process (Backend/Database) and the Renderer Process (UI/Frontend):
- Technology: Electron (Node.js)
- Responsibility:
- File system access (opening/saving .db and .sql files)
- SQLite database management via
sql.js(WASM-based for maximum compatibility) - Native menus and dialogs
- Communication: Exposes IPC handlers that can be safely called by the renderer.
- Security:
contextIsolation: true,nodeIntegration: false. Access only viapreload.jsAPI.
- DatabaseService: Encapsulates all
sql.jslogic.- Manages open database connections in memory.
- Executes SQL queries and maps results to typed objects.
- Handles schema introspection (tables, columns, indexes).
- Saves changes atomically back to the disk.
- Types: Common TypeScript definitions for database objects (
TableInfo,ColumnInfo) and IPC channels. Guarantees type safety between frontend and backend.
- Technology: React 18, Vite
- State Management:
zustandstore (src/store/app-store.ts).- Central store for database metadata, UI state (tabs, sidebar), and theme.
- UI Components:
- Custom components without large UI libraries (CSS variables, Flex/Grid).
- Monaco Editor: For SQL editing with syntax highlighting.
- React Flow: For visual schema modeling (ER diagrams).
- Styling: Modern CSS with CSS variables for theming (Dark/Light mode).
sqlite-studio/
├── electron/ # Backend code
│ ├── main.ts # Entry point
│ ├── preload.ts # IPC Bridge
│ ├── menu.ts # Native menus
│ ├── ipc/ # Message handlers
│ └── services/ # Business logic (SQLite)
├── src/ # Frontend code
│ ├── components/ # React UI components
│ ├── store/ # Zustand state management
│ ├── styles/ # Global CSS
│ ├── App.tsx # Root component
│ └── main.tsx # Entry point
├── shared/ # Shared types
│ └── types.ts
├── dist/ # Frontend build output
├── dist-electron/ # Backend build output
└── release/ # Final executables (Installer)
-
sql.js (WASM) instead of
better-sqlite3:- Avoids native compilation issues (node-gyp/Python/C++ dependencies) on Windows.
- Enables portable builds without complex CI/CD pipelines.
- Performance is absolutely sufficient for desktop applications (in-memory operations).
-
Vite:
- Extremely fast HMR (Hot Module Replacement) for development.
- Optimized production build.
-
Zustand:
- More minimalist than Redux, but powerful enough for complex apps.
- No context provider wrapping needed ("Flux-like").
-
Monaco Editor:
- The standard for code editors (VS Code engine). Provides best SQL support.
The application is packaged with electron-builder.
- Node.js >= 18 installed.
- Development:
npm run dev- Starts Vite server and compiles Electron code in watch mode.
- Build:
npm run electron:build- Creates the final Windows installer (
.exe) in therelease/folder.
- Creates the final Windows installer (
The build process:
npm run build:electron: Compiles TS to JS (dist-electron/).npm run build:renderer: Builds the React app (dist/).electron-builder: Packages everything, copiessql-wasm.wasm, and creates the installer.