English | 中文
Java Electerm Sync Server
A simple, lightweight data synchronization server for Electerm, built with Java and Spark. It provides a REST API for syncing bookmarks, history, and other data across Electerm instances.
Prerequisites
- Java 17: Required for building and running the server. Download from Adoptium or your preferred JDK provider.
- Gradle: Included via the Gradle Wrapper (
gradlew), so no separate installation needed.
- Git: For cloning the repository.
Installation
-
Clone the repository:
git clone https://github.com/electerm/electerm-sync-server-java.git
cd electerm-sync-server-java
-
Set up the environment file:
Edit .env with your preferred settings (see Configuration below).
Configuration
The server uses environment variables from a .env file for configuration. Key settings include:
JWT_SECRET: A secret key for JWT token signing (generate a strong random string).
JWT_USER_NAME: Username for authentication.
JWT_USER_PASSWORD: Password for authentication.
PORT: Server port (default: 7837).
DB_URL: H2 database URL (default: embedded database).
Example .env:
JWT_SECRET=your-super-secret-key-here
JWT_USER_NAME=admin
JWT_USER_PASSWORD=securepassword
PORT=7837
DB_URL=jdbc:h2:./electerm_sync_db
Security Note: Never commit .env to version control. Use strong, unique values for secrets.
Running the Server
Development Mode
For quick testing or development:
- Starts the server on
http://127.0.0.1:7837.
- Output will show:
server running at http://127.0.0.1:7837.
- Press
Ctrl+C to stop.
Production Mode
-
Build the application:
-
Extract the distribution:
tar -xvf build/distributions/electerm-sync-server-java.tar
cd electerm-sync-server-java
-
Run the server:
./bin/electerm-sync-server-java
- Runs in the foreground. Use
& to background it: ./bin/electerm-sync-server-java &.
- Access at
http://127.0.0.1:7837 (or your configured port).
Using with Electerm
- In Electerm, go to Settings > Sync.
- Select Custom Sync Server.
- Set:
- Server URL:
http://127.0.0.1:7837 (or your server's URL).
- JWT Secret: The
JWT_SECRET from your .env.
- Username: The
JWT_USER_NAME from your .env.
- Save and sync your data.
The API endpoint is http://127.0.0.1:7837/api/sync.
Testing
Run the test suite:
- Uses JUnit for unit tests.
- Reports are in
build/reports/tests/test/index.html.
Customization
Writing Your Own Data Store
The server uses an H2 database by default, but you can implement custom storage.
- Implement the data store interface by extending or referencing
DataStore.java.
- Update
App.java to use your custom store.
- Rebuild and run.
Example: Take src/main/java/ElectermSync/DataStore.java as a reference for read/write methods.
Docker
For containerized deployment, see electerm-sync-server-java-docker.
Sync Servers in Other Languages
Explore alternatives: Custom Sync Server Wiki.
About electerm
Open-sourced terminal/ssh/sftp/telnet/serialport/RDP/VNC/Spice/ftp client(Linux, Mac, Windows, Android, HarmonyOS).
Besides mainstream Windows/macOS/Linux/Android, electerm also supports HarmonyOS, and older systems — Ubuntu 18, Windows 7, macOS 10+, and special Chinese Linux distributions such as UOS, Kylin, and LoongArch (both old-world and new-world), as well as RISC-V (riscv64) and PowerPC 64-bit little-endian (ppc64le) Linux.
Homepage / Downloads ·
Theme ·
Docker ·
Online demo ·
Android ·
HarmonyOS ·
Huawei AppGallery ·
Microsoft Store ·
Snap Store ·
deb repo ·
rpm repo
💻
electerm-web — Web app version running in browser (including mobile device)
License
MIT