- SuiteCloud
- NetSuite
- Open-Source
A TypeScript starter for SuiteScript
A working reference for TypeScript in SuiteCloud projects and a step toward official support in the CLI.

Too many SuiteScript bugs are found the expensive way: deploy to an account, run
the script, read the execution log, fix, and deploy again. The SuiteCloud CLI
already ships a solid testing framework with Jest, but type checking, linting,
and formatting are left to each developer. We built
suitecloud-ts (opens in a new tab), an
open-source starter project based on TypeScript 7 or later that sets up all
three. It hooks into the SuiteCloud CLI commands you use today and is optimized
for AI coding agents.
Toward official support
TypeScript for SuiteScript is not a new idea. Many teams already run their own setup, and every one of them solves similar problems in slightly different ways. We don't want to add another competing standard (opens in a new tab) to the pile, so we're sharing this as a working reference for an active proposal (opens in a new tab) to bring TypeScript support to the SuiteCloud CLI.
The proposal grew out of conversations with members of the SuiteCloud team at
SuiteWorld 2025, both after their sessions and at DevLand. It compares three
folder layouts, and suitecloud-ts follows Option 3, which keeps TypeScript
sources outside FileCabinet/. Rather than argue for it in the abstract, we
wanted something people can actually run.
For a service provider, there's a less obvious reason to want official TypeScript support: what we build should be maintainable by any NetSuite developer, not just us.
We can't assume that developer will know TypeScript. Without a setup
recommended by Oracle, choosing TypeScript for a customer's account can make
their scripts harder to support later. With TypeScript scaffolded during
project:create, the same way the CLI already offers Jest, our customers would
have a documented setup to learn and official support behind it.
This is also why the starter begins with Account Customization Projects (ACPs), since a SuiteApp is usually maintained by the company that publishes it. Most of the setup still applies to SuiteApps, and we plan to support them as well.
Enabling gradual adoption
NetSuite runs SuiteScript as AMD modules from the account's File Cabinet, which
the CLI updates from the local FileCabinet/ folder. The starter keeps all your
script sources, TypeScript and JavaScript alike, outside that folder and builds
them into it:
src/ # defaultProjectFolder for the SuiteCloud CLI
├ FileCabinet/
│ ├ SuiteScripts/ # build output, deployed but not in Git
│ └ ... # other File Cabinet folders (e.g. Templates/)
├ Objects/ # SuiteCloud XML objects, unchanged
├ SuiteScripts/ # TS and JS sources, in Git but not deployed
├ deploy.xml
└ manifest.xmlPlain JavaScript lives in the same src/SuiteScripts/ folder as TypeScript, and
TypeScript can import it, so an existing project can adopt TypeScript one file
at a time. Jest tests can be written in TypeScript too, and they're
type-checked like the sources.
The CLI keeps working as usual
The starter hooks into the CLI's beforeExecuting lifecycle through
suitecloud.config.js, so there is no extra command to remember. Commands such
as project:deploy build the project first, so a type error stops the
deployment before anything reaches the account.
A two-step build for TypeScript 7+
TypeScript 7 is a ground-up rebuild of the compiler that runs considerably faster, but it also dropped support for compiling to AMD (opens in a new tab). Staying on an older compiler would have been the easy way out, but we chose to handle the migration once, so projects built on the starter get the new compiler today and can keep upgrading to future TypeScript versions.
The build therefore runs in two steps:
tsccompilessrc/SuiteScripts/**/*.tsinto ES modules in an intermediatebuild/folder.- Rollup transforms that output into AMD modules under
src/FileCabinet/SuiteScripts/, keeping the original module structure.
Since tsc already runs to check types, we let it emit the JavaScript too.
Rollup only changes the module format and handles a few NetSuite quirks, such as
keeping the @NApiVersion and @NScriptType annotations at the top of each
file. Neither step minifies the code. The deployed files read like the source
without its types, so stack traces in the execution log are still easy to
follow.
Ready for AI coding agents
Type checking, linting, formatting, and tests help everyone on a project, and that includes AI coding agents. An agent works best when it can verify its own change quickly and deterministically. With all four checks in place, it finds out whether a script compiles and passes its tests before anyone deploys it.
Agents also need context, so the starter includes two things for them:
AGENTS.mdtells an agent where to make changes, which checks to run for small and large changes, and how to write TypeScript and JavaScript SuiteScripts in this project. It also tells the agent never to deploy to an account unless asked..agents/skills/includes a selection of the NetSuite agent skills (opens in a new tab) that Oracle publishes. They cover the best practices in the SAFE Guide (opens in a new tab), record field IDs, role permissions, secure coding, and SuiteScript 2.1 upgrades, among others.
Using npm packages in SuiteScript
SuiteScript can't load npm packages directly, since NetSuite only runs AMD modules from the File Cabinet. The starter solves this with a library bundler that reuses the build's Rollup setup to turn each package into a self-contained AMD module with its types, which scripts import like any other file.
The build and linter reject direct package imports, so a script can't reach an account with an import NetSuite won't resolve. The docs (opens in a new tab) explain how to add a package, and Zod v4 is included as a working example.
A sample TypeScript RESTlet
Here is a simplified version of the repository's sample TypeScript RESTlet (opens in a new tab), which uses Zod to validate the request body:
/**
* @NApiVersion 2.1
* @NScriptType Restlet
*/
import type { EntryPoints } from 'N/types'
import type { Response } from './utils/response'
import z from './lib/zod'
type Data = Record<string, unknown>
const PayloadSchema = z.object({
echo: z.literal(true),
})
type Payload = z.infer<typeof PayloadSchema>
export const post: EntryPoints.RESTlet.post<Data, Response<Payload>> = (
body,
) => {
const result = PayloadSchema.safeParse(body)
if (!result.success) {
return {
status: 'bad_request',
message: z.prettifyError(result.error),
}
}
return {
status: 'success',
data: result.data,
}
}The EntryPoints type and the rest of the N/* types come from
@hitc/netsuite-types (opens in a new tab).
Thanks to Head in the Cloud Development (opens in a new tab)
for maintaining them. We're proud to have contributed to the package, even if
it was a
minor fix (opens in a new tab).
Developer experience extras
Beyond the build, the starter includes a set of optional quality-of-life features:
- ESLint with TypeScript support and
requirejsrules for plain JavaScript. - Prettier formatting.
- Git hooks for linting, formatting, and Conventional Commits.
- A GitHub Actions workflow for pull request validation.
- An
.nvmrcand a Nix flake withdirenvsupport.
None of them is part of the build, so you can remove any of them, and the docs (opens in a new tab) explain how.
Getting started
The starter is released under MIT-0 (opens in a new tab), so you can copy it into your own projects without keeping any notice or attribution.
To start a new project, click Use this template on the repository page, or create one with the GitHub CLI (opens in a new tab):
gh repo create my-project --template anagram-dev/suitecloud-ts --private --clone
cd my-projectEither way, the new repository starts with a fresh history. Then follow the
remaining steps in the README's
Getting Started (opens in a new tab)
section, which also explains how to clone the starter without GitHub. From
there, write your scripts in src/SuiteScripts/ and use the CLI as you always
have.
Feedback and contributions
This is the first public release of suitecloud-ts, and we'd like it to work
for more projects than ours.
Since SuiteWorld 2025, we've met with the SuiteCloud team, and they've been open
to contributions from the community. If this project's approach holds up, we'd
like to contribute some version of it as scaffolding that project:create can
offer, and at that point this repository will have done its job.
Until the CLI supports TypeScript, using it in a customer's account remains a trade-off to weigh case by case, and we'd like to hear what would make TypeScript scripts easier for other developers to maintain. If official support comes, we'll do our best to provide instructions or helpers that projects built on the starter can use to adopt it.
If you try the starter, issues and pull requests are welcome on GitHub (opens in a new tab). If you already have a TypeScript setup for SuiteScript, we'd especially like to hear how yours differs. Open an issue on the repository or comment on issue #976 (opens in a new tab), and link your setup if it's public.
One shared answer, ideally in the CLI itself, beats everyone maintaining their own.
About the author

Joaquín Gatica · CTO & Co-Founder
Joaquín has close to two decades of software engineering experience and over a decade applying it to NetSuite-driven businesses. He has designed and built integrations, commerce platforms, and custom applications, first at NetSuite, through its acquisition by Oracle, and now at AnagramDev. He's also active in the developer community and has been a speaker at software development meetups.