Avora Node SDK for TypeScript and JavaScript
@avora/node-sdk is the TypeScript and JavaScript package behind Avora's local custom node tools. Use it to create node projects, validate their structure and tagged templates, exchange private drafts, and coordinate generation and local tests from your own tools.
The SDK is MIT licensed and available in the public Avora repository. It runs independently of VS Code and the Avora web app. Backend generation uses your authenticated Avora server.
Install from GitHub
Use Node.js 22 or later. Clone the public repository and build the SDK:
git clone https://github.com/Avora-ai-backend-generator/Avora.git
cd Avora/avora-sdk
npm ci
npm run build
npm pack
Install the resulting avora-node-sdk-<version>.tgz in your JavaScript or TypeScript project with npm install /absolute/path/to/avora-node-sdk-<version>.tgz. Versioned package archives are also available from GitHub Releases. GitHub is the distribution channel documented here; an npm registry release is separate.
Create a local project
const { randomUUID } = require('node:crypto');
const {
createLocalProject,
parseProjectDocument,
assembleDraft,
} = require('@avora/node-sdk');
const { manifest, files } = createLocalProject('Scale Number', randomUUID());
const result = parseProjectDocument(JSON.stringify(manifest), 'manifest');
console.log(result.diagnostics);
// Write manifest to avora.node.json and each entry in files to its mapped path.
const payload = assembleDraft(manifest, files);
Creating and checking a project needs no account. The scaffold contains placeholder code; implement its behavior and add independent expected results before treating it as a working node. In the terminal, Avora CLI node commands write these files for you.
Files and manifest versions
| File | Purpose |
|---|---|
avora.node.json | Identity, node structure, variants, template and artifact mappings |
templates/*.avora | Editable source containing Avora HLV1 tags |
dependencies/fastapi/requirements.txt | Authoritative Python dependency declarations |
tests/cases/*.avora-test.json | Configuration, runtime inputs, and expectations |
tests/context/workspace.json | Scratch entities and enums used by generation |
assets/*.png | Portable node logos, when present |
avora.lock | Portable dependency lock; commit with authored files |
generated/fastapi/ and .avora/ | Disposable generated application and local runtime state |
New scaffolds use format 3 with mapped dependency files. Adding a logo upgrades the manifest to format 4. Formats 1–3 remain readable. Format 2 introduced local project identity and scenario/context mappings. Keep projectId, linked draftId, and revision stable; use the SDK's migration helpers for older manifests.
Keep .env.local and .avora/ out of version control. Logo assets and authored dependency files belong with the node's source.
Choose the right entry point
| Import | APIs and use |
|---|---|
@avora/node-sdk | createLocalProject, parseProjectDocument, projectSchemas, getTagCatalog, validateTemplate, materializeDraft, assembleDraft, NodeDraftClient; no Node filesystem imports |
@avora/node-sdk/dist/generation | generateNode: authenticated generation of a selected local case |
@avora/node-sdk/dist/environment | prepareNode: managed Python and locked dependencies |
@avora/node-sdk/dist/testing | checkNode, testNode, readNodeTestState: validation, execution, reports |
@avora/node-sdk/dist/caseGeneration | planNodeCases, applyNodeCasePlan: review and apply bounded starter cases |
@avora/node-sdk/dist/nodePublication | readNodePublication, publishNode: inspect a publication payload, publish, or update a listing |
@avora/node-sdk/dist/logoNode | addNodeLogo, prepareLogoUpdate, readAppearance: Node.js logo import |
@avora/node-sdk/dist/browserAuth | browserLogin, refreshNativeSession, revokeNativeSession: browser account connection |
@avora/node-sdk/types/scenario and types/run | Type declarations for cases, context, and test reports |
The root entry point supports browser tooling. Generation, environment, testing, local publication, logo-file import, and browser login submodules use Node.js. Browser logo rendering requires the caller's renderer adapter.
Node structure and categories
Use Flow, Variable, Data, Auth, Integrations, or Other for new node categories. Older Control Flow, Security, and Integration values remain accepted for existing definitions; the app displays them in the current groups. The Logic Flow Builder action nodes describes the built-in actions. The SDK authors portable custom definitions; discover installed built-ins and marketplace definitions through the app or MCP catalog tools.
Keep the reusable definition separate from a case's selected variant and configuration. Input definitions can use localLogicFlowIds to expose template-provided values only inside selected child flows, such as a loop's current item or index. Omitted or empty scope means a shared input. Local scope must reference existing flow IDs, and local keys must name variables assigned by the owner template before the child flow runs.
Generate starter cases
planNodeCases prepares a bounded case plan from the node structure, and applyNodeCasePlan writes the reviewed plan. Existing authored cases and expectations are preserved. Generated cases contain no expected result and remain Not tested until you supply independent expectations and run them. See CLI case generation for the terminal workflow.
Generate, prepare, and test
const { generateNode } = require('@avora/node-sdk/dist/generation');
const { prepareNode } = require('@avora/node-sdk/dist/environment');
const { testNode } = require('@avora/node-sdk/dist/testing');
async function runCase(folder, getAccessToken) {
const casePath = 'tests/cases/example.avora-test.json';
const generate = signal => generateNode({
folder, casePath, signal, token: getAccessToken,
});
const generated = await generate();
const prepared = await prepareNode({ folder, casePath, python: '3.11', generate });
const report = await testNode({ folder, casePath, generate });
return { generated, prepared, report };
}
Generation defaults to https://mcp.avora.dev/api/v1 and requires a valid session. Pass apiUrl to generateNode for another environment and use a session approved for that backend. Prepare downloads managed Python tooling on first use and installs supported PyPI wheel dependencies. Testing runs a disposable local FastAPI application and compares its response with the case's expectations. These actions reuse matching generation and dependency state.
The first local execution adapter supports pure FastAPI nodes with empty or enum-only context. Generation can accept scratch entity schemas, but that does not add database fixture execution. Cases without expectations remain Not tested, and changed source or inputs make previous reports Outdated. Generated code runs with your local user permissions.
Private drafts and conflicts
materializeDraft converts a private draft into mapped files; assembleDraft reconstructs the API payload while retaining metadata. Use NodeDraftClient to read or update a draft with its expected revision. On DraftConflictError, read the current draft and reconcile changes before another update.
Local generation and tests do not sync or publish a node. Use the extension's draft workflow to link and sync it. Marketplace publication is a separate action, available in Avora, the CLI, the extension, or the SDK.
Publish a local node
Use readNodePublication(folder) from @avora/node-sdk/dist/nodePublication to inspect the validated payload. publishNode({ folder, dryRun: true }) returns it without login or uploads. Authenticated publication requires apiUrl, a token callback, an account with templates:publish permission, and a backend that supports local publishing.
publishNode({ folder, apiUrl, token }) creates and verifies a marketplace listing. Use update: true to release changes to its recorded identity, or supply templateId and expectedVersion to update an existing listing you own. Version conflicts stop the update. Keep .avora/publication.json when retrying an uncertain result; it records the publication identity and retry receipt.
Publication includes saved structure, templates, dependencies, and appearance. Tests and environment files are excluded, and private draft identity is preserved. See CLI publishing or Publish, Share, and Clone for the user workflow.
More examples
The SDK README describes source diagnostics, language projections, case generation, dependency migrations, logos, and native login. Browse the Markdown documentation for the complete guide index.