Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supabase

Package Overview
Dependencies
Maintainers
1
Versions
920
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supabase

Supabase CLI

  • 1.20.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
92K
decreased by-38.13%
Maintainers
1
Weekly downloads
 
Created

What is supabase?

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.

What are supabase's main functionalities?

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();

Other packages similar to supabase

FAQs

Package last updated on 08 Dec 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc