supacrud is a command-line interface tool designed to generate CRUD (Create, Read, Update, Delete) operations for your Supabase database tables in TypeScript projects.
To install supacrud, make sure you have Node.js and npm installed, then run:
npm install -g supacrud
to install supacrud globally or
npm install -D supacrud
to install as a dev dependency
After installation, you can use supacrud by running the supacrud
command in your terminal:
supacrud [OPTIONS]
-t, --table <table-name>
: Specify the table name to perform CRUD operations on. If not provided, you can select from a dropdown of existing tables in your database.-a, --all
: Generate all CRUD operations.-c, --create
: Generate create operation.-r, --read
: Generate read operation.-u, --update
: Generate update operation.-d, --delete
: Generate delete operation.-s, --set-creds
: Update your Supabase credentials.
Run supacrud with no options to select a table from your supabase database:
supacrud
Specify a table to generate CRUD ops for:
supacrud --table users
Generate create and read ops for a users table:
supacrud -t users -c -r
Generate update and read ops for a users table:
supacrud -t posts -u -d
Generate all CRUD ops for a comments table:
supacrud -t comments -a
Update your Supabase credentials:
supacrud -s
If you don't specify any flags, supacrud will prompt you to choose a table and an operation interactively.
supacrud supports the following operations:
- All: Add Create, Read, Update, Delete Ops for the specified table
- Create: Add a new record to your specified table
- Read: View an existing record
- Update: Modify an existing record
- Delete: Remove a record
- List: List all records in a table
For each table, supacrud generates corresponding .ts files in the data/<table-name>/
directory containing the CRUD operations for that table.
supacrud stores its configuration in:
~/.config/supacrud/<project-name>/config.json
This file contains your Supabase credentials.
This project is licensed under the MIT License