belnadris /angular-electron

Ultra-fast bootstrapping with Angular and Electron :speedboat:

★ 5,708⑂ 1,340👁 170⑃ 276● 630▤ 4
TypeScriptMITCreated 2017-04-02belnadris.github.io/angular-electron/
下载:22.1.122.1.1 ↓22.1.12026-11-07
+0
日增长
5,708
stars
1,340
forks
170
watchers
276
prs
630
issues
4
releases

README

![Maintained][maintained-badge]
[![Make a pull request][prs-badge]][prs]
[![License][license-badge]](LICENSE.md)

[![Linux Build][linux-build-badge]][linux-build]
[![MacOS Build][macos-build-badge]][macos-build]
[![Windows Build][windows-build-badge]][windows-build]

[![Watch on GitHub][github-watch-badge]][github-watch]
[![Star on GitHub][github-star-badge]][github-star]
[![Tweet][twitter-badge]][twitter]

 Introduction

Bootstrap and package your project with Angular 22 and Electron 45 (Typescript + SASS + Hot Reload) for creating Desktop applications.

Currently runs with:

- Angular v22.2.4
- Electron v45.2.3

With this sample, you can:

- Run your app in a local development environment with Electron & Hot reload
- Run your app in a production environment
- Execute your tests with Vitest and Playwright (E2E)
- Package your app into an executable file for Linux, Windows & Mac

/!\ Hot reload only pertains to the renderer process. The main electron process is not able to be hot reloaded, only restarted.

 Getting Started

Clone this repository locally:

 bash
git clone https://github.com/belnadris/angular-electron.git


Install dependencies with npm (used by Electron renderer process):

 bash
npm install


There is an issue with yarn and node_modules when the application is built by the packager. Please use npm as dependencies manager.

If you want to generate Angular components with Angular-cli , you MUST install @angular/cli in npm global context.
Please follow Angular-cli documentation if you had installed a previous version of angular-cli.

 bash
npm install -g @angular/cli


Install NodeJS dependencies with npm (used by Electron main process):

 bash
cd app/
npm install


Why two package.json ? This project follow Electron Builder two package.json structure in order to optimize final bundle and be still able to use Angular ng add feature.

 To build for development

- in a terminal window - npm start

Voila! You can use your Angular + Electron app in a local development environment with hot reload!

The application code is managed by app/main.ts. In this sample, the app runs with a simple Angular App (http://localhost:4200), and an Electron window. \
The Angular component contains an example of Electron and NodeJS native lib import. \
You can disable "Developer Tools" by commenting win.webContents.openDevTools(); in app/main.ts.

 Project structure

| Folder | Description                                      |
|--------|--------------------------------------------------|
| app    | Electron main process folder (NodeJS)            |
| src    | Electron renderer process folder (Web / Angular) |

 How to import 3rd party libraries

This sample project runs in both modes (web and electron). To make this work, you have to import your dependencies the right way. \

There are two kind of 3rd party libraries :
- NodeJS's one - Uses NodeJS core module (crypto, fs, util...)
    - I suggest you add this kind of 3rd party library in dependencies of bo

Top issues

Latest release

22.1.1 22.1.1 2026-11-07
Upgrades
- Angular 22.2.4, CLI 22.2.6
- Electron 45.2.3, electron-builder 26.18.0
- Node 26 (.node-version and CI)
- vitest 5.1, angular-eslint 22.6, eslint 10.14, playwright 1.64

 CI
- Playwright browsers now installed from the project version instead of a pinned one

Full Changelog: https://github.com/belnadris/angular-electron/compare/22.1.0...22.1.1

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON