Introduction
SuitePortal is a typed, metadata-driven ORM for NetSuite built on SuiteQL and REST APIs.
SuitePortal is a Prisma-like ORM for NetSuite. It introspects your NetSuite account, generates TypeScript types for every record, and gives you a typed query client that compiles to SuiteQL.
SuitePortal works with any NetSuite account that has SuiteQL enabled. Supports both Token-Based Authentication (OAuth 1.0a) and OAuth 2.0 Machine-to-Machine — no SuiteApps or bundles required.
How It Works
Introspect
Connect to your NetSuite account via OAuth 1.0a or OAuth 2.0 M2M, fetch the REST metadata catalog and custom records/fields via SuiteQL, and write a normalized schema.json.
npx suiteportal introspectGenerate
Read schema.json and emit TypeScript interfaces for every record type, plus a typed client wrapper.
npx suiteportal generateQuery & Mutate
Import the generated client and query or mutate your NetSuite data with full autocomplete and type safety.
const customers = await ns.customer.findMany({
select: { companyName: true, email: true },
where: { isInactive: { equals: false } },
take: 50,
});Quick Example
import { createClient } from './.suiteportal/client';
const ns = await createClient({
accountId: '1234567_SB1',
consumerKey: '...',
consumerSecret: '...',
tokenId: '...',
tokenSecret: '...',
});
const customers = await ns.customer.findMany({
select: { id: true, companyname: true, email: true },
where: { isinactive: false },
take: 10,
});
const total = await ns.customer.count();
console.log(`Found ${total} customers`);Features
- Zero runtime dependencies on the connector — pure Node.js
crypto+fetch - OAuth 1.0a TBA and OAuth 2.0 M2M authentication
- Automatic retry with exponential backoff, rate limiting, and timeouts
- SuiteQL query builder with
where,select,orderBy,take,skip - Prisma-like API —
findMany,findFirst,count,$queryRaw - Mutations —
create,update,deletevia the REST Record API - Relations —
includerelated records with automatic LEFT JOINs - 142+ record types introspected from a real NetSuite sandbox
- TypeScript-first — strict mode, full type inference