Skip to content
ES

Get started

Installation

What you need on your machine, and how to run the newt command.

newt runs on Bun. You install Bun once, and the newt command comes with each project.

Tool Version Why
Bun 1.4.0 or newer runs the backend, the tests and the CLI
Git any optional, to keep your project

Install Bun as https://bun.sh says, then check it:

Terminal window
bun --version

You do not need Node.js, a database server or Docker. The default database is SQLite, which Bun has built in.

Any of these creates a new backend in the folder my-app:

Terminal window
bun create newt my-app
Terminal window
bunx @newt-js/cli init my-app

Both run the same newt init, with the same options. npm create newt my-app works too, as long as Bun is installed; without Bun it tells you how to get it.

Each project lists @newt-js/cli in its devDependencies. After bun install, run it from anywhere inside the project:

Terminal window
bunx newt --help
bunx newt add context tasks

These docs write newt ... for short. Read it as bunx newt ....

If you run a newt installed elsewhere inside a project, it hands the command over to the project’s own copy. That way the code it writes always matches the project’s version of newt.

Option What it does
--dry-run prints what would change, writes nothing
--json prints the result as JSON
-h, --help shows the help
-v, --version shows the version (newt -v)

With --json, a command prints { dryRun, files: [{ path, status, note? }], warnings, nextSteps }, or { error } with exit code 1.

A command never overwrites a file that is already there. Run it twice and the second run skips what exists.

Terminal window
newt init [name] [--port <port>] [--db <database>] \
[--files <storage>] [--cluster <cluster>] [--monorepo] \
[--backend <folder>]
Option Values Default
--port 1 to 65535 3000
--db sqlite, postgres, mysql, memory sqlite
--files local, s3, memory local
--cluster memory, valkey memory
--monorepo off
--backend a folder apps/api
  • name is the new folder. newt init . uses the current folder and names the project after it.
  • Without a name, in a terminal, newt asks for the name and whether you want a backend or a monorepo.
  • --db sets the database every context opens. See SQLite, Postgres and MySQL.
  • --files sets where contexts keep uploaded files: a local folder or S3. See files.
  • memory, for --db or --files, keeps everything in memory and loses it when the backend stops. It suits a quick try, not an app.
  • --cluster sets what several running instances share. See running several instances.
  • --monorepo and --backend are explained in monorepos.

All options are in the newt init reference.

A project needs no editor plugin, but two help:

  • TypeScript: your editor reads tsconfig.json. An app, if you add one, has its own tsconfig.json in its folder.
  • ESLint: the project has an eslint.config.ts with newt’s rules. An ESLint extension shows them as you type, the same ones bun run lint reports.

Build your first project.