A minimal cross-platform calculator application built with Electron, TypeScript, and Vite.
- ✨ Modern, responsive calculator UI
- 🎨 Beautiful gradient design
- ⌨️ Full keyboard support
- 🏗️ Clean separation of concerns (UI, IPC, business logic)
- 🔒 Secure with context isolation enabled
- 🐛 Full debugging support with source maps
The initial project template was created with electronforge
npx create-electron-app@latest electron-calc --template=vite-typescript
- Node.js 18 or higher
- npm
npm install
npm start
This will start the app with hot-reload enabled and DevTools open.
This project includes VS Code debug configurations:
- Press
F5in VS Code - Select "Electron: Main" from the dropdown
- Set breakpoints in TypeScript files
- Debug with full source map support
npm run package
npm run make
This creates platform-specific installers:
- Linux:
.deb,.rpm,.zip - Windows:
.exe(Squirrel),.msi(WiX) - macOS:
.zip
sudo apt-get update && sudo apt-get install -y rpm dpkg fakeroot zip
This project uses GitHub Actions to build for all platforms automatically.
Every push to main triggers builds for:
- Linux (Ubuntu)
- Windows
- macOS
Download build artifacts from the GitHub Actions "Artifacts" section.
To create a GitHub release with all platform builds:
# Tag a new version
git tag v1.0.0
git push origin v1.0.0
This automatically:
- Builds for all platforms
- Creates a GitHub release
- Uploads all installers as release assets
src/
├── main.ts # Main Electron process
├── preload.ts # IPC bridge (context isolation)
├── calculator-logic.ts # Business logic module
└── index.css # Styles
index.html # Calculator UI
forge.config.ts # Electron Forge configuration
.github/workflows/ # CI/CD workflows
├── build.yml # Multi-platform builds
└── release.yml # Automated releases
- Electron - Cross-platform desktop framework
- TypeScript - Type-safe JavaScript
- Vite - Fast build tool with HMR
- Electron Forge - Build and packaging toolchain
The app demonstrates clean separation of concerns:
- Renderer Process (index.html) - Handles UI and user input
- Main Process (main.ts) - Routes IPC messages
- Business Logic (calculator-logic.ts) - Performs calculations
This architecture makes the code:
- Testable (business logic is isolated)
- Maintainable (clear responsibilities)
- Secure (no Node.js in renderer)
MIT
Built with lots of help from Anthropic Claude
