AirKV is a key-value database storage library built on top of Airtable.
Caution
Note: This project was developed in my free time to learn more about creating npm packages. However, Airtable recently introduced a soft limit of 1000 API requests per month for free accounts, which can restrict the package’s functionality for high-demand use cases.
- Easy Storage: Store and retrieve key-value pairs in Airtable without needing direct Airtable API calls.
- Seamless Setup: Just provide your Airtable token and workspace ID.
- Automatic Record Handling: Automatically creates and updates records as needed.
Install AirKV using npm:
npm install airkv
// const {AirKV} = require("airkv");
import {AirKV} from "airkv";
const airkv = new AirKV({
token : "..." ,
workspaceId : "...",
logging : true
});
(async()=>{
const base = await airkv.airbase("example");
await base.set("key1" , "value1");
const value = await base.get("key1");
await base.delete()
})();
To start using AirKV, initialize it with your Airtable credentials:
import { AirKV } from 'airkv';
const airkv = new AirKV({
token: 'airtable_api_token',
workspaceId: 'workspace_id',
logging: true // optional, false by default
});
Creates or retrieves an Airbase
instance used to store key-value pairs.
const base = await airkv.airbase('example');
Description: Retrieves the value associated with a given key.
const value = await base.get('username');
console.log(value); // value associated with 'username' or `null` if not found
Description: Stores or updates a key-value pair in the base.
await base.set('username', 'shivzee');
Description: Checks if a given key exists in the base.
const exists = await base.exists('username');
console.log(exists); // true or false
Description: Deletes a key-value pair from the base.
await base.delete('username');
Enable logging by setting the logging
option to true
when creating an AirKV
instance. This will log interactions with the Airtable API for debugging purposes.
Contributions are welcome! Submit a pull request or open an issue for any improvements or bug fixes.
Author : shivzee
IDE Used : VS Code
Buy me a coffee