
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
supabase
Advanced tools
The supabase npm package is a powerful tool for interacting with the Supabase platform, which provides a suite of backend services such as a PostgreSQL database, authentication, and real-time subscriptions. It allows developers to easily integrate these services into their applications.
Database CRUD Operations
This feature allows you to perform CRUD (Create, Read, Update, Delete) operations on your Supabase database. The code sample demonstrates how to fetch data from a table.
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');
async function fetchData() {
let { data, error } = await supabase
.from('your_table')
.select('*');
if (error) console.error(error);
else console.log(data);
}
fetchData();
Authentication
Supabase provides authentication services, allowing you to manage user sign-ups, logins, and sessions. The code sample shows how to sign in a user using email and password.
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');
async function signIn() {
const { user, session, error } = await supabase.auth.signIn({
email: 'user@example.com',
password: 'password'
});
if (error) console.error(error);
else console.log(user, session);
}
signIn();
Real-time Subscriptions
Supabase supports real-time subscriptions, allowing you to listen for changes in your database and react to them in real-time. The code sample demonstrates how to subscribe to insert events on a table.
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');
supabase
.from('your_table')
.on('INSERT', payload => {
console.log('New row added!', payload);
})
.subscribe();
Storage
Supabase provides storage services for managing files. The code sample shows how to upload a file to a storage bucket.
const { createClient } = require('@supabase/supabase-js');
const supabase = createClient('https://your-project.supabase.co', 'public-anon-key');
async function uploadFile() {
let { data, error } = await supabase.storage
.from('your_bucket')
.upload('public/avatar1.png', 'path/to/file.png');
if (error) console.error(error);
else console.log(data);
}
uploadFile();
Firebase is a comprehensive app development platform that offers a variety of tools and services to help you develop high-quality apps. It provides functionalities similar to Supabase, such as real-time databases, authentication, and storage. Firebase is known for its ease of use and extensive documentation.
Parse is an open-source backend framework that provides a suite of tools for building and managing mobile and web applications. It offers features like a database, user authentication, and file storage, similar to Supabase. Parse can be self-hosted, giving developers more control over their backend infrastructure.
Hasura is a GraphQL engine that provides instant, real-time GraphQL APIs over your PostgreSQL database. It offers similar functionalities to Supabase, such as real-time subscriptions and authentication. Hasura is known for its powerful GraphQL capabilities and ease of integration with existing databases.
Developer tools and helpers.
Install
npm install supabase -g
Commands
supa init
supa dev
supa eject
FAQs
Supabase CLI
The npm package supabase receives a total of 252,987 weekly downloads. As such, supabase popularity was classified as popular.
We found that supabase demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.