Python

DB1 is like a global python dict in the cloud, accessible from everywhere.

  1. Install the client

    pip install db1
    
  2. Upload and retrieve data

    from db1 import DB1
    
    # upload anything
    DB1['my_key'] = {
        "message" : "Hey, I'm using DB1! 🤙",
        "temperature" : 21.2421,
        "numbers" : [1, 2, 3, "four"]
    }
    
    # retrieve anywhere
    my_value = DB1['my_key']
    
  3. View data in browser

    Go to db1.io and enter your key, or go directly to https://db1.io/?key=my_key.

    https://db1.io/?key=@example/my_key

  4. Embed view in Notion

    To embed the table above in your Notion page, simply paste the view URL https://db1.io/?key=my_key anywhere and click “embed”.

JavaScript

DB1 is like a global localStorage in the cloud, accessible from everywhere.

  1. Install the client

    npm install db1
    
  2. Upload and retrieve data

    import { db1 } from "db1";
    
    // example data
    let myValue = {
    	message: "Hey, I'm using DB1! 🤙"
    	temperature: 21.2421,
    	numbers: [1, 2, 3, "four"]
    }
    
    // upload anything
    await db1.setItem("my_key", myValue);
    
    // retrieve anywhere
    myValue = await db1.getItem("my_key");
    
  3. View data in browser

    Go to db1.io and enter your key, or go directly to https://db1.io/?key=my_key.

    https://db1.io/?key=@example/my_key

  4. Embed view in Notion

    To embed the table above in your Notion page, simply paste the view URL https://db1.io/?key=my_key anywhere and click “embed”.

CLI

  1. Install the client

    The CLI is installed alongside the python client.

    pip install db1
    

    If you can’t access db1 from the command line after installing the pip package, you may need to add the installed python scripts folder to your PATH.

    cho 'export PATH="$PATH:~/.local/bin"' >> ~/.bashrc
    source ~/.bashrc
    
  2. Upload and retrieve data

    # upload anything
    db1 set my_key '{"in_temp": 21.37, "out_temp": 12.65, "entrance_open": true}'
    
    # retrieve anywhere
    db1 get my_key
    
  3. View data in browser

    Go to db1.io and enter your key, or go directly to https://db1.io/?key=my_key.

    https://db1.io/?key=@example/home_automation