Loomis
Getting started

Commands

Every command, what it does, and the same command in the four package managers people actually use.

The installation is tested with pnpm, which is what the lockfile in the folder is written for. Nothing stops you using npm, Yarn or Bun: the scripts are ordinary package.json scripts, and the tabs below give each one in the spelling you already type.

Pick one package manager and stay with it

The folder ships a pnpm-lock.yaml. A second lockfile from another manager is a second opinion about versions, and the two will disagree eventually. If you prefer npm or Yarn, delete the pnpm lockfile once and commit the one you generate, rather than keeping both.

Install, run and build

pnpm install          # the packages
pnpm configure        # the guided walk over the nineteen names
pnpm dev              # development server on http://localhost:3000
pnpm build            # a production build
pnpm start            # serve the production build

The three gates

Run these before and after any change of your own. They are clean as shipped, and a gate that breaks is a gate that tells you what you broke while it is still one change old.

pnpm typecheck        # TypeScript, no emit
pnpm lint             # ESLint
pnpm test             # Vitest, once
pnpm test:watch       # Vitest, watching
pnpm format           # Prettier over the TypeScript and TSX files

The backend

Convex has a command line of its own, and it is the same one whichever package manager you used.

npx convex dev                  # create or connect, then watch and push to development
npx convex dev --once           # push once and exit, for a script
npx convex deploy               # push schema and functions to production
npx convex env set NAME value   # one deployment variable
npx convex env set NAME value --prod
npx convex env list             # which names the deployment has, never their values
npx convex env list --prod
npx convex run admin:bootstrap  # create the first administrator
npx convex dashboard            # open the dashboard for this project
npx convex logs                 # watch the deployment's log, where an action's failure shows up

The configuration walk

pnpm configure                                 # every question
pnpm configure --only=app                      # only the seven the app reads
pnpm configure --only=deployment               # only the twelve the deployment reads
pnpm configure --dry-run                       # say what it would write, write nothing
pnpm configure --yes                           # scripted: take the shipped answer
pnpm configure --file=.env.staging             # write somewhere other than .env.local
pnpm configure --no-color                      # plain output, for a log
pnpm configure --help                          # the flags and the names

`pnpm setup` is not this

pnpm has a setup command of its own and it will win the argument. The script in this folder is configure. The Cloudflare scripts are cf:-prefixed for the same reason: pnpm deploy is pnpm's own monorepo deploy.

What each script is for

ScriptRunsWhen
devnext devWhile you are working
buildnext buildBefore start, and before a release
startnext startServing a build. Reads what was built, not what is in the editor
linteslintBefore a commit
formatPrettier over **/*.{ts,tsx}When the diffs start arguing about whitespace
typechecktsc --noEmitBefore a commit, and after touching convex/
testvitest runBefore a commit
test:watchvitestWhile working on a rule in lib/ or convex/
configurescripts/install.mjs, with Node's type strippingFirst run, and when a key changes
vendorCopies the WebAssembly bundler into public/vendorAutomatically before dev and build, and after install
skillsWrites lib/ai/skills-data.ts from the skills/ folderAutomatically before dev and build
assetsWrites lib/assets.ts, the bytes the icon draws withAutomatically before dev and build
cf:previewopennextjs-cloudflare build then previewTo run the app in Cloudflare's local runtime on port 8787

| cf:deploy | opennextjs-cloudflare build then deploy --keep-vars | To put the app on Cloudflare Workers | | cf:upload | opennextjs-cloudflare build then upload --keep-vars | To upload a version without promoting it, for gradual rollouts | | cf:typegen | wrangler types | To regenerate cloudflare-env.d.ts after changing a binding | | postinstall | The same vendoring | Automatically, after install |

The two generated files

lib/ai/skills-data.ts and lib/assets.ts are written by scripts, not by hand. They exist because a runtime with no disk cannot read the skills/ folder or open a file in public/, and both happen while a page is being answered. They are committed so a fresh clone typechecks, and regenerated before every build, so editing the markdown or the image is still all you ever do.

The things people look for, and where they are

I want toCommand
Start over with the packagesDelete node_modules, then install again
Start over with the buildDelete .next, then pnpm build
Check which names are set, without valuesnpx convex env list, and Platform → Environment
See why a turn failednpx convex logs
Check that the app is up before blaming codeSystem → Status & health in the panel
Find out who changed a settingSystem → Audit log

A blank page for a few seconds is not a fault

Next.js serves nothing until the first compile finishes, and the first compile after a restart is the whole app. In development that is a few seconds; on a production host it has already happened during the build.