Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Deno 9 min read How-to mediumAdept

Build a Cross-Platform CLI with Deno in 5 minutes

Deno's built-in tooling covers the full path to a small cross-platform CLI, shown here by building `greetme-cli`. The std `flags` module's `parse()` handles argument parsing with typed flags, aliases and defaults. Deno KV persists settings across runs and needs an explicit path when compiled, and the web `prompt()` API handles interactive input. The tutorial finishes with `Deno.test` for unit tests and `deno compile` to ship a single executable binary, noting the required `--unstable`, `--allow-read` and `--allow-write` flags.

Assumes: TypeScript basicscommand-line usage

Related posts

  • Deno 1.34: deno compile supports npm packages

    Deno mediumAdept

    Deno 1.34 lets `deno compile` bundle npm packages and their dependencies into a single self-contained executable. That makes tools like vite and eslint shippable as binaries with pinned dependencies, and they tend to start faster than running from a local cache. The release also adds cross-platform glob support in deno.json, deno task and CLI flags, and TLS certificates with IP addresses via rustls. Smaller changes include a top-level `exclude` and `nodeModulesDir` in config, configurable language-server limits, a `Deno.serve()` signature change that returns a `Deno.Server`, new `createHttpClient` pool options, more Node.js polyfills, and upgrades to V8 11.5 and TypeScript 5.0.4.

  • Deno 2.5: Permissions in the config file

    Deno mediumAdept

    Deno 2.5 adds named permission sets in deno.json, selectable with -P or --permission-set, plus per-command permissions for test, bench and compile that require -P to apply. It also adds beforeAll/beforeEach/afterAll/afterEach hooks to Deno.test, custom headers on WebSocket connections, an experimental Deno.bundle runtime API, and HTML entrypoint support in deno bundle. Other additions include a JSONL permissions audit log via DENO_AUDIT_PERMISSIONS, Response-style convenience methods on child process stdio, new lint rules for unversioned and inline imports, opt-in Node.js timer globals, and upgrades to V8 14.0 and TypeScript 5.9.2.

  • Deno 2.6: dx is the new npx

    Deno mediumAdept

    Deno 2.6 adds `dx`, an npx equivalent for running npm and JSR package binaries that defaults to full permissions, prompts before download and runs lifecycle scripts. It also adds `--ignore-read`/`--ignore-env` flags that return NotFound/undefined instead of NotCapable errors, plus an experimental permission broker process for mediating permission requests. Other changes include opt-in type checking with the Go-based tsgo (about 2x faster on internal projects), Wasm source phase imports, `--require` for preloading CommonJS, and `deno audit` with optional socket.dev integration. Supply-chain controls include `deno approve-scripts` and a `minimumDependencyAge` setting, alongside bundler fixes, default `@types/node`, and many Node.js API compatibility fixes.

  • Deno 2.3: Improved deno compile, local npm packages, and more

    Deno mediumAdept

    Deno 2.3 lets deno compile bundle programs that use FFI and Node native add-ons, adds --include/--exclude control over embedded files, and exposes Deno.build.standalone to detect compiled binaries. Local npm packages can now be used through a "patch" entry in deno.json. deno fmt gains formatting of CSS, HTML and SQL in tagged templates plus 14 new options, and OpenTelemetry support adds span events, cross-service context propagation, node:http auto-instrumentation and V8 heap metrics. deno install is about 2x faster when npm dependencies are cached, thanks to in-memory npm metadata caching and lockfile v5, with a benchmark showing 2.5x on a Vite React template. The release also adds the JavaScript `using` keyword, coverage ignore comments and TypeScript 5.8 with V8 13.5.

  • Build a REST API with Express, TypeScript, and Deno

    Deno mediumAdept

    Deno runs Express with TypeScript without any TypeScript build configuration: Express is imported through an npm: specifier and its types are pulled in with a @deno-types comment. The walkthrough sets up a server that reads its port from the environment and starts it with explicit Deno permissions (--allow-read, --allow-net, --allow-env), which limits what third-party code can access. It also defines dev and start tasks in deno.jsonc, adds a request-logging middleware, and serves mock user data imported as JSON through /users and /users/:id routes, giving a REST API starting point in under 30 lines.

The quest for software engineering knowledge.

Look:
Layout: