supabackup v0.1.0
SUPABACKUP
Supabackup is a node package, that allows you to easily perform your supabase backup operations for free. This package creates a backup of your given database tables. The backup is stored on your supabase storage. (in json format) You can add this on your administration interface to add backup feature.
Getting Started
Installation 📥
Make sure you have Node, Npm already installed in your system. you can check if Node, Npm available in your system by running below command,
node -v
npm -vIf it's not installed in your system then please install them by checking official documentation of,
After that, Install Package with below command :
npm install supabackupUsage ✅
Initializing
You can initialize a new Supabackup client using the initializeClient() method. It's allow you to configure your backup.
Parameters
supabaseUrl
requiredstringThe unique Supabase URL which is supplied when you create a new project in your project dashboard.
supabaseServiceKey
requiredstringYou can find the SERVICE_KEY on :
Setings > (project setings) API >
service_rolesecretclick onrevealand copy the key
Example 💛
initializeClient()
import { initializeClient } from 'supabackup'
// Create a single supabase client for interacting with your database
const supabackup = initializeClient('https://xyzcompany.supabase.co', 'service-key')Backing up
You can make a new backup of your database using the backup() method.
Parameters
- supabackupClient
requiredcreate with
initializeClient() - bucket
stringrequiredname that you give to your bucket (storage container)
- tables
requiredarray(string)array of tables that you want to backup
Example 💛
backup()
import { initializeClient, backup } from 'supabackup'
// Create a single supabase client for interacting with your database
const supabackup = initializeClient('https://xyzcompany.supabase.co', 'service-key')
// Backup the given tables (chat, user) on the bucket (Backup Chat)
backup(supabackup, "Backup Chat", ['user', 'chat']);You can found the backup : storage > Backup Chat > Backup [Date]
Restoring
You can your database using the restore() method.
Parameters
- supabackupClient
requiredcreate with
initializeClient() - bucket
stringrequiredname that you give to your bucket (storage container)
- folder
stringrequiredbackup folder name that you can find in your bucket example : "Backup Date backup"
- tables
requiredarray(string)array of tables that you want to backup
Example 💛
backup()
import { initializeClient, restore } from 'supabackup'
// Create a single supabase client for interacting with your database
const supabackup = initializeClient('https://xyzcompany.supabase.co', 'service-key')
// Restore the given tables (chat, user) on the database
restore(
supabackup,
"Backup",
'Backup 2022-01-30T13:48:12.589Z',
['user', 'chat']
);Contributing 🤝
Bug reports and Pull Requests are welcome 👋🏽
You can tell me on issues
License 🔖
This project is under MIT License.