You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP β†’
Socket
Book a DemoInstallSign in
Socket

gitdb-database

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gitdb-database

A production-ready CLI tool for managing a NoSQL database using GitHub repositories as storage

2.2.1
latest
Source
npmnpm
Version published
Weekly downloads
173
-90.47%
Maintainers
1
Weekly downloads
Β 
Created
Source

πŸ—‚οΈ GitDB: Essential Guide & SDK Reference

Production-ready NoSQL database that stores data in Git repositories with advanced features like GraphQL, AI-powered queries, version control, and performance optimizations.

SDK / LanguageDocs / RepoPackage Registry
JavaScript/TSgitdb-client (npm)Docs
Gogitdb-go-client (GitHub)GoDoc
PHPgitdb-php-client (GitHub)Packagist
Rustgitdb-client (crates.io)Docs
Pythongitdb-client (PyPI)Docs
Rubygitdb-client (RubyGems)Docs

πŸ“ GitDB CLI Command Table

CommandUsage & OptionsDescription
Connectgitdb connect -t <token> -o <owner> -r <repo>Connect CLI to a GitHub repo as your database
List Collectionsgitdb collectionsList all collections (tables)
Create Collectiongitdb create-collection <name>Create a new collection
Delete Collectiongitdb delete-collection <name>Delete a collection and all its documents
List Documentsgitdb documents <collection>List all documents in a collection
Create Documentgitdb create-doc <collection> <json-data>Add a new document to a collection
Read Documentgitdb read-doc <collection> <id>Read a document by its ID
Update Documentgitdb update-doc <collection> <id> <json-data>Update a document by its ID
Delete Documentgitdb delete-doc <collection> <id>Delete a document by its ID
Find Documentsgitdb find <collection> <query>Find documents matching a MongoDB-style query
Find One Documentgitdb findone <collection> <query>Find a single document matching the query
Version Historygitdb version history <collection>Show Git commit history for a collection
Rollback Versiongitdb version rollback <collection> --commit <hash>Roll back a collection to a previous commit
Start Servergitdb serverStart the GitDB server (REST/GraphQL API)
Start Server (bg)gitdb server-startStart the server in the background
Stop Servergitdb server-stopStop the server
Server Statusgitdb server-statusCheck the server status
Enable SuperModegitdb supermode enable --cache-size <n>Enable performance optimizations
Show GraphQL Schemagitdb graphql schemaShow the current GraphQL schema
Interactive Shellgitdb shellStart an interactive shell for running commands
Shell: Set Tokenset token <token>Set GitHub token (in shell)
Shell: Set Ownerset owner <owner>Set repository owner (in shell)
Shell: Set Reposet repo <repo>Set repository name (in shell)
Shell: Use Collectionuse <collection>Switch to a collection (in shell)
Shell: Show Collectionsshow collectionsList all collections (in shell)
Shell: Show Docsshow docsList documents in current collection (in shell)
Shell: Insertinsert <JSON>Insert a document (in shell)
Shell: Find by IDfind <id>Find document by ID (in shell)
Shell: Find by Queryfindone <json-query>Find document by query (in shell)
Shell: Countcount [json-query]Count documents (optionally by query, in shell)
Shell: Updateupdate <id> <JSON>Update document by ID (in shell)
Shell: Deletedelete <id>Delete document by ID (in shell)
Shell: HelphelpShow help (in shell)
Shell: ExitexitExit the shell

🏁 Getting Started

  • Create a GitHub repo for your data.
  • Generate a GitHub token with repo permissions.
  • Install the CLI:
npm install -g gitdb-database
  • Connect:
   gitdb connect -t <token> -o <owner> -r <repo>

πŸ—‚οΈ GitDB Command Reference & Workflow Guide

1. GitDB CLI: Core Commands

Database Connection & Setup

  • gitdb connect -t <token> -o <owner> -r <repo>
    • Connects your CLI to a GitHub repository as your database.
    • Example:
      gitdb connect -t ghp_abc123 -o myuser -r mydb-repo

Collection Management

  • gitdb collections β€” List all collections
  • gitdb create-collection <name> β€” Create a new collection
  • gitdb delete-collection <name> β€” Delete a collection

Document Operations

  • gitdb documents <collection> β€” List all documents in a collection
  • gitdb create-doc <collection> <json-data> β€” Add a new document
  • gitdb read-doc <collection> <id> β€” Read a document by ID
  • gitdb update-doc <collection> <id> <json-data> β€” Update a document
  • gitdb delete-doc <collection> <id> β€” Delete a document by ID

Querying

  • gitdb find <collection> <query> β€” Find documents matching a MongoDB-style query
  • gitdb findone <collection> <query> β€” Find a single document matching the query

Version Control & History

  • gitdb version history <collection> β€” Show Git commit history for a collection
  • gitdb version rollback <collection> --commit <hash> β€” Roll back a collection to a previous commit

Server Management

  • gitdb server β€” Start the GitDB server (REST/GraphQL API)
  • gitdb server-start / gitdb server-stop / gitdb server-status β€” Manage the server process

Advanced Features

  • gitdb supermode enable --cache-size <n> β€” Enable performance optimizations
  • gitdb graphql schema β€” Show the current GraphQL schema
  • gitdb shell β€” Start an interactive shell for running commands

2. Typical GitDB Workflow

A. Initial Setup

  • Create a GitHub repo for your data.
  • Generate a GitHub token with repo permissions.
  • Connect using the CLI:
gitdb connect -t <token> -o <owner> -r <repo>

B. Creating Collections & Documents

  • Create collections for your data types:
   gitdb create-collection users
   gitdb create-collection products
  • Insert documents:
   gitdb create-doc users '{"name":"Alice","email":"alice@example.com"}'
   gitdb create-doc products '{"name":"Laptop","price":999.99}'

C. Querying & Updating Data

  • Find users over 25:
  gitdb find users '{"age":{"$gt":25}}'
  • Update a user:
    gitdb update-doc users <id> '{"email":"new@email.com"}'
    
  • Delete a product:
  gitdb delete-doc products <id>

D. Version Control

  • View history:
    gitdb version history users
    
  • Rollback:
  gitdb version rollback users --commit <hash>

E. Server/API Usage

  • Start the server:
gitdb server
  • Access REST API:
    http://localhost:7896/api/v1/collections/users
  • Access GraphQL API:
    http://localhost:7896/graphql

3. Interactive Shell Commands

Inside gitdb shell, you can use:

  • set token <token>
  • set owner <owner>
  • set repo <repo>
  • use <collection>
  • create-collection <name>
  • show collections
  • show docs
  • insert <JSON>
  • find <id>
  • findone <json-query>
  • count [json-query]
  • update <id> <JSON>
  • delete <id>
  • help
  • exit

4. SDK Usage Example (JavaScript/TypeScript)

import { GitDBClient } from 'gitdb-client';

const client = new GitDBClient({
  owner: 'your-github-username',
  repo: 'your-repo',
  token: 'your-github-token',
});

// Insert a document
await client.insert('users', { name: 'Alice', email: 'alice@example.com' });

// Query documents
const users = await client.findOne('users', { name: 'Alice' });

// Update a document
await client.update('users', users[0].id, { age: 31 });

// Delete a document
await client.delete('users', users[0].id);

5. Where to Find More

If you want a deep-dive into any specific command, workflow, or integration, just ask!

Keywords

nosql

FAQs

Package last updated on 13 Jul 2025

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