Kylndocs

CLI reference

The kyln CLI drives a project from scaffold to production. Install it once with bun add -g @kyln/cli and the kyln command is on your PATH. A scaffolded app also wires the common commands into its package.json scripts, so you'll often run them through bun run, but each is available directly.

Run kyln --help at any time for the full list.

preheat

Scaffold a new project.

kyln preheat webapp my-app

preheat writes the project from a template, installs dependencies, and leaves you ready to run. See Scaffolding for the available templates and how to choose between them.

Run it bare and it goes interactive: a menu picks the template and prompts for the project name.

kyln preheat

Pass --into-existing to scaffold alongside files that are already there; it writes per-file and skips anything that already exists, so it won't clobber your README.md, .git/, or other files you manage:

kyln preheat webapp . --into-existing

dev

Start the development server.

kyln dev

dev serves your app, watches src/, and reloads on change. The port resolves in this order: --port= flag, then the PORT environment variable, then server.port from kyln.config.ts, then the default 2500. An invalid value in one tier falls through to the next. If your project has a src/scheduled/ directory, dev also boots the scheduler.

kyln dev --port=3000       # override the configured port
kyln dev --no-scheduler    # skip booting src/scheduled/ tasks
kyln dev --inspect         # boot under Bun's inspector
  • --port=NNNN overrides the port for this run. Note the equals form: --port=3000. A space-separated value (--port 3000) is ignored and the next tier wins.
  • Because PORT sits above the config in that order, a PORT exported globally in your shell is picked up by dev and beats server.port. If the dev server binds a port you didn't expect, check your environment.
  • --no-scheduler starts the server without booting the tasks in src/scheduled/, which is useful when you're iterating on the app and don't want jobs firing alongside it.
  • --inspect boots the dev server under Bun's inspector for server-side debugging; it prints a debug.bun.sh link to attach to. Pass --inspect=host:port to pin where the inspector listens. See Debugging for the full workflow.

make

Generate a component, service, route, or API endpoint with the right boilerplate.

kyln make component user-badge
kyln make service billing
kyln make route dashboard
kyln make api billing-reports

Each writes a correctly-shaped file into the matching src/ directory so you start from a working stub instead of an empty file:

Command Writes
kyln make component user-badge src/components/user-badge.ts
kyln make service billing src/services/billing.service.ts
kyln make route dashboard src/routes/dashboard.route.ts
kyln make api billing-reports src/api/billing-reports.ts

Those four kinds (component, service, route, api) are the full set. The generated api class mounts at /api/<name> and answers with an empty JSON list until you fill it in.

test

Run your test suite through Bun's test runner.

kyln test

Exits non-zero on failure, so it fits straight into CI. Every argument is forwarded verbatim to bun test, so anything Bun's runner accepts works here:

kyln test --watch              # re-run on change
kyln test tests/auth.test.ts   # a single file
kyln test -t "logs in"         # only tests matching a name filter

See Testing for writing tests.

bake

Produce the production build.

kyln bake

bake compiles your app into a self-contained build under dist/ (configurable via build.outDir). See Deployment for what it produces and how to run it.

serve

Run your app in production mode from the project directory.

kyln serve

serve runs a production server from your project, layering in production concerns and running scheduled tasks, using the built assets from bake. It's one of two ways to run in production; bake also emits a self-contained standalone bundle you can run on its own. Deployment covers both modes and when to use each.

kyln serve --port=8080       # override the port
PORT=8080 kyln serve         # or via the environment
kyln serve --no-scheduler    # skip booting src/scheduled/ tasks

The port resolves exactly as in dev: --port= flag, then the PORT environment variable, then server.port from kyln.config.ts, then the default 2500, with invalid values falling through to the next tier. The flag uses the equals form; --port 8080 with a space is ignored. --no-scheduler runs the server without booting scheduled tasks, which fits setups where a separate instance owns the jobs.

Next

Deployment puts bake and serve together into a production workflow.