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

firebase

Package Overview
Dependencies
Maintainers
4
Versions
3779
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

firebase

Firebase JavaScript library for web and Node.js

  • 9.18.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.9M
decreased by-13.52%
Maintainers
4
Weekly downloads
 
Created

What is firebase?

The firebase npm package is a comprehensive app development platform provided by Google that offers a variety of services such as real-time databases, authentication, cloud storage, hosting, and more. It is designed to help developers build and manage apps more efficiently.

What are firebase's main functionalities?

Realtime Database

Firebase Realtime Database allows you to store and sync data between your users in real-time. This is a NoSQL database that lets you build rich, collaborative applications by allowing secure access to the database directly from client-side code.

const { initializeApp } = require('firebase/app');
const { getDatabase, ref, set } = require('firebase/database');

// Initialize Firebase
const app = initializeApp({ /* your config */ });
const database = getDatabase(app);

// Write data to your database
set(ref(database, 'users/1'), {
  username: 'example',
  email: 'user@example.com'
});

Authentication

Firebase Authentication provides backend services to help authenticate users, including simple sign-in functionality as well as third-party providers like Google, Facebook, and Twitter.

const { initializeApp } = require('firebase/app');
const { getAuth, createUserWithEmailAndPassword } = require('firebase/auth');

// Initialize Firebase
const app = initializeApp({ /* your config */ });
const auth = getAuth(app);

// Create a new user
createUserWithEmailAndPassword(auth, 'user@example.com', 'password')
  .then((userCredential) => {
    // Signed in
    const user = userCredential.user;
    // ...
  })
  .catch((error) => {
    // Error handling
    const errorCode = error.code;
    const errorMessage = error.message;
    // ...
  });

Cloud Firestore

Cloud Firestore is a flexible, scalable database for mobile, web, and server development. It keeps your data in sync across client apps through real-time listeners and offers offline support.

const { initializeApp } = require('firebase/app');
const { getFirestore, collection, addDoc } = require('firebase/firestore');

// Initialize Firebase
const app = initializeApp({ /* your config */ });
const db = getFirestore(app);

// Add a new document with a generated id
addDoc(collection(db, 'users'), {
  first: 'Ada',
  last: 'Lovelace',
  born: 1815
});

Cloud Storage

Firebase Cloud Storage is built for app developers who need to store and serve user-generated content, such as photos or videos.

const { initializeApp } = require('firebase/app');
const { getStorage, ref, uploadBytes } = require('firebase/storage');

// Initialize Firebase
const app = initializeApp({ /* your config */ });
const storage = getStorage(app);

// Create a storage reference from our storage service
const storageRef = ref(storage, 'some-child');

// Upload file
uploadBytes(storageRef, file).then((snapshot) => {
  console.log('Uploaded a blob or file!');
});

Hosting

Firebase Hosting provides fast and secure hosting for your web app, static and dynamic content, and microservices.

const { initializeApp } = require('firebase/app');
const { getAuth } = require('firebase/auth');
const { getFirestore } = require('firebase/firestore');
const { getStorage } = require('firebase/storage');

// Initialize Firebase
// TODO: Replace the following with your app's Firebase project configuration
const firebaseConfig = {
  //...
};

const app = initializeApp(firebaseConfig);

// The rest of your web app's Firebase initialization and setup goes here...
// For example, you might set up Firebase Authentication, Firestore, and Storage as shown above.

Other packages similar to firebase

Keywords

FAQs

Package last updated on 16 Mar 2023

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