Sync your .env files securely across machines using Backblaze B2 storage and Google OAuth authentication.
- End-to-end encryption - Files are encrypted locally using XChaCha20-Poly1305 before upload
- Google OAuth - Authenticate with your Google account (no passwords to manage)
- Three-way merge - Intelligently sync changes between machines with conflict detection
- Conflict resolution - Interactive UI for resolving divergent changes
- Backblaze B2 - Affordable, S3-compatible cloud storage (~$0.005/GB/month)
- Bun runtime (v1.0+)
- A Backblaze B2 account
- A Google Cloud project with OAuth credentials
# Clone the repository
git clone <your-repo-url>
cd project-settings-sync
# Install dependencies
bun install
# Build the CLI
bun run build
# Link globally (optional)
bun linkOr run directly with:
bun run ./bin/run.ts <command>- Create a Backblaze B2 account
- Create a new bucket (e.g.,
my-project-settings) - Go to App Keys and create a new application key with read/write access to your bucket
- Note down:
- keyID - The application key ID
- applicationKey - The secret application key
- Endpoint - Found in bucket details (e.g.,
s3.us-east-005.backblazeb2.com) - Region - Extracted from endpoint (e.g.,
us-east-005)
Configure pss with your B2 credentials:
pss config set b2.keyId YOUR_KEY_ID
pss config set b2.appKey YOUR_APPLICATION_KEY
pss config set b2.bucket your-bucket-name
pss config set b2.endpoint s3.us-east-005.backblazeb2.com
pss config set b2.region us-east-005- Go to Google Cloud Console
- Create a new project (or select existing)
- Go to APIs & Services > OAuth consent screen
- Configure for "External" users (or "Internal" if using Google Workspace)
- Add your email as a test user
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Application type: Desktop app
- Name:
PSS CLI
- Download or copy the Client ID and Client Secret
Configure pss with your Google credentials:
pss config set google.clientId YOUR_CLIENT_ID.apps.googleusercontent.com
pss config set google.clientSecret YOUR_CLIENT_SECRETpss config listYou should see all your configured values (secrets are partially masked).
Authenticate with Google OAuth:
pss loginThis opens a browser window for Google authentication. Your credentials are stored locally in ~/.config/pss/auth.json.
Navigate to your project directory and initialize:
cd /path/to/your/project
pss initThis creates:
.pss.json- Project configuration (commit this).pss/- Local sync state (add to.gitignore)
The init wizard will ask for:
- Project name - Unique identifier for this project
- File pattern - Glob pattern for env files (default:
.env*) - Ignore patterns - Files to exclude (e.g.,
.env.example)
Upload your local .env files to B2:
pss push
# Preview without uploading
pss push --dry-run
# Push specific files
pss push .env.localDownload .env files from B2:
pss pull
# Preview without downloading
pss pull --dry-run
# Create backups before overwriting
pss pull --backupIntelligently merge local and remote changes:
pss sync
# Preview merge without applying
pss sync --dry-run
# Auto-resolve conflicts using local values
pss sync --ours
# Auto-resolve conflicts using remote values
pss sync --theirsThe sync command:
- Downloads remote files
- Compares local, remote, and base (last sync) versions
- Auto-merges non-conflicting changes
- Prompts for manual resolution of conflicts
- Uploads merged result
Compare local and remote files:
pss diff
# Diff specific file
pss diff .env.local# List all synced projects
pss list
# List files in current project
pss list files# Delete specific files from remote
pss delete .env.local
# Delete entire project from remote
pss delete --projectpss logoutPSS uses three-way merge to intelligently handle changes:
| Base | Local | Remote | Result |
|---|---|---|---|
| - | A | B | Conflict (new key collision) |
| - | A | - | Use local |
| - | - | A | Use remote |
| A | A | A | No change |
| A | B | A | Use local (only local changed) |
| A | A | B | Use remote (only remote changed) |
| A | B | B | Use B (both same change) |
| A | B | C | Conflict (divergent edit) |
| A | - | A | Delete (local deleted) |
| A | A | - | Delete (remote deleted) |
| A | - | B | Conflict (edit vs delete) |
| A | B | - | Conflict (edit vs delete) |
When conflicts are detected, you have several options:
# Interactive resolution (default)
pss sync
# Use all local values
pss sync --ours
# Use all remote values
pss sync --theirsIn interactive mode, for each conflict you can:
[l]Use local value[r]Use remote value[b]Keep base value[e]Edit manually[s]Skip (leave unresolved)
Both push and pull now detect potential conflicts:
# If remote has changes you haven't pulled:
$ pss push
⚠ Remote has unpulled changes
Options:
pss sync Merge local and remote changes (recommended)
pss push -f Force push and overwrite remote
# If local has changes you haven't pushed:
$ pss pull
⚠ Local has unpushed changes
Options:
pss sync Merge local and remote changes (recommended)
pss pull -f Force pull and overwrite localAll files are encrypted locally before upload using:
- Algorithm: XChaCha20-Poly1305 (authenticated encryption)
- Key derivation: Argon2id with your Google user ID as salt
- Nonces: Randomly generated for each encryption
The encryption key never leaves your machine. B2 only stores encrypted blobs.
- Google OAuth 2.0 with PKCE (no client secret exposure)
- Tokens stored locally in
~/.config/pss/auth.json - Automatic token refresh
| Data | Location | Encrypted |
|---|---|---|
| B2 credentials | ~/.config/pss/config.json |
No (local only) |
| Google tokens | ~/.config/pss/auth.json |
No (local only) |
| Project config | .pss.json |
No (safe to commit) |
| Base snapshots | .pss/ |
No (add to .gitignore) |
| Remote files | Backblaze B2 | Yes |
your-project/
.env # Your env files
.env.local
.env.production
.pss.json # Project config (commit this)
.pss/ # Local sync state (gitignore this)
base/
.env.base
.env.local.base
snapshot.json
~/.config/pss/
config.json # Global config (B2 creds, Google OAuth)
auth.json # Google auth tokens
pss loginpss config set b2.keyId YOUR_KEY_ID
pss config set b2.appKey YOUR_APP_KEY
# ... other config values- Verify your B2 credentials are correct
- Check that your bucket exists
- Ensure your application key has read/write permissions
pss initUse pss sync --dry-run to preview changes, then:
pss sync --oursto prefer localpss sync --theirsto prefer remote
# Run in development mode
bun run dev <command>
# Run tests
bun test
# Build
bun run buildMIT