Runtime Manual/Getting Started/Quick Start

Quick Start

Run TypeScript, tests, and a tiny HTTP handler with bee

1. First script

Beejs runs .ts / .tsx without tsc or ts-node. Types are stripped by oxc, then executed on V8.

Create hello.ts:

code
const runtime = "Beejs";
console.log(`hello from ${runtime}`);
code
bee run hello.ts
# hello from Beejs

There is no project-wide typecheck. Use tsc --noEmit in CI if you want that.

One-liners and a REPL:

code
bee eval "console.log(crypto.randomUUID())"
bee repl

2. Tests

Jest-style describe / test / expect. Stable since v1.15.0.

code
// math.test.js
describe("math", () => {
  test("adds numbers", () => {
    expect(2 + 3).toBe(5);
  });
});
code
bee test
bee test math.test.js
bee test --watch

bee test --parallel is rejected (exit code 2): V8 isolates are not shared across threads.


3. HTTP (Preview)

bee serve loads a module that exports fetch:

code
// app.js
module.exports = {
  fetch() {
    return new Response("ok");
  },
};
code
bee serve app.js --host 127.0.0.1 --port 3000

You can also write a node:http server and bee run server.ts. TLS is rustls HTTP/1.1 when --https --cert --key are set.


4. Arguments

Arguments after the filename are process.argv:

code
console.log(process.argv.slice(2));
code
bee run cli.ts --name myapp --port 8080
# [ '--name', 'myapp', '--port', '8080' ]

5. Watch

code
bee run --watch hello.ts
bee run --watch --debounce 200 app.ts

6. Suggested layout

code
my-bee-app/
├── package.json
├── tsconfig.json          # optional, for the editor
├── src/index.ts
└── tests/math.test.js
code
{
  "name": "my-bee-app",
  "scripts": {
    "dev": "bee run --watch src/index.ts",
    "start": "bee run src/index.ts",
    "test": "bee test"
  }
}

Next: CLI reference · sandbox · bundle / compile