SDKs
TypeScript SDK Official Misar.Dev SDK for TypeScript / JavaScript — build, deploy, and manage apps via api.misar.io/dev.
The official Misar.Dev client SDK for TypeScript and JavaScript. This is the reference SDK and exposes the full Misar.Dev API surface. It ships with complete type definitions and runs on any runtime with native fetch (Node.js ≥18, Bun, Deno, edge runtimes).
npm install @misar/dev
pnpm add @misar/dev
import { MisarDevClient } from "@misar/dev" ;
const client = new MisarDevClient (process.env. MISARDEV_API_KEY ! );
const { project } = await client.projects. create ({ name: "my-app" });
console. log (project.id);
The constructor takes the API key as the first argument and an optional options object:
const client = new MisarDevClient ( "your-api-key" , {
baseURL: "https://api.misar.io/dev" ,
maxRetries: 3 ,
timeoutMs: 30_000 ,
});
Option Type Default baseURLstring"https://api.misar.io/dev"maxRetriesnumber3timeoutMsnumber30000
Requests send Authorization: Bearer <apiKey>. Responses with status 429, 500, 502, 503, or 504 are retried with exponential backoff up to maxRetries.
Method Description projects.list(params?)List projects ({ limit?, cursor? }) projects.create(data)Create a project ({ name, description? }) projects.get(id)Get a project projects.update(id, data)Update name/description/files/settings/is_public projects.delete(id)Delete a project projects.deploy(id, body?)Deploy ({ target?, subdomain?, customDomain?, envVariables?, ... }) projects.getDeployStatus(id)Get deploy status and live URL projects.getFiles(id)Get the project's file map projects.saveFiles(id, body)Create/update/delete project files
Method Description templates.list()List templates templates.get(id)Get a template templates.create(body)Create a template templates.update(id, body)Update a template templates.delete(id)Delete a template templates.use(id, variables?)Render a template to HTML with merge variables
Method Description apiKeys.list()List active keys apiKeys.create(data)Create a key (raw key returned once) apiKeys.revoke(keyId)Revoke a key
Method Description chat.complete(data)Run a chat completion chat.stream(data)AsyncIterable<string> of streamed content deltas
Method Description usage.get(params?)Usage summary ({ format?: "quick" | "dashboard", analytics?, days? }) usage.track(event)Track a build_complete or edit event
Method Description billing.getSubscription()Get the current subscription billing.checkout(data)Create a checkout session billing.portal()Get a billing portal URL
Requires the Pro plan or higher.
Method Description rag.index(body)Index project files for semantic search rag.search(projectId, query)Semantic code search rag.stats(projectId)Embedding statistics rag.clear(projectId)Clear all embeddings for a project
Method Description analytics.trackEvents(body)Send a batch of analytics events for a session
Failed requests throw a MisarDevError (with a numeric status and errorType). Transport-level failures throw a MisarDevNetworkError, which extends MisarDevError.
import { MisarDevError, MisarDevNetworkError } from "@misar/dev" ;
try {
await client.projects. get ( "missing-id" );
} catch (err) {
if (err instanceof MisarDevNetworkError ) {
console. error ( "network failure:" , err.message);
} else if (err instanceof MisarDevError ) {
console. error (err.status, err.errorType, err.message);
}
}