@nc-blocks/core
v0.1.0
Published
Framework-agnostic runtime for NocoDB Blocks — models, host bridge, permissions
Readme
@nc-blocks/core
The runtime SDK for building NocoDB Blocks — apps that run inside NocoDB and work with your data.
Your block runs as the signed-in user, so it uses their existing permissions — you never handle tokens or credentials.
Install
npm install @nc-blocks/coreOr scaffold a ready-to-run block with the CLI (recommended), which sets this up for you:
npx @nc-blocks/cli create "My Block" --host https://your-nocodb.comUsage
import { initializeBlock } from "@nc-blocks/core";
const nc = await initializeBlock();
// Explore the base
const table = nc.base.tables[0];
// Read records
const { records } = await nc.getRecords(table.id);
// Create, update, delete
await nc.createRecords(table.id, [{ fields: { Name: "Ada" } }]);
// Store settings shared across everyone using the block
await nc.config.set("theme", "dark");The nc client gives you:
nc.base— the tables, fields, views, and the current user's permissions- records —
getRecords,getRecord,createRecords,updateRecords,deleteRecords nc.config— a shared key/value store that persists across sessionsnc.sessionandnc.theme— the current user and the UI theme
Links
- CLI to create, run, and ship blocks:
@nc-blocks/cli - NocoDB
License
MIT
