Prerequisites
Before you begin, ensure you have the following installed:- Node.js (version 12 or higher)
- npm (comes with Node.js)
- Git for version control
Initial setup
Fork and clone the repository
First, fork the gSubs repository to your own GitHub account, then clone it to your local machine:Replace
YOUR_USERNAME with your GitHub username.Install dependencies
Install all required dependencies using npm:This command will:
- Install all dependencies listed in
package.json - Run the
postinstallscript to install Electron app dependencies viaelectron-builder
The postinstall script automatically runs
electron-builder install-app-deps to ensure native dependencies are properly compiled for your platform.Project dependencies
Understanding the dependencies will help you work with the codebase:Runtime dependencies
- electron-store (^1.3.0) - Persistent storage for user preferences (language settings, etc.)
- electron-updater (^4.0.0) - Automatic update functionality
- jquery (^3.3.1) - DOM manipulation and AJAX requests
- opensubtitles-api (^5.1.2) - OpenSubtitles subtitle source integration
- subdb (0.0.3) - SubDB subtitle source integration
Development dependencies
- electron (~9.1.0) - Desktop application framework
- electron-builder (^20.5.1) - Packaging and building for distribution
Development workflow
Running the app
When you runnpm start, Electron launches the main process defined in main.js, which:
- Creates a frameless, transparent browser window (344x540)
- Loads
app/view/index.htmlas the entry point - Enables Node.js integration in the renderer process
- Initializes the auto-updater
Making changes
After making changes to the code:- Renderer process changes (files in
app/renderer/,app/js/,app/css/) - Close and restart the app withnpm start - Main process changes (
main.js) - You must restart the app for changes to take effect - HTML/CSS changes - Restart the app to see updates
Unlike web development, Electron apps don’t support hot-reload by default. You’ll need to close and restart the app after each change.
Opening developer tools
To debug the renderer process, uncomment this line inmain.js:51:
Testing features
Once the app is running, you can test the core features:Drag and drop
Drag video files (.m4v, .avi, .mpg, .mp4, .webm, .mkv) into the app window to search for subtitles.
Search functionality
Use the search box to find subtitles by movie or series name without having a video file.Language selection
Click the flag icon to change the subtitle language. Supported languages:- English (en)
- Español (es)
- Français (fr)
- Italiano (it)
- Nederlands (nl)
- Polski (pl)
- Português (pt)
- Român (ro)
- Svenska (sv)
- Türkçe (tr)
Troubleshooting
Installation issues
Ifnpm install fails:
- Clear npm cache:
npm cache clean --force - Delete
node_modulesfolder andpackage-lock.json - Run
npm installagain
Electron version mismatch
If you encounter native module errors, rebuild them for your Electron version:App won’t start
Check the console output for errors. Common issues:- Missing dependencies: Run
npm install - Port conflicts: Ensure no other Electron apps are running
- File permissions: Ensure you have read/write access to the project directory
Next steps
Building
Learn how to build gSubs for production
Architecture
Understand the codebase structure