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 🙏

© 2026 – Pkg Stats / Ryan Hefner

g-drive-database

v1.0.1

Published

A universal, NoSQL-like database that uses Google Drive as its storage backend.

Readme

G-Drive Database

A universal, NoSQL-like database that uses Google Drive as its storage backend.

Features

  • Universal: Works in both Browser and Node.js environments.
  • Serverless: No traditional database server required, uses users' Google Drive.
  • NoSQL Interface: Familiar MongoDB-like syntax for collections (insertOne, find, updateOne, deleteOne).
  • TypeScript Ready: Strongly typed for professional development.

Installation

npm install g-drive-database

Authentication

Since this package interacts with Google Drive, you will need a valid Google Drive API Access Token. You can obtain this token in your application using Google Identity Services (for React/Frontend) or Google OAuth2 Client (for Node.js).

Make sure the token has the https://www.googleapis.com/auth/drive.file scope (or drive full scope).

Usage

import { GDriveDatabase } from "g-drive-database";

// Initialize the database with your access token
const db = new GDriveDatabase({
  accessToken: "YOUR_GOOGLE_ACCESS_TOKEN", // Keep this token updated!
  folderName: "My-App-Database", // Optional: Custom folder name in Drive (defaults to GDrive-DB)
});

async function run() {
  // Connect to Google Drive (creates folder and metadata file if they don't exist)
  await db.connect();

  // Get or create a collection (this creates a users.json file in the folder)
  const users = db.collection("users");

  // Insert a document
  const newUser = await users.insertOne({ name: "Ali", role: "admin" });
  console.log("Inserted:", newUser);

  // Find documents
  const allUsers = await users.find();
  console.log("All users:", allUsers);

  const admins = await users.find({ role: "admin" });
  console.log("Admins:", admins);

  // Update a document
  const updatedUser = await users.updateOne(
    { name: "Ali" },
    { role: "superadmin" },
  );
  console.log("Updated:", updatedUser);

  // Delete a document
  await users.deleteOne({ name: "Ali" });
  console.log("Deleted successfully.");
}

run();

Environment Variables (.env)

If you are developing this package or using it in a Node.js project, make sure to keep your secrets safe.

Create a .env file in your project root:

GOOGLE_CLIENT_ID=your_client_id_here
GOOGLE_CLIENT_SECRET=your_client_secret_here
GOOGLE_REFRESH_TOKEN=your_refresh_token_here

Note: Do not commit .env to version control. An .env.example is provided for reference.

How it Works

  1. Folder: On connect(), the package checks if the database folder exists in the user's Drive. If not, it creates it.
  2. Metadata: A metadata.json file is automatically created inside the folder to describe the storage schema.
  3. Collections: Each collection (e.g., db.collection('users')) corresponds to a .json file inside the database folder.
  4. Operations: CRUD operations read and update the corresponding .json file.

Publishing

To publish this package:

  1. Run npm run build
  2. Run npm publish