How bulletjim/std-app works
Purpose and Runtime
Secure Table Database is an offline Electron desktop app for creating and managing password-protected tabular data. It uses TypeScript, Vite/Electron Forge packaging, synchronous local SQLite (better-sqlite3), Node’s native crypto, and local electron-log; it has no cloud or server dependency.
Entry/runtime boundaries:
• Electron main process: src/backend/main.ts
• Privileged preload bridge: src/preload.ts
• Renderer UI bootstrap: src/frontend/renderer.ts
• Renderer HTML shell: src/frontend/index.html
Process and IPC Boundary
The renderer cannot directly access the database or cryptography. UI code calls the API exposed through the preload script; the main process receives IPC requests and routes them to backend controllers. This boundary keeps filesystem, SQLite, and password/key operations in Electron’s privileged process.
Relevant paths:
• src/preload.ts
• src/frontend/api.ts
• src/backend/main.ts
• src/backend/controllers/tableController.ts
Frontend Application
The renderer is a lightweight component-based interface for navigation, table creation, and table-detail operations. Routing selects dashboard and detail views; UI utilities support table-oriented transformations. It is responsible for collecting user input and rendering decrypted data received over IPC, not persistence or encryption.
Relevant paths:
• src/frontend/router.ts
• src/frontend/components/dashboard.ts
• src/frontend/components/createTable.ts
• src/frontend/components/tableDetails.ts
Table Application Layer
The controller/service layer defines table lifecycle operations—create, retrieve/manage, import/export, and password changes—while separating IPC-facing orchestration from business rules. Shared contracts model table and security data passed across layers.
Relevant paths:
• src/backend/controllers/tableController.ts
• src/backend/services/tableService.ts
• src/backend/interfaces/tableTypes.ts
• src/backend/interfaces/index.ts
Security Model
securityService owns encryption-sensitive behavior: AES-256-GCM encryption and PBKDF2 password-derived keys. Keys/passwords are not persisted; only encrypted table content and necessary non-secret encryption metadata should cross into storage. Password loss is intentionally unrecoverable, and re-keying is a security-domain operation rather than a UI-only update.
Relevant paths:
• src/backend/services/securityService.ts
• src/backend/interfaces/securityTypes.ts
• src/backend/services/tableService.ts
Local Persistence
The repository layer is the sole storage boundary around local better-sqlite3. Services invoke it to persist and retrieve encrypted table records; decrypted values should remain in memory only for the active operation and renderer response. The synchronous database runtime is confined to the Electron backend process.
Relevant paths:
• src/backend/db/tableRepository.ts
• src/backend/services/tableService.ts
• src/backend/main.ts
Observability and Delivery
Main and renderer have separate logging utilities, with the documented policy of excluding passwords and decrypted contents. Electron Forge/Vite configurations build the distinct main, preload, and renderer bundles; GitHub Actions provides CI/CD and release automation.
Relevant paths:
• src/backend/util/logger.ts
• src/frontend/util/logger.ts
• forge.config.ts
• .github/workflows/ci-cd-pipeline.yml
Main entry points: router.ts View router · forge.config.ts Forge/Vite build · renderer.ts Renderer bootstrap · main.ts Electron main
Components 20
Renderer
Unprivileged UI runtime.
- Renderer HTML shell
src/frontend/index.html - Renderer bootstrap
src/frontend/renderer.ts - View router · Selects dashboard and table-detail views.
src/frontend/router.ts - Dashboard
src/frontend/components/dashboard.ts - Create table view
src/frontend/components/createTable.ts - Table details view · Renders decrypted data returned by the backend.
src/frontend/components/tableDetails.ts - Renderer API client
src/frontend/api.ts - Renderer logger · Excludes passwords and decrypted contents.
src/frontend/util/logger.ts
Electron Backend
Privileged main-process application layer.
- Preload bridge · Exposes the renderer API without direct backend access.
src/preload.ts - Electron main · Receives IPC and confines privileged runtime access.
src/backend/main.ts - Table controller · Routes table lifecycle requests from the main process.
src/backend/controllers/tableController.ts - Table service · Coordinates table lifecycle, import/export, and password changes.
src/backend/services/tableService.ts - Table contracts
src/backend/interfaces/tableTypes.ts - Backend logger · Excludes passwords and decrypted contents.
src/backend/util/logger.ts
Security
Password and encryption domain.
- Security contracts
src/backend/interfaces/securityTypes.ts - Security service · Derives PBKDF2 keys and performs AES-256-GCM encryption.
src/backend/services/securityService.ts
Local Storage
Encrypted local persistence.
- Table repository · Sole storage boundary for encrypted table records.
src/backend/db/tableRepository.ts - Local SQLite · Synchronous database runtime used only in the main process.
Delivery
Desktop build and release automation.
- Forge/Vite build · Builds distinct main, preload, and renderer bundles.
forge.config.ts - CI/CD release pipeline · Automates validation and releases.
.github/workflows/ci-cd-pipeline.yml
Connections 23
- Renderer HTML shell → Renderer bootstrap: loads
- Renderer bootstrap → View router: starts
- View router → Dashboard: selects
- View router → Create table view: selects
- View router → Table details view: selects
- Dashboard → Renderer API client: table actions
- Create table view → Renderer API client: create request
- Table details view → Renderer API client: manage request
- Renderer API client → Preload bridge: invokes
- Preload bridge → Electron main: IPC request
- Electron main → Table controller: routes
- Table controller → Table service: orchestrates
- Table controller → Table contracts: uses
- Table service → Security service: encrypts, decrypts, re-keys
- Table service → Table repository: persists encrypted records
- Security service → Security contracts: uses
- Table repository → Local SQLite: reads and writes
- Electron main → Backend logger: logs safely
- Renderer bootstrap → Renderer logger: logs safely
- Forge/Vite build → Electron main: bundles
- Forge/Vite build → Preload bridge: bundles
- Forge/Vite build → Renderer bootstrap: bundles
- CI/CD release pipeline → Forge/Vite build: builds and releases