Getting Started

Everything here runs on Node.js 18 or later. No native toolchain, no platform-specific build step — KopScript compiles to plain JavaScript and runs identically on Windows, macOS, and Linux.

1. Install

Add it to a project as a dev dependency (recommended — keeps the compiler version pinned per-project, same as you'd install TypeScript):

npm install -D kopscript

Or install it globally for a bare ks command everywhere:

npm install -g kopscript

2. Write your first program

Save this as hello.ks:

class Greeter {
  private string Name;
  constructor(string name) { this.Name = name; }
  public string Greet() { return $"Hello, {this.Name}!"; }
}

Greeter g = new Greeter("world");
print(g.Greet());

3. Run it

With a local install:

npx ks run hello.ks

With a global install, drop npx:

ks run hello.ks

This type-checks the file and runs the compiled output with Node in one step, printing Hello, world!.

4. Or just build it

ks build type-checks and emits a plain .js file next to the source, without running it — useful for compiling a whole project, or handing the output to a plain Node/TS project that just wants to import it directly:

npx ks build hello.ks
node hello.js

5. Building a UI? Add Kopular

Kopular is KopScript's own component framework — reactive state<T>, constructor-injected services, a real router, and templates that compile to real, type-checked code instead of a separate DI container or interpreted template layer.

Starting a new browser-facing project, rather than adding Kopular into an existing one? Scaffold it instead of hand-writing the DOM/Kopular extern bindings and vendor/serve scripts every such project needs:

npx kp new my-app
cd my-app
npm install
npm start

kp ships from the kopular package itself (not from ks — scaffolding a Kopular app is a framework concern, not a language one) and generates a real, working Component, not a placeholder. Adding Kopular into a project that already exists is just the normal install:

npm install kopular

See the Framework Docs for how a component actually looks, or Home for one running for real on this page.

Next

Examples walks through the language's more interesting features one at a time. Language Docs and Framework Docs are the fuller reference for KopScript and Kopular respectively.