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

@fireproof/netlify

Package Overview
Dependencies
Maintainers
0
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fireproof/netlify

PartyKit gateway for Netlify

  • 0.19.112
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
189
increased by1250%
Maintainers
0
Weekly downloads
 
Created
Source

@fireproof/netlify

Fireproof is an embedded JavaScript document database that runs in the browser (or anywhere with JavaScript) and connects to any cloud.

This module, @fireproof/netlify, allows you to connect your Fireproof database to Netlify, enabling you to sync your data across multiple users in real-time.

Get started

We assume you already have an app that uses Fireproof in the browser, and you want to setup collaboration among multiple users via the cloud. To write your first Fireproof app, see the Fireproof quickstart, otherwise read on.

1. Install

In your existing Fireproof app install the connector:

npm install @fireproof/netlify

In your netlify project, install the @netlify/blobs package:

npm install @netlify/blobs

And finally, copy the server.ts file from this repo into your project:

cp node_modules/@fireproof/netlify/server.ts netlify/edge-functions/fireproof.ts

2. Connect

You're all done on the server, and ready to develop locally and then deploy with no further changes. Now you just need to connect to the Netlify in your client code:

// you already have this in your app
import { useFireproof } from "use-fireproof";
// add this line
import { connect } from "@fireproof/netlify";

Now later in your app connect to the party (be sure to do this a component that runs on every render, like your root component or layout):

const { database } = useFireproof('my-app-database-name')
const connection = connect(database, '', process.env.NEXT_PUBLIC_NETLIFY_HOST!)

The connect function is idempotent and designed to be safe to call on every render.

3. Collaborate

Now you can use Fireproof as you normally would, and it will sync in realtime with other users. Any existing apps you have that use the live query or subscription APIs will automatically render multi-user updates.

Keywords

FAQs

Package last updated on 19 Nov 2024

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