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 🙏

© 2025 – Pkg Stats / Ryan Hefner

strapi-plugin-backup-restore

v0.5.2

Published

Strapi plugin to Backup and restore easily your DB and files.

Downloads

38

Readme

Strapi Backup & Restore plugin

Add backup and restore features directly inside your strapi admin panel.

Backup restore plugin dashboard

Supported databases:

  • [x] mysql
  • [x] sqlite
  • [x] postgre
  • [ ] mongodb (not implemented yet)

Installation

Install package from npm

npm i strapi-plugin-backup-restore --save
# or
yarn add strapi-plugin-backup-restore

Rebuild your admin ui

yarn build
# Or launch with admin watch enabled
yarn develop --watch-admin
npm run develop -- --watch-admin

Create a private/backups folder. This folder will be used to store your backups.

mkdir -p private/backups && touch private/backups/.gitkeep

Add this directory to your server config (otherwise in dev your server will restart on every new backup):

// config/server.js
module.exports = ({ env }) => ({
  host: env("HOST", "0.0.0.0"),
  port: env.int("PORT", 1337),
  admin: {
    auth: {
      secret: env("ADMIN_JWT_SECRET", "32a00a220c916908e0efca2b8117262f"),
    },
    // Add this line
    watchIgnoreFiles: ["**/private/**"],
  },
});

You should also add to your .gitignore the following:

private/backups/\*
!private/backups/.gitkeep

Usage

Prerequisites

MySQL

mysqldump command must be available in your environment.

Sqlite

Working out of the box.

Postgres

pg_dump must be available in path. libpq may be used to have it without a whole Postgres installation.

You can manually specify pg_dump path in plugin config like so:

// config/plugins.js
module.exports = () => ({
	"backup-restore": {
		postgres: {
			// Update with your path
			pathToPgDump: "/usr/local/opt/libpq/bin/pg_dump",
		},
	},
});
// docker variant:
module.exports = () => ({
	"backup-restore": {
		postgres: {
			docker: "container-name", // eq. { mode: "local", container: "container-name" }
			// or
			docker: {
				mode: "local",
				container: "container-name",
				path: "docker", // path to command. Not required, default = "docker"
			},
			// or
			docker: {
				mode: "socket",
				container: "container-name",
				socket: "http://socket-url", // not required, default = "/var/run/docker.sock"
				file: true, // boolean or function (originPath: string) => string;
			}
		},
	},
});

Manual backup

Navigate to your admin panel > plugins (left sidebar) > Backup & Restore

Click on Manual Backup to trigger a backup.

Scheduled backup

Edit config/functions/cron.js and add the following cron job.

// config/functions/cron.js
module.exports = {
  /**
   * Trigger a backup at 04:00 every day
   */
  "0 4 * * *": async () => {
    console.log("Starting backup from cron...");
    const backupID = Date.now().toString();

    await strapi.plugins["backup-restore"].services["backup-tools"].runBackup(
      backupID,
      false, // Tells if it's a manual backup, well it's not
      true, // Backup database
      true // Backup files
    );
    console.log(`Backup ${backupID} finished`);
  },
};

Permissions

Backup restore plugin permissions setup You can manage per-scope permissions directly from admin panel.

Backup structure

Your backup contains both database and uploaded files (content of public/uploads). It is a zip file where you'll find:

  • database.sql: a full backup of the database used by strapi
  • uploads.zip: your uploads folder content

Roadmap

Backup

  • [x] Backup from mysql
  • [x] Backup from postgre
  • [x] Backup from sqlite
  • [ ] Backup from mongodb
  • [x] Backup local uploads (from public/uploads)
  • [ ] Save backup to remote storage (Google drive, one drive, dropbox...) with a tool like rsync
  • [ ] Backup uploads from remote provider

Restore

  • [ ] Restore to mysql
  • [ ] Restore to postgre
  • [ ] Restore to sqlite
  • [ ] Restore to mongodb
  • [ ] Fetch backup from remote storage (Google drive, one drive, dropbox...) with a tool like rsync
  • [ ] Restore uploads to remote provider

Disclaimer

MIT license

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

I (or any contributor) could not be responsible for any data loss while using this plugin. Backup feature is quite simple and globally safe (if it fails then you only have a failed backup) but restore is more tricky and external factors involved during the process may break your installation.

Dependencies

There are not a lot of dump clients available on npm and I was in a hurry when creating this plugin so I picked mysqldump which has not been updated since june 2020. A better implementation would be to remove that package / contribute to its development.