A powerful Electron desktop client specifically designed for web applications that benefit from session isolation. Perfect for managing multiple accounts of the same service (WhatsApp Personal + Business, etc.) with complete context separation. Each session maintains its own cookies, storage, and authentication state.
This project was born from two main motivations:
I've always wanted to dive deep into Electron and explore its capabilities, particularly for integrating blockchain wallets into native applications. Electron Session Manager also serves as a boilerplate foundation for understanding Electron's architecture and as a stepping stone toward more advanced projects involving Web3 and cryptocurrency wallet integrations.
The immediate trigger for this project came from my transition to macOS, which is happening slowly. I was frustrated with how browser-installed PWAs behave differently from native applications:
- The Problem: When you install PWAs through the browser (using "Add to Dock" or similar features), they completely close when you click the 'X' button
- Native App Behavior: Real macOS applications minimize to the background and stay in the dock when you close their window
- My Specific Need: I rely heavily on Asana and WhatsApp Web, and I don't like to use the distributed WhatsApp native desktop app for a few reasons. So throughout my workday, constantly having to reopen them because i was trying to minimize it was breaking my workflow
Electron Session Manager gives web applications the same minimize-to-background behavior as native macOS apps, solving my productivity issue while providing a solid foundation for future Electron development.
- A hiden Bonus Feature: The context isolation that Electron provides also enables you to have multiple instances of WhatsApp running simultaneously in different contexts. This means you can have one dedicated application for WhatsApp Business while keeping your personal WhatsApp Web in another instance all this within the same app. If you manage support for multiple companies that is for you - this is a really cool feature that was unintended at first but when i saw this was possible to achieve i decided to give create a full session manager menu inside an Electron boilerplate which you can switch between sessions save the state of them and choose one to be the default to launch first when you open the app.
- 🖥️ Convert any web application to a native desktop app
- 🔒 Browsing with context isolation
- 🔔 Native notifications support
- 🌍 Cross-platform: Windows, macOS, and Linux
- ✨ Custom user agent support for compatibility
- 🚀 GitHub Actions CI/CD for automated builds
- 📦 Multiple build targets (installers, portable, etc.)
- 🌓 System Theme Detection that automatically adapts to your OS dark/light theme preference
- 🍎 True native macOS behavior - apps minimize instead of closing
- 📱 Multiple app instances - Run separate instances of the same web app with different contexts/accounts connected
- 🧠 Advanced Session Management - Create, rename, and manage multiple isolated sessions with persistent data
- 🛡️ Title Protection - Maintains clean window titles that are used in OSs notification's header
- 🛠️ Development Testing Tool - Use session management with localhost for multiplayer game testing and multi-user scenarios
- ⌨️ Hotkey Controls - F1 to toggle session menu, other shortcuts for quick actions
Creates the default development app
App | Configuration File | URL | Features |
---|---|---|---|
🛠️ Default | Custom .env |
localhost:5173 |
Development multi-session testing tool |
Creates 5 pre-configured examples ready to use:
App | Configuration File | URL | Features |
---|---|---|---|
💬 WhatsApp Web | configs/whatsappweb.env |
https://web.whatsapp.com |
Chrome user agent, multiple instances |
🎮 Discord | configs/discord.env |
https://discord.com/app |
Gaming communication platform |
📝 Notion | configs/notion.env |
https://www.notion.so |
Workspace and notes |
📱 Asana | configs/asana.env |
https://app.asana.com |
Project management |
🤖 ChatGPT | configs/chatgpt.env |
https://chat.openai.com |
AI assistant |
You can easily adapt this for:
- Telegram:
https://web.telegram.org
- Gmail:
https://mail.google.com
- Notion:
https://www.notion.so
- Figma:
https://www.figma.com
- And any other website or PWA with one limitation*
* as long as the login form don't redirect to an external page it won't open system default browser and it will work flawless.
- Node.js (version 16 or higher)
- npm or yarn
-
Clone this repository:
git clone https://github.com/VagnerDomingues/electron-session-manager cd electron-session-manager
-
Install dependencies:
npm install
-
Choose your base configuration:
Option A: Use a pre-configured example app
# Move package.json and .env.example from configs/ to /root and edit as needed: # For WhatsApp Web copy configs\whatsappweb.env .env copy configs\whatsappweb.package.json .package.json
Option B: Create your own web app
# Copy the generic template and customize it: copy .env.example .env
Then edit
.env
to set yourAPP_NAME
,APP_URL
, and other settings. -
Run the app:
npm start
-
Build for distribution:
npm run build:win # For Windows npm run build:mac # For macOS
This project uses environment variables for comprehensive configuration. Choose the appropriate starting template:
APP_NAME
: The display name of your applicationAPP_VERSION
: Application versionAPP_DESCRIPTION
: Application descriptionAPP_ID
: Unique application identifier (reverse domain notation)APP_AUTHOR
: Author nameAPP_LICENSE
: License type
FORCE_CODE_SIGNING
: Enable/disable code signing (true/false)SKIP_CODE_SIGNING
: Skip code signing entirely (true/false)BUILD_OUTPUT_DIR
: Output directory for builds (default: dist)
WIN_ICON
: Path to Windows icon file (.ico)WIN_TARGET
: Build target (dir, nsis, portable, etc.)WIN_CERTIFICATE_FILE
: Path to Windows code signing certificateWIN_CERTIFICATE_PASSWORD
: Certificate passwordWIN_CERTIFICATE_SUBJECT_NAME
: Certificate subject name
MAC_ICON
: Path to macOS icon file (.png or .icns)MAC_TARGET
: Build target (dir, dmg, etc.)MAC_CERTIFICATE_NAME
: macOS signing certificate nameMAC_NOTARIZE
: Enable notarization (true/false)MAC_NOTARIZE_APPLE_ID
: Apple ID for notarizationMAC_NOTARIZE_APPLE_ID_PASSWORD
: App-specific passwordMAC_NOTARIZE_TEAM_ID
: Apple Developer Team ID
APP_URL
: Target website URL (e.g., https://example.com, https://web.whatsapp.com)USER_AGENT
: Custom user agent string for compatibility
ENABLE_MULTIPLE_SESSION_IDS
: Enable advanced session management (true/false)
WINDOW_WIDTH
: Default window widthWINDOW_HEIGHT
: Default window heightWINDOW_MIN_WIDTH
: Minimum window widthWINDOW_MIN_HEIGHT
: Minimum window height
When ENABLE_MULTIPLE_SESSION_IDS=true
is set in your .env
file, the app unlocks powerful session management capabilities that allow you to manage multiple isolated sessions with persistent data.
🔒 Complete Context Isolation: Each session maintains its own:
- Cookies and authentication
- localStorage and sessionStorage
- Cache and browsing data
- User preferences and settings
🎯 Perfect for Multiple Accounts:
- WhatsApp: Multiple Personal or Business accounts
- Asana: Multiple Personal or Team accounts
- Discord: Multiple alt accounts
- Notion: Different workspaces
- ChatGPT: Separated conversation contexts
-
Enable the feature in your
.env
file:ENABLE_MULTIPLE_SESSION_IDS=true
-
Use the 'Session' menu to open to:
- Rename Current: Change the name of your current session
- Set as Default: Make this session open automatically when launching the app
- Start New Session: Create a new isolated session with incremental ID
- Delete Current: Remove the current session (except default session-1)
- Delete All Sessions: Remove all sessions except the default
- Open Saved Session: Switch to an existing session from the list
Perfect for Local Development Testing:
When developing web applications, especially multiplayer games or multi-user systems, this session manager becomes an invaluable testing tool:
- Set APP_URL to
localhost:5173
(or your development server URL) - Create multiple sessions login with different users accounts
- Each session maintains separate:
- User authentication tokens
- Local storage data
- Login state
- Browser's 'stay connected'
- Easily kill a session - clear everything, from cache to local storage.
- Simulate concurrent users - without the need of multiple tabs, different browsers or icognito mode
- Maintain isolated user contexts - keep accounts connected for further tests
- Perfect for Dapp development - Remember to install your wallet extension in this solution and rebuild after
# Your .env file for development
APP_NAME=My Game Dev
APP_URL=http://localhost:5173
ENABLE_MULTIPLE_SESSION_IDS=true
- Start your development server on your separated solution
- Launch this Electron wrapper pointing to your localhost:port
- Create sessions for Player 1, Player 2, Admin, etc.
- Test multiplayer interactions, user roles, and state management
- Each session maintains its own authentication and state
Each session's data is stored in isolated directories:
userData/sessions/
├── session-1/ # Default session (cannot be deleted)
├── session-2/ # Second session
├── session-3/ # Third session
└── sessions.json # Session configuration file
To run the app in development mode:
npm start
uses the default root .env and package.json config:
Build your currently configured app for the current platform:
npm run build
Build for specific platforms:
npm run build:win # Windows
npm run build:mac # macOS
npm run build:linux # Linux
Build with specific installers:
npm run build:win:nsis # Windows NSIS installer
npm run build:win:portable # Windows portable
npm run build:mac:dmg # macOS DMG
Build for all platforms at once:
npm run build:all
run through all preconfigured .env and package.json from config folder
Electron Session Manager includes a script to automatically build all example PWAs in one command:
npm run build:examples:win
npm run build:examples:mac
npm run build:examples:linux
npm run build:examples:all
This will:
- 💾 Backup your current
.env
file totemp.env
- 🔄 Loop through each example configuration:
- Asana
- ChatGPT
- Discord
- Notion
- WhatsApp Web
- 📦 Build each app into its own folder:
dist/appname/
- 🔄 Restore your original
.env
file
dist/
├── asana/
│ └── asana.exe (or .app)
├── chatgpt/
│ └── chatgpt.exe (or .app)
├── discord/
│ └── discord.exe (or .app)
├── notion/
│ └── notion.exe (or .app)
└── whatsappweb/
└── whatsappweb.exe (or .app)
The built applications will be available in the dist
folder, organized by app name.
Electron Session Manager includes GitHub Actions workflows that will:
- On every push: Build and test individual app examples
- On tag creation (e.g.,
v1.0.0
):- Build each example app individually for Windows, macOS, and Linux
- Create a GitHub Release with separate download links for each app
- Allow users to download only the apps they want
To create a release with individual app downloads:
git tag v1.0.0
git push origin v1.0.0
This will trigger GitHub Actions to:
- Build each of the 5 PWA examples individually:
- Asana (Windows
.zip
, macOS.tar.gz
, Linux.tar.gz
) - ChatGPT (Windows
.zip
, macOS.tar.gz
, Linux.tar.gz
) - Discord (Windows
.zip
, macOS.tar.gz
, Linux.tar.gz
) - Notion (Windows
.zip
, macOS.tar.gz
, Linux.tar.gz
) - WhatsApp Web (Windows
.zip
, macOS.tar.gz
, Linux.tar.gz
)
- Asana (Windows
- Create a GitHub Release with 15 individual download links (5 apps × 3 platforms)
- Include installation instructions for each platform
- Users download only what they need - No need to download all apps
- Smaller file sizes - Each app is packaged separately
- Selective updates - Update individual apps without re-downloading everything
- Better organization - Clear separation between different applications
- Context isolation enabled
- Node integration disabled
- Remote module disabled
- External links open in default browser
- Navigation restricted to configured app domain
- Clean interface without application menu
Electron Session Manager includes icons for popular applications in the assets/Appicons/
folder:
Discord.ico/.png
- Discord desktop appWhatsApp.ico/.png
- WhatsApp WebNotion.ico/.png
- Notion workspaceChatGPT.ico/.png
- ChatGPT interfaceAsana.ico/.png
- Asana project management
To add your own icons you can place them in two places:
assets/Appicons/
or the electron's default assets/
just remember to point them correctly in your .env:
WIN_ICON=assets/Appicons/YourAppName.ico
MAC_ICON=assets/Appicons/YourAppName.png
or
WIN_ICON=assets/icon.ico
MAC_ICON=assets/icon.png
Electron Session Manager uses environment variables for configuration, so you typically don't need to edit everything in package.json
directly. Instead:
-
For runtime configuration - Use your
.env
file:APP_NAME=Your App Name APP_URL=https://your-app.com WINDOW_TITLE=Your App
-
For build-time configuration - The build script automatically uses environment variables to customize the final package
-
For permanent changes - Edit
package.json
if needed:name
- App package nameproductName
- Display nameauthor
- Vagner Dominguesdescription
- App description
appId
- Unique app identifier in build config
The app uses electron-builder
for packaging. Configuration is in the build
section of package.json
.
- NSIS installer
- Support for x64 and x86 architectures
- Custom installation directory option
- DMG distribution
- Universal binary (Intel + Apple Silicon)
- Proper app categorization
- App doesn't start: Make sure all dependencies are installed with
npm install
- Build fails: Check that you have the required build tools for your platform
- Web app doesn't load: Check your internet connection and verify the APP_URL is correct
- Icons not showing: Ensure icon paths in your
.env
file point to existing files
- Windows Defender might flag the app during first build. This is normal for unsigned applications.
- Consider code signing for production distribution.
- The app needs to be signed for distribution inside the Mac App Store.
- Users might need to allow the app in System Preferences > Security & Privacy.
*Note: The example apps that are included are not ready for distribution they are just to explore usecase scenarios. Each configuration includes the proper app name, icon, URL, and optimized window settings for that specific application.
MIT License - feel free to use this for personal or commercial projects.
Feel free to submit issues, feature requests, or pull requests to improve Electron Session Manager.
Electron Session Manager is an Electron multi-session PWA client for converting web applications to desktop apps. All application names, trademarks, and logos belong to their respective owners. This project is not affiliated with any of the web applications used in the examples.