How archergu/vite-react-nestjs-electron works
Project type and purpose
• This is an Electron-based desktop application template that combines:
• A NestJS-style “main process” for business logic and IPC endpoints
• A Vite-powered React “renderer process” for the UI
• A preload script that securely exposes IPC APIs to the renderer
• Purpose: give developers a boilerplate to build desktop apps with familiar web and Node backend frameworks (NestJS, Vite, React), packaged via electron-builder.
File structure
• Top-level config files:
• electron-builder.config.js – packaging rules
• vite.config.mts – build/dev server for renderer
• tsconfig.json / tsconfig.node.json – TypeScript settings
• package.json / pnpm-lock.yaml – dependencies & scripts
• src/main – Electron main process, structured like a NestJS app
• app.module.ts, app.controller.ts, app.service.ts: MVC modules, controllers, services
• index.ts: bootstraps Nest application inside Electron main
• src/preload – The preload script
• index.ts / index.d.ts: bridges main-renderer via secure IPC
• src/render – The React frontend
• main.tsx / App.tsx: entrypoints and root component
• index.html, assets, CSS: static UI resources
• CI/config: .github/workflows/ci.yml, renovate.json, .npmrc for pnpm, eslint.config.mjs
README insights
• Confirms use of:
• vite-plugin-doubleshot to run & build main process like a Node backend
• electron-nestjs modules for IPC transport and window management
• tsup and electron-builder via @doubleshot/builder for packaging
• Highlights fast DX & full integration between NestJS and Electron
a. Main components
• Electron Main Process (NestJS application)
• IPC Transport Layer (nestjs-electron IPC module)
• Preload Script (contextBridge exposing safe APIs)
• Renderer Process (React + Vite)
• Build & Packaging Tools (Doubleshot/Vite plugin, tsup, electron-builder)
• Local file system, OS window manager
b. Relationships & interactions
• Renderer ↔ Preload via window.api.* calls
• Preload ↔ Main Process via ipcRenderer / ipcMain channels
• Main controllers/services handle requests and manage state or file I/O
• Build tools transform src/main and src/render into production bundles
c. Architectural patterns
• MVC in the NestJS-style main process
• Modular separation: main, preload, render
• IPC-based service boundary between UI and backend logic
• Plugin-driven build orchestration (Doubleshot)
d. Key technologies
• Electron (main & renderer processes)
• NestJS and its Module/Controller/Service pattern
• Vite + React in the render layer
• TypeScript throughout
• electron-builder for packaging
Detail
• Electron-builder invoking tsup for main and Vite for renderer at build time
• OS window manager as an external actor if window lifecycle is crucial
• Don’t shy away from layering: present dev vs. prod flows if beneficial