npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ayoubamine/backsync

v1.3.0

Published

Backup and sync your data with ease.

Downloads

10

Readme

BackSync

Backup and sync your data with ease.

Supported backup:

  • Local
  • MongoDB
  • MySQL

Supported sync:

  • Local
  • Google Drive
  • Dropbox
  • AWS S3

Install

npm i -g @ayoubamine/backsync

Usage

Generate config file backsync.json:

backsync init

Add backup source:

backsync add backup

Add sync source:

backsync add sync

Update default settings:

backsync settings

Run the backup and sync manually:

backsync run

Schedule the backup and sync in the background:

backsync schedule

Show the sync history:

backsync status

Process Management

Install PM2 to run the process in the background:

npm i -g pm2

Create ecosystem.config.js file in the same directory that backsync.json exists and add the following content:

module.exports = {
  apps: [
    {
      name: 'backsync',
      script: 'backsync',
      args: 'schedule',
    },
  ],
};

Then to start:

pm2 start ecosystem.config.js

Display the logs:

pm2 logs backsync

To stop and delete:

pm2 delete backsync

Auth

Google Drive

Step 1: Create service account

Follow these steps to create a service account and download your credentials.json file: Create service account

Step 2: Create backup folder

  1. Go to https://drive.google.com.
  2. Create new folder.
  3. Right-click on the folder, select Share, add the service account email with the Editor permission and click Done.
  4. Browse to the new folder and copy the folder id from the url. 'https://drive.google.com/drive/u/0/folders/FOLDER_ID'

Dropbox

Step 1: Create an app in your Dropbox account

  1. Go to https://dropbox.com/developers/apps/create.
  2. Choose Scoped access on the first step.
  3. Choose App folder on the second.
  4. Give your app a name. That name will become a folder in your Dropbox account.
  5. Click Create app.

Step 2: Generate access token

  1. Go to Permissions tab and enable files.content.write scope.
  2. Go to Settings tab, scroll down to OAuth 2 block, select 'No expiration' and click Generate.

AWS S3

Step 1: AWS credentials

  1. Go to https://aws.amazon.com.
  2. Navigate to IAM > Users and click 'Add users'.
  3. Fill the username, enable 'Access key - Programmatic access', click 'Next: Permissions', select 'Attach existing policies directly', enable the AmazonS3FullAccess permission and click 'Next: Tags' > 'Next: Review'.

Step 2: Create an S3 bucket

  1. Go to https://s3.console.aws.amazon.com.
  2. Click 'Create bucket', fill the bucket name and click 'Create bucket'.

API

Info

| Name | Type | Required | | ----------- | -------- | -------- | | name | string | Yes | | description | string | No |

Backup

Local

Params

| Name | Type | Required | | ---- | -------- | -------- | | path | string | Yes |

Settings

| Name | Type | Required | | -------- | -------- | --------------------------- | | filename | string | No, Default: Original name. |

MongoDB

Params

| Name | Type | Required | | -------- | -------- | ---------------------------------------- | | uri | string | No, Default: mongodb://localhost:27017 | | database | string | Yes |

Settings

| Name | Type | Required | | -------- | -------- | --------------------------- | | filename | string | No, Default: Database name. |

MySQL

Params

| Name | Type | Required | | -------- | -------- | ----------------------- | | host | string | No, Default: hostname | | port | number | No, Default: 3306 | | user | string | No, Default: root | | password | string | No | | database | string | Yes |

Settings

| Name | Type | Required | | -------- | -------- | --------------------------- | | filename | string | No, Default: Database name. |

Sync

Local

| Name | Type | Required | | ---- | -------- | -------- | | path | string | Yes |

GDrive

| Name | Type | Required | | ---------------------------- | -------- | -------- | | credentials | string | Yes | | folderId | string | Yes |

Dropbox

| Name | Type | Required | | ----------------- | -------- | -------- | | token | string | Yes |

AWS S3

| Name | Type | Required | | -------------------------- | -------- | -------- | | accessKeyId | string | Yes | | secretAccessKey | string | Yes | | bucketName | string | Yes |

Settings

| Name | Type | Required | | -------- | -------- | ------------------------ | | cron | string | No, Default: 0 0 * * * | | prefix | string | No | | filename | string | No |

Contributions

Feel free to contribute to this project.

If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue. If you fixed a bug or implemented a new feature, please send a pull request.

Changelog

CHANGELOG

License

MIT License