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

supavault

v0.0.7

Published

A simple library to backup your Supabase tables to Supabase storage.

Downloads

16

Readme

:lock: supavault

Supavault is a simple library + CLI tool to backup and restore your tables on Supabase. Data is serialized and deserialized to/from JSON and backup files are created within Supabase Storage.

✨ Features

  • Backup and restore tables within Supabase.
  • CLI tool to use from your machine.
  • API to write your own backup scripts.

🚀 Installation

npm i supavault

🖥 CLI

Usage: supavault [options] [command]

CLI to backup and restore Supabase tables

Options:
  -h, --help                                    display help for command

Commands:
  backup [options] <string> <string> <string>   Backs up current state of specified tables in Supabase
  restore [options] <string> <string> <string>  Restores data given table names in Supabase
  help [command]                                display help for command

Backup

Usage: supavault backup [options] <string> <string> <string>

Backs up current state of specified tables in Supabase

Arguments:
  string                Supabase url
  string                Session key
  string                Bucket name

Options:
  -t, --tables <items>  Comma-separated list of table names
  -h, --help            display help for command

Example

supavault backup SUPABASE_URL SESSION_KEY ANY_BUCKET_NAME_YOU_WANT --tables Users,Widgets

Restore

Usage: supavault restore [options] <string> <string> <string> <string>

Restores data given table names in Supabase

Arguments:
  string                Supabase url
  string                Session key
  string                Bucket name
  string                Folder name

Options:
  -t, --tables <items>  Comma-separated list of table names
  -h, --help            display help for command

Example

supavault restore SUPABASE_URL SESSION_KEY ANY_BUCKET_NAME_YOU_WANT --tables Users,Widgets

🔥 API

You can integrate the functionality into your project as follows. The parameters here are the same as the ones expected in the CLI:

import { backup, initializeClient, restore } from 'supavault';

const client = initializeClient(`https://yourdb.supabase.co`, `your-service-key`);

// Backing up (assuming top level await is supported)
const folderName = await backup(client, `backup`, [`User`, `Widget`]);

// Restoring
await restore(client, `backup`, folderName, [`User`, `Widget`])

🙋‍♀️ FAQ

Where do I get the SUPABASE_URL?

This URL can be found in Settings > API > Project URL.

Where do I get the SESSION_KEY?

This key can be found in Settings > API > Project API Keys > service_role.

⚠ This key has the ability to bypass Row Level Security. Never share it publicly.

:newspaper: License and Attribution

Supavault is licensed under the MIT license. If this project has helped you in any way, attribution in your project's README would be much appreciated.

🤝 Contributing PRs Welcome

When opening PRs, please provide adequate information on the bug or feature request. The added detail and formatting will help me understand and resolve your issue faster.