Dex

Commands

CLI Commands

The native Go Dex CLI (dex) provides sub-5ms commands for scaffolding projects, managing template caches, syncing upstream updates, generating OpenAPI clients, tagging releases, and building/running applications.

Overview

dex scaffold <dir> [options]
dex sync [--interactive] [options]
dex template <list|cache|diff> [options]
dex update [version] [--force]
dex versions | dex list | dex ls
dex use <version>
dex pie generate [spec-url-or-file] [options]
dex tag <patch|minor|major>
dex build
dex start [-p]
dex -v / --version [-f]

dex scaffold

Scaffold a new Dex project in <dir>.

dex scaffold <dir> [options]

Prompts for project mode (spa or mpa, or pass --mode), downloads and extracts the template archive and framework packages (router, server, dev, pie) into packages/, initializes .dex/metadata.json, and runs bun install unless --no-install is set.

Options

OptionDescription
--mode <spa|mpa>Project template mode (spa or mpa) without prompting
--repo <owner/repo>GitHub repository containing release templates (default: patrickaigbogun/dex)
--tag <tag|latest>Release tag to download template from (default: latest)
--packages-repo <owner/repo>GitHub repository containing dex-package-*.tgz assets
--packages-tag <tag|latest>Release tag for dex-package-*.tgz assets (default: template tag)
--template <path>Use a local template .tgz archive instead of downloading from GitHub
--template-url <url>Download template .tgz archive from a direct URL (skips GitHub API)
--no-installDo not run bun install after scaffolding
--no-cache, --freshBypass the local template cache and download fresh tarballs

Examples

# Scaffold in a new directory
dex scaffold my-app

# Bypass local template cache and pin a tag
dex scaffold my-app --tag v0.2.6 --fresh

# Scaffold from a local archive without installing dependencies
dex scaffold my-app --mode spa --template ./custom-template.tgz --no-install

dex sync

Sync upstream template changes and obsolete file removals into an existing Dex project.

dex sync [options]

dex sync reads .dex/metadata.json, fetches the release diff manifest (dex-diff-<tag>.json), downloads the template archive (honoring --no-cache / --fresh), and performs two safety-checked steps:

  1. Enforced SHA-256 checksum verification: Before copying any file listed in changedFiles, dex sync computes its SHA-256 digest and verifies it against diff.Checksums[file]. If a checksum does not match, the sync aborts with an error.
  2. Interactive deletedFiles cleanup: If the release diff includes deletedFiles that still exist in your project, dex sync prompts whether to remove those obsolete upstream files (or removes them automatically when --force is passed).

Options

OptionDescription
--interactiveInteractively select which changed files to sync
--repo <owner/repo>Template GitHub repository (default: patrickaigbogun/dex or DEX_TEMPLATE_REPO)
--tag <tag>Release tag to sync to (default: latest)
--forceForce sync even if already on the target version, and remove obsolete deletedFiles without prompting
--no-cache, --freshBypass the local template cache when fetching the template archive

Examples

# Sync all changed files from the latest release
dex sync

# Interactively choose which changed files to apply, bypassing cache
dex sync --interactive --fresh

# Sync against a specific release tag and force cleanup
dex sync --tag v0.2.6 --force

dex template

Inspect available/cached templates, manage the local template cache, and inspect upstream release diffs.

dex template list | ls
dex template cache list | ls
dex template cache clean [--all | <tag>]
dex template diff [tag] [--repo <owner/repo>]

Subcommands

SubcommandDescription
dex template list / lsLists official templates (spa, mpa) and all locally cached <owner>/<repo>@<tag> directories.
dex template cache list / lsLists cached template .tgz asset paths and file sizes (in KB) inside the template cache directory.
dex template cache clean [--all | <tag>]Removes all cached template tarballs (default or --all), or deletes cached assets for a specific <tag> across repos.
dex template diff [tag]Fetches dex-diff-<tag>.json (default: latest) and prints JSON with version, previousVersion, changedFiles, and deletedFiles.

Examples

# List official and cached templates
dex template ls

# Inspect cached tarballs and sizes
dex template cache list

# Clear cached tarballs for a specific tag, or clear everything
dex template cache clean v0.2.5
dex template cache clean --all

# Preview changed and deleted files in the latest release
dex template diff
dex template diff v0.2.6

dex update

Update the Dex CLI to the latest release (or a specific version) with multi-version storage.

dex update [version] [options]

Checks GitHub Releases, downloads the native binary for your OS and architecture (dex-linux-x64, dex-linux-arm64, dex-darwin-x64, dex-darwin-arm64, or dex-windows-x64.exe) into ~/.dex/versions/<version>/, and atomically updates ~/.dex/current and ~/.dex/bin/dex.

Options

OptionDescription
[version]Specific version tag to install (e.g. v0.2.6). Defaults to latest GitHub release.
--forceForce re-download even if already on the target version.
--repo <owner/repo>Release repository (default: patrickaigbogun/dex or DEX_TEMPLATE_REPO).

Verifying Release Checksums (SHA256SUMS)

Every release publishes a SHA256SUMS file covering all cross-compiled CLI binaries:

curl -fsSLO https://github.com/patrickaigbogun/dex/releases/download/v0.2.6/SHA256SUMS
curl -fsSLO https://github.com/patrickaigbogun/dex/releases/download/v0.2.6/dex-linux-x64
sha256sum -c SHA256SUMS --ignore-missing

dex versions / dex list / dex ls

List all locally installed Dex CLI versions stored in ~/.dex/versions/.

dex versions
# or
dex list
# or
dex ls

Output:

Dex installed versions (~/.dex):

  * v0.2.6 (active)
    v0.2.5

dex use

Switch the active CLI version to another installed version.

dex use <version>
dex use v0.2.5
# Now using Dex v0.2.5 ✓

dex use v0.2.6
# Now using Dex v0.2.6 ✓

dex pie generate

Generate a fully typed route-tree API client from a JSON or YAML OpenAPI 3.0/3.1 specification using the Go CLI's built-in YAML/JSON parser (alias: dex api generate).

dex pie generate [spec-url-or-file] [options]

Options

OptionDescription
[spec-url-or-file]Path to a local OpenAPI JSON/YAML file, or a URL to a remote schema (also --spec).
--out <path>Output TypeScript file path (default: core/api/generated.ts).
--prefix <prefix>Route path prefix to strip from generated client tree (default: /api).
--url <baseUrl>Default base API URL (inferred from dex.config.ts apiUrl, PUBLIC_API_URL, or NEXT_PUBLIC_API_URL).

Examples

# Generate from local OpenAPI YAML or JSON file
dex pie generate ./openapi.yaml
dex pie generate ./openapi.json

# Generate from remote URL with custom output and prefix
dex pie generate https://api.example.com/openapi.yaml --out core/api/client.ts --prefix /v1

dex tag

Bump SemVer version tags and push the tag to the origin git remote.

dex tag <patch|minor|major>
ArgumentDescriptionExample
patchBump SemVer patch versionv0.2.5 → v0.2.6
minorBump SemVer minor versionv0.2.6 → v0.3.0
majorBump SemVer major versionv0.2.6 → v1.0.0

dex build

Build the Dex application for production.

dex build

Discovers the project root (dex.config.*, config/dex.config.*, or package.json#dex) and runs bun core/bootstrap/build.ts (falling back to core/bootstrap/scripts.ts or bun run build).


dex start

Start the Dex application in development or production mode (alias: dex dev).

dex start [-p]
OptionDescription
-pProduction mode (NODE_ENV=production). Executes ./build/server (./build/server.exe on Windows) if present, falling back to bun run start. Without -p, runs bun core/bootstrap/dev.ts.

Version Flags

# Show CLI version
dex -v
dex --version

# Show CLI version and framework template version from .dex/metadata.json
dex --version -f
dex -v -f

Environment Variables

VariableDescriptionDefault
DEX_HOMECustom installation and multi-version storage directory~/.dex
DEX_TEMPLATE_REPODefault GitHub template repository (owner/repo)patrickaigbogun/dex
DEX_TEMPLATE_TGZPath to local template .tgz archive (skips GitHub API)—
DEX_TEMPLATE_URLDirect URL to template .tgz archive (skips GitHub API)—
DEX_PACKAGE_REPOGitHub repository (owner/repo) for dex-package-*.tgz assetsTemplate repo
DEX_PACKAGE_TAGRelease tag for dex-package-*.tgz assetsTemplate tag
DEX_CACHE_DIRDirectory for caching downloaded templates and packagesOS cache directory (~/.cache/dex, ~/Library/Caches/dex, or %LOCALAPPDATA%\dex\Cache)
DEX_TEMPLATE_CACHE_TTL_MSCache TTL in milliseconds for latest release downloads1800000 (30m)
DEX_FETCH_TIMEOUT_MSNetwork timeout in milliseconds for GitHub API requests30000 (30s)
DEX_API_SPECDefault OpenAPI spec URL or path for dex pie generate—
GITHUB_TOKENGitHub token to avoid rate limits or access private repositories—

See Also

On this page