DEV Community

Eddy Ortega
Eddy Ortega

Posted on

Introducing Golt: A Lightweight TypeScript Runtime Powered by Go

Introducing Golt: A Lightweight TypeScript Runtime Powered by Go

Over the last few weeks, I have been working on Golt, a small TypeScript/JavaScript runtime written in Go.

The idea behind Golt is simple:

Write backend scripts and small APIs in TypeScript, then run them inside a Go-powered runtime with a small and explicit API surface.

Golt is not trying to be a full Node.js replacement. Instead, it focuses on a more controlled runtime experience where only the APIs provided by Golt are available.

Why Golt?

I wanted a runtime that could feel familiar for TypeScript developers, but still be powered by Go internally.

The goal is to keep the developer experience simple:

golt init my-api
cd my-api
golt run app.ts
Enter fullscreen mode Exit fullscreen mode

And then write backend code like this:

const app = Golt.App();

app.use(Golt.logger({ format: "dev" }));

app.get("/", (ctx) => {
  ctx.Json({
    message: "Hello from Golt!",
    runtime: "golt",
  });
});

app.serve(3000);
Enter fullscreen mode Exit fullscreen mode

Behind the scenes, Golt bundles the TypeScript entry file with esbuild and executes it inside a Go-hosted JavaScript engine.

What does Golt include?

Golt currently provides a small set of backend-focused APIs:

  • console.log
  • Golt.env
  • Golt.App
  • Golt.logger
  • Golt.db
  • Golt.fs
  • Golt.crypto
  • Golt.jwt
  • global fetch()

The idea is to keep the runtime surface small, predictable and easy to document.

HTTP server

Golt includes a simple HTTP server API:

const app = Golt.App();

app.get("/", (ctx) => {
  ctx.Send("Hello from Golt HTTP");
});

app.get("/users/{id}", (ctx) => {
  ctx.Json({
    id: ctx.Param("id"),
  });
});

app.notFound((ctx) => {
  ctx.Status(404).Send("not found");
});

app.serve(3000);
Enter fullscreen mode Exit fullscreen mode

Routes support Go-style path parameters like:

/users/{id}
Enter fullscreen mode Exit fullscreen mode

And handlers receive a Context object with helpers like:

ctx.Param("id");
ctx.Query("q");
ctx.Status(201);
ctx.Json(data);
ctx.Send("text");
Enter fullscreen mode Exit fullscreen mode

Database access

Golt wraps Go's database/sql package and exposes Promise-based database helpers.

The API separates commands that mutate state from commands that return rows:

const db = Golt.db.connect("sqlite", "./app.db");

await db.exec(`
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL
  )
`);

await db.exec("INSERT INTO users(name) VALUES (?)", "Ada");

const users = await db.query("SELECT id, name FROM users");

console.log(users);
Enter fullscreen mode Exit fullscreen mode

The intended pattern is:

await db.exec("INSERT / UPDATE / DELETE / CREATE ...");
const rows = await db.query("SELECT ...");
Enter fullscreen mode Exit fullscreen mode

Fetch, filesystem, crypto and JWT

Golt also includes a minimal fetch() implementation:

const response = await fetch("https://httpbin.org/json");

const data = await response.json();

console.log(data);
Enter fullscreen mode Exit fullscreen mode

Filesystem helpers:

Golt.fs.writeFile("./hello.txt", "Hello from Golt\n");

const content = Golt.fs.readFile("./hello.txt");

console.log(content);
Enter fullscreen mode Exit fullscreen mode

Password hashing and JWT helpers:

const hash = await Golt.crypto.hash("password123");
const ok = await Golt.crypto.compare("password123", hash);

const token = Golt.jwt.sign({ sub: "user_123" }, "secret", 24);
const payload = Golt.jwt.verify(token, "secret");

console.log({ ok, payload });
Enter fullscreen mode Exit fullscreen mode

Docker support

Golt is also available as a Docker image:

docker pull aztekode/golt:latest
Enter fullscreen mode Exit fullscreen mode

You can run a Golt project without installing the runtime locally:

docker run --rm \
  -p 3000:3000 \
  -v "$PWD":/workspace \
  -w /workspace \
  aztekode/golt:latest \
  run app.ts
Enter fullscreen mode Exit fullscreen mode

Or use it as a base image:

FROM aztekode/golt:latest

WORKDIR /app

COPY . .

EXPOSE 3000

CMD ["run", "app.ts"]
Enter fullscreen mode Exit fullscreen mode

This makes it easier to run Golt projects consistently across different environments.

VS Code support

Golt also has a VS Code extension that provides editor typings.

When the extension detects a golt.json file in the workspace, it can generate the required type definitions under .golt/types.

The goal is to keep the CLI focused on the runtime and let the editor extension handle TypeScript developer experience.

Current project status

Golt is still early, but the base runtime is already working.

The current focus is:

  • improving runtime stability
  • improving the CLI
  • improving Docker usage
  • improving documentation
  • keeping the API small and intentional

Future ideas include:

  • better request body helpers
  • improved validation
  • better source map support
  • more polished error messages
  • more production-oriented examples

Links

Final thoughts

Golt started as an experiment around the idea of running TypeScript on top of a Go-powered runtime.

It is not meant to compete directly with Node.js, Deno or Bun. Instead, it explores a smaller runtime model focused on explicit backend primitives.

If you like TypeScript, Go, runtimes, backend tooling or developer experience experiments, I would love to hear your feedback.

Top comments (0)