npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@jimpick/fireproof-cloud

v0.19.118-jim2

Published

Fireproof Cloud gateway for Fireproof

Downloads

66

Readme

Fireproof Cloud

This gateway intended for use with Fireproof Cloud.

Usage

You can call the connect function with a database and it will provision a remote UUID for the database, and sync the database to the remote. It will also log a URL to the console that you can open in a browser to connect to the database, as well as try to open the URL in a new tab. Tell us what you think about this workflow!

import { fireproof } from "@jimpick/fireproof-core";
import { connect } from "@fireproof/cloud";

const database = await fireproof("my-db-name");
const connection = await connect(database);

With React Hooks

In a React component, you can use the useFireproof hook to get the database and then call connect (it is safe to call connect multiple times, but in this example we're using a state variable to store the dashboard URL).

import { useFireproof } from "use-fireproof";
import { connect } from "@fireproof/cloud";

const { database } = useFireproof("my-db-name");
const [dashboardUrl, setDashboardUrl] = useState<string | undefined>();

// there is a useConnection hook coming soon
useEffect(() => {
  connect(database).then((connection) => {
    setDashboardUrl(connection.dashboardUrl?.toString());
  });
}, [database]);

The Second Argument

The second argument to connect is the remote database name. This will be assigned for you if you don't provide one, and the created name will be persisted locally.

The most common way to use this is if you want to sync to a remote database. The UUID will have been assigned when on first sync, and now you want to connect a new client to that remote.

const connection = await connect(database, "my-remote-uuid");

If you provide a name, it will be used as the remote database name. If you want to control the name, you should use a prefix unique to your app, so no one else uses your endpoint. This is useful if you want the database name to come from your URL slug, like /my-app/my-db-name.

const connection = await connect(database, `com.my-app.v1.${database.name}`);

Note: if your database already has data in it, connecting to a new remote will do nothing. To prevent data lost, you need to rename the local database to an unused name and the connect.

No Warranty, For Evaluation Purposes

This preview of Fireproof Cloud doesn't even have login, so don't expect your data to be persisted, etc. Please give us feedback on the workflow! We'll be adding login and access control soon.

The source of truth on this stuff is the team. Join us on Discord if you want to chat!