>_ DevTrendsde

Sprache

Start

Sprachen

Bereiche

Frontend Backend Mobile DevOps AI / ML GameDev Blockchain Sicherheit
JavaScript

How Not to Lose Your Digital Life: One-Click Google Account Backup

472 Sterne

Imagine this scenario: you wake up in the morning, try to check your email, and Google tells you that your account has been blocked. No explanation given. Sounds like the opening of a thriller? Unfortunately, for many users this has become reality. In my practice, I've come across numerous stories of people losing access to ten years of correspondence, contacts, and calendar just because of a security algorithm error or an unlucky chain of events.

Of course, Google has the Takeout service, but let's be honest: using it regularly is quite a chore. It's slow, inconvenient, and requires manual intervention. That's where the node-google-backup project comes in, turning the backup process into an elegant automated task.

What Is This Tool and Why Do You Need It?

node-google-backup is a lightweight command-line utility written in Node.js. Its single, but critically important task is to download your email, contacts, and calendar events, saving them in standard formats directly to your hard drive or server.

Interestingly, the project author, WeeJeWel, created it in response to those very "horror stories" about account bans. The main feature here is incrementality. The tool won't download all your gigabytes of emails from scratch every time. It "smartly" downloads only what's appeared since the last synchronization.

NPM Version Sponsor Build & Publish NPM Package Build & Publish Docker Image

Why Is This Convenient?

When you run the backup, you won't get one huge unreadable archive. The utility creates a neat folder structure that's easy to navigate even without special programs:

  • Contacts: all your contacts in .vcf format. Any smartphone or email client will understand them.
  • Calendar: events in .ics format.
  • Mail: here's where the real magic happens. Emails are saved in .eml format and organized according to three different logics: by ID, by threads, and by labels.

By the way, to avoid taking up extra space, the author used symbolic links (symlinks). Physically, the email is stored in the By ID folder, while all other folders contain only links to it. This is a very smart solution from a storage architecture perspective.

How to Run a Backup in 2 Minutes

To get started, you'll need a Google "App Password". This is a special 16-character code that allows third-party programs to securely connect to your account without using your main password. You can create one in your Google account's security settings.

Option 1: Via Node.js (npx)

If you have Node.js installed, you don't even need to download anything. Simply run the command:

$ npx -y google-backup \
  --username "[email protected]" \
  --password "ваш-пароль-приложения" \
  --filepath "~/Backups/Google/"

Option 2: Via Docker

For containerization enthusiasts (and for those who want to run this on a home server or NAS), there's a ready-made Docker image. This is probably the most convenient way to set up regular backups:

$ docker run \
  --env GOOGLE_BACKUP_USERNAME="[email protected]" \
  --env GOOGLE_BACKUP_PASSWORD="ваш-пароль-приложения" \
  --env GOOGLE_BACKUP_FILEPATH="/backups" \
  --env GOOGLE_BACKUP_SERVICES="mail,calendar,contacts" \
  --volume="~/Backups/Google/:/backups/" \
  ghcr.io/weejewel/google-backup

Practical Use Cases: How to Use This in Real Life?

  1. A good night's sleep: Set up cron on a server or Raspberry Pi so the script runs once a week. Now, no matter what happens to Google, your correspondence from the last 10 years is always at hand.
  2. Migration: If you decide to leave the Google ecosystem, this tool will help you "extract" data in a clean format, ready for import into other services.
  3. Local search: The .eml format is well-indexed by system search tools like Spotlight on macOS or Windows Search. Sometimes finding an old email in a local folder is faster than in Gmail's web interface.

Technical Nuances

The project is written in JavaScript and actively uses the capabilities of IMAP protocols (for email) and corresponding APIs for contacts and calendar. It's nice to see that the project is alive: according to GitHub, it's regularly updated, and Docker images are automatically built through GitHub Actions.

Should you try it? Definitely yes, if you value your data. This is one of those cases where a small utility solves a huge potential problem. As they say, people fall into two categories: those who don't back up yet, and those who already do. With node-google-backup, you can move to the second category in five minutes.

And if you also use Apple services, the same author has a similar project for iCloud. But that's a whole different story.

Take care of your data!

Ähnliche Projekte