Cards in group
This card covers the procedures and best practices for exporting a web app from Codeex specifically aimed at Electron integration. It does not cover Electron installation, configuration, or the detailed process of creating Electron wrappers and executables.
Learn how to export a fully functional web application from Codeex, extracting all necessary files and assets to enable smooth integration with Electron's desktop wrapper.
Steps
- Complete your AI-generated web app in Codeex, ensuring all components are properly tested within the web environment.
- Navigate to Codeex's export functionality designed for desktop builds.
- Select the appropriate export preset or customize export settings to optimize for Electron (e.g., production build with minified assets).
- Export the entire web build folder, which includes HTML, CSS, JavaScript files, images, and other static assets necessary for the app’s functionality.
- Verify that the export includes an index.html file as the Electron wrapper will load this as the entry point.
- Check for generated source maps and language-specific assets if applicable, and include them in the export folder.
- Confirm that any dynamic data fetching or environment-specific variables are compatible with desktop deployment or are handled within the exported files.
- Prepare the exported folder as the source directory to be integrated into the Electron project’s main directory for packaging and building the executable.
Materials: https://codeex.example.com/docs/exporting-web-apps, https://www.electronjs.org/docs/latest/tutorial/first-app, https://developer.mozilla.org/en-US/docs/Web/Guide/Getting_started
15 minDifficulty: beginnerDomains: software development, desktop application development, web development, electron
This card covers the steps to set up Electron's main and renderer processes and load the exported web app bundle within Electron. It does not cover exporting the app from Codeex, building the executable from Electron, or advanced Electron features like native modules or packaging beyond initial integration.
Understand how to embed the exported Codeex web app into Electron by configuring main and renderer processes and loading the app correctly inside an Electron window.
Steps
- Install Electron as a development dependency using npm or yarn in your project where the exported web app is located.
- Create the Electron main process file (e.g., main.js) which initializes the application, creates the browser window, and loads the exported web app.
- In the main process, use Electron's BrowserWindow API to create a window with desired dimensions and options.
- Load the exported web app into the BrowserWindow by specifying the local index.html file URL, ensuring the path is resolved correctly relative to the main process script.
- Configure the renderer process by ensuring the web app runs within Electron's window context without modification, as the app is a standard web app bundle.
- Set up event handlers in the main process to manage application lifecycle events like ready, window-all-closed, and activate for cross-platform behavior.
- Optionally enable Node integration or context isolation depending on security needs and whether native modules or Electron APIs are required within the renderer context.
- Run the Electron application using a script in package.json (e.g., "electron .") and verify that the web app loads properly inside the desktop window.
- Troubleshoot common issues such as incorrect file paths, missing assets, or devtools accessibility to ensure smooth integration.
Materials: Official Electron documentation: https://www.electronjs.org/docs/latest, Node.js and npm installation guide: https://nodejs.org/en/download/, Electron Quick Start repository: https://github.com/electron/electron-quick-start
20 minDifficulty: intermediateDomains: software development, electron, desktop applications, web technologies
This card covers the setup and configuration of Electron Builder for generating platform-specific executables, including some basic code signing tips. It does not cover advanced installer customization, publishing automation, or deep platform-specific deployment quirks beyond standard Electron Builder usage.
By the end of this lesson, you will confidently generate native executable files for Windows, macOS, and Linux from your Electron-integrated application using Electron Builder, enabling seamless distribution and installation across platforms.
Steps
- Ensure your Electron app (with integrated Codeex web app) is fully tested and ready for packaging.
- Install Electron Builder as a development dependency in your project.
- Configure the 'build' section in your package.json with metadata, app icon paths, and platform-specific options.
- For Windows: set target to NSIS or Portable and configure installer options.
- For macOS: configure app bundle identifier and notarization credentials if applicable.
- For Linux: set targets such as AppImage or deb and specify executable file permissions.
- Run Electron Builder commands to generate executables: 'npm run build' or 'electron-builder'.
- Test the generated executables on each target platform to verify proper installation and app functionality.
- Optionally, sign your app executables on Windows and Mac for security and user trust.
- Package and prepare the distributables for end-user distribution.
Materials: https://www.electron.build/ - Official Electron Builder documentation., https://www.electronjs.org/docs/latest/tutorial/application-distribution - Electron application distribution guide., https://www.electronjs.org/docs/latest/tutorial/code-signing - Code signing in Electron apps., Sample build configuration snippet for package.json: https://www.electron.build/configuration/configuration
30 minDifficulty: intermediateDomains: software development, cross-platform development, desktop applications
This card focuses specifically on authentication and session persistence issues unique to Electron desktop apps derived from Codeex web apps. It does not cover web-only session management, OAuth implementation details, or security protocols beyond authentication persistence strategies.
Gain a clear understanding of the challenges in managing authentication persistence in Electron apps and learn effective strategies to maintain user login states across sessions.
Steps
- Understand the fundamental differences between web sessions and desktop app sessions, particularly the absence of browser cookie handling in Electron.
- Explore how Electron apps manage session data via the main process and renderer processes, including IPC communication constraints.
- Identify common challenges in persistent authentication such as storage of tokens, synchronization between app instances, and secure handling of credentials.
- Review approaches for persistent storage in Electron such as using local storage, file system storage, encrypted databases (e.g., SQLite), or secure OS keychains.
- Learn how to implement token refresh mechanisms in the Electron app to maintain session validity without repeated logins.
- Examine how to bridge session state from the original Codeex web app to the Electron app during integration to ensure continuity.
- Implement best practices for securing stored authentication data in the desktop environment including encryption and OS-level protections.
- Test session persistence across app restarts and system reboots to verify robustness and user experience continuity.
Materials: https://www.electronjs.org/docs/latest/api/session, https://www.electronjs.org/docs/latest/tutorial/security, https://developer.chrome.com/docs/extensions/mv3/tut_oauth/ (OAuth in Chromium, relevant for Electron), https://github.com/sindresorhus/keytar (Node module for OS keychain integration), Electron Security Considerations - OWASP, Official Codeex documentation on exporting and session handling
25 minDifficulty: intermediateDomains: Software Development, Desktop Application Security, Authentication, Electron, Session Management
This card focuses specifically on OAuth redirect URI adjustments and configuration within Electron desktop applications. It does not cover the full OAuth protocol, token management beyond redirect handling, or deep Electron app development outside authentication.
You will learn why OAuth redirect URIs must be adapted for desktop apps, how to configure them properly, and how to handle authentication callbacks within the Electron environment to maintain secure and functional user sign-in.
Steps
- Understand how OAuth redirect URIs function in web vs desktop environments and why desktop apps require different URI schemes.
- Review the default redirect URI configuration used in web apps generated by Codeex.
- Learn about common redirect URI formats for Electron apps, such as custom protocol schemes (e.g., myapp://callback) or localhost loopback URIs.
- Modify OAuth provider settings (e.g., Google, GitHub) to include these desktop-specific redirect URIs to allow authentication callbacks.
- Implement Electron main process listeners to capture OAuth redirect responses via protocol handlers or local server listening.
- Test the OAuth flow end-to-end in the desktop app, ensuring the authentication completes and tokens are received securely.
- Handle and troubleshoot common issues such as permissions for custom protocols, cross-origin errors, and redirect URI mismatches.
Materials: https://developer.chrome.com/docs/extensions/mv3/nativeMessaging/#native-messaging-host-manifest, https://www.electronjs.org/docs/latest/api/protocol#protocolregisterstandardschemes-schemess-options, https://developers.google.com/identity/protocols/oauth2/native-app#redirect-uri, https://github.com/electron/electron/issues/13064 (discussion on OAuth redirect handling in Electron), OAuth 2.0 for Native Apps (RFC 8252) - https://datatracker.ietf.org/doc/html/rfc8252
20 minDifficulty: intermediateDomains: software development, web security, authentication, desktop application development
This card covers UI adaptation techniques exclusively for Electron desktop applications derived from web apps. It does not delve into Electron integration, building executables, or backend-specific optimizations unrelated to UI. It also assumes basic knowledge of CSS and JavaScript. Advanced native desktop features beyond UI adjustments are out of scope.
Learners will gain the ability to adjust and optimize web app interfaces specifically for desktop environments using Electron, focusing on responsive layouts, dynamic window resizing, and adhering to desktop UX conventions.
Steps
- Understand the differences between web and desktop UX paradigms, such as window management and input methods.
- Learn to implement responsive CSS frameworks or custom media queries to handle different window sizes effectively.
- Detect window resizing events in Electron’s renderer process and dynamically adjust the UI layout accordingly.
- Adapt navigation patterns from web (e.g., hamburger menus) to desktop-friendly UI elements like menu bars or toolbars.
- Incorporate desktop UX conventions such as draggable areas, resizable panes, and context menus within the Electron window.
- Test UI behavior by resizing the Electron window and simulating various desktop screen sizes and resolutions.
- Optimize performance and visual fidelity ensuring crisp rendering on desktop displays, including support for high DPI screens.
Materials: Electron official documentation on BrowserWindow and webContents APIs: https://www.electronjs.org/docs/api/browser-window, CSS Tricks on responsive design and media queries: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/, Guide on adapting web UI for desktop from Microsoft Fluent UI: https://developer.microsoft.com/en-us/fluentui#/
25 minDifficulty: intermediateDomains: software development, UI/UX design, desktop application development
This card covers common runtime errors and debugging techniques related to authentication and window management in Electron desktop apps. It does not cover general Electron development, packaging, or advanced custom native module integration issues beyond deployment scope.
You will gain practical skills to identify, diagnose, and fix frequent Electron deployment problems, specifically focusing on authentication failures and window management issues, ensuring stable and reliable desktop applications.
Steps
- Identify symptoms of authentication failures such as invalid token, OAuth redirect errors, or session loss.
- Examine Electron app logs and developer console output to locate relevant error messages.
- Verify OAuth configurations: check redirect URIs, client IDs, and desktop app-specific settings.
- Ensure Electron main and renderer process communication does not block authentication flows.
- Inspect window management issues like unresponsive windows, failure to open new windows, or improper window sizing.
- Check Electron BrowserWindow options and lifecycle event handlers for correct setup.
- Use Electron's debugging tools including devtools, remote debugging, and tracing to capture detailed app behavior.
- Apply common fixes like adjusting OAuth redirect URIs to use custom schemes or localhost with specific ports.
- Implement retries or graceful error handling for transient session or network errors.
- Adjust window creation code to account for platform-specific nuances and Electron API changes.
- Test fixes thoroughly on target platforms to ensure issue resolution and prevent regressions.
Materials: https://www.electronjs.org/docs/latest/tutorial/debugging, https://www.electronjs.org/docs/latest/tutorial/security#2-handle-session-and-authentication-correctly, https://www.electronjs.org/docs/latest/api/browser-window, https://stackoverflow.com/questions/tagged/electron+authentication, https://github.com/electron/electron/issues
30 minDifficulty: intermediateDomains: software engineering, desktop application development, debugging, authentication, UI/UX