Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons
  • Teach on BraveProgrammer

© 2026 BraveProgrammer. All rights reserved.

Your First Electron | Electron.js Desktop App Development le | BraveProgrammer
  1. Courses
  2. /
  3. Electron.js Desktop App Development

Lesson 23 of 28

·javascript

Your First Electron App – Hello World

10 mins

Course progress82%

What you'll learn

Keep these ideas in mind as you work through the lesson.

4 points
  • `app.whenReady()` waits for Electron to finish initialisation.
  • `BrowserWindow` creates a native window that loads local HTML.
  • `window-all-closed` quits the app on all platforms except macOS (standard behaviour).
  • The HTML UI is completely separate from the Node main process.

Your First Electron App – Hello World

Create two files:

main.js (main process)

const { app, BrowserWindow } = require('electron');

function createWindow(){
  const win = new BrowserWindow({ width:800, height:600 });
  win.loadFile('index.html');
}

app.whenReady().then(createWindow);

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});

index.html (renderer)

<!doctype html>
<html>
<head><meta charset="utf-8"><title>Hello Electron</title></head>
<body>
  <h1>Hello, Electron!</h1>
  <p>This window is rendered by Chromium.</p>
</body>
</html>

Add "main": "main.js" to package.json and run npm start. You should see a native desktop window showing the HTML page.

Make it stickPractice what you've learned1 quiz · 5 practical tests · Optional activities from Electron.js Desktop App DevelopmentBrowse activities
Previous lessonElectron Architecture – Main vs RendererContinue to lesson 24Project Structure & npm ScriptsBack to Electron.js Desktop App Development curriculum