JSPM

  • Created
  • Published
  • Downloads 1377
  • Score
    100M100P100Q130810F
  • License Apache-2.0

RushDB Javascript SDK

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@rushdb/javascript-sdk) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    RushDB Logo

    RushDB SDK for JavaScript and TypeScript

    NPM Version NPM License

    NPM Downloads npm bundle size

    Made with Node Package - Typescript

    HomepageBlogPlatformDocsExamples

    Highlights


    ✨ No Configuration Needed: Plug-and-play design requires no setup or configuration.

    🤖 Automatic Type Inference: Enjoy seamless type safety with automatic TypeScript inference.

    ↔️ Isomorphic Architecture: Fully compatible with both server and browser environments.

    🏋️ Zero Dependencies: Lightweight and efficient with no external dependencies.

    Installation


    NPM:

    npm install @rushdb/javascript-sdk

    YARN:

    yarn add @rushdb/javascript-sdk

    PNPM:

    pnmp add @rushdb/javascript-sdk

    Usage


    1. Obtain API Token: Grab one from the Dashboard.
    2. Build anything: Easily push, search, and manage relationships within your data.

    TLDR;

    import RushDB, { Model } from '@rushdb/javascript-sdk'
    
    // Setup SDK
    const db = new RushDB("API_TOKEN", {
      // This is the default URL; no need to provide it unless overriding.
      url: "https://api.rushdb.com", 
    });
    
    // Push any data, and RushDB will automatically flatten it into Records 
    // and establish relationships between them accordingly.
    await db.records.createMany("COMPANY", {
      name: 'Google LLC',
      address: '1600 Amphitheatre Parkway, Mountain View, CA 94043, USA',
      foundedAt: '1998-09-04T00:00:00.000Z',
      rating: 4.9,
      DEPARTMENT: [{
        name: 'Research & Development',
        description:
            'Innovating and creating advanced technologies for AI, cloud computing, and consumer devices.',
        PROJECT: [{
          name: 'Bard AI',
          description:
              'A state-of-the-art generative AI model designed for natural language understanding and creation.',
          active: true,
          budget: 1200000000,
          EMPLOYEE: [{
            name: 'Jeff Dean',
            position: 'Head of AI Research',
            email: 'jeff@google.com',
            dob: '1968-07-16T00:00:00.000Z',
            salary: 3000000
          }]
        }]
      }]
    })
    
    
    // Find Records by specific criteria
    const matchedEmployees = await db.records.find({
      labels: ['EMPLOYEE'],
      where: {
        position: { $contains: 'AI' },
        PROJECT: {
          DEPARTMENT: {
            COMPANY: {
              rating: { $gte: 4 }
            }
          }
        }
      }
    })
    
    const company = await db.records.findUniq('COMPANY', {
      where: {
        name: 'Google LLC'
      }
    })
    
    // Manage relationships
    await company.attach(matchedEmployees, { type: "WORKING_AT" })
    You're Awesome! 🚀

    Check the Docs and Examples Repository to learn more 🤓

    Contributing


    See CONTRIBUTING.md.