Naalya Handbook

Task commands

Every command in the API's Taskfile, the script behind each one, and how to install Task.

Look up a task command here while you work in the API repo. Each table lists the task, what it does, and the script it runs.

The API repo has a Taskfile.yml at its root. Each task wraps a pnpm script from package.json or a script in scripts/. Only Naalya-API has a Taskfile. The Education Hub and the website use their package scripts directly (bun dev, pnpm dev).

Install Task

Task is a single binary. Pick the line for your system:

terminal
brew install go-task          # macOS with Homebrew
winget install Task.Task      # Windows
npm install -g @go-task/cli   # anywhere Node is installed

The installation guide on the Task website lists every other option. Its shell completion section adds tab completion for task names. Check the install with task --version.

Command line

Run tasks from the repo root.

terminal
task                 # list every task with its description
task dev             # run one
task migration:generate NAME=add_widget   # pass a variable

A variable follows the task name as NAME=value. The tables show which tasks take one. The usage guide on the Task website describes the Taskfile format.

First run and keeping up

TaskWhat it doesRuns
task setupPrepare a fresh clone: install, create .env.local, check DATABASE_URL, start infra, apply migrations. Stops and asks for credentials if DATABASE_URL is empty. Safe to run againinstall, env, infra, migration:run
task syncCatch up after git pull: install new dependencies and apply new migrationsinstall, migration:run
task installInstall dependenciespnpm install
task envCopy .env.example to .env.local. Skipped when .env.local already exists, so it never overwrites your keyscp .env.example .env.local

Run the apps

TaskWhat it doesRuns
task devStart server, worker, and audit in watch mode, plus the email preview, the type bus watcher, and the PDF watchers, in one terminalpnpm dev:all
task dev:serverStart only the HTTP API, on port 8000pnpm start:dev
task dev:workerStart only the worker: background jobs and the Rover agentpnpm worker:dev
task dev:auditStart only the audit apppnpm audit:dev
task emailStart the React Email preview on port 3001pnpm email:dev

Local services

TaskWhat it doesRuns
task infraStart Redis, Centrifugo, and Gotenberg in Docker, in the backgroundpnpm infra
task infra:statusList the local containers with their state and portspnpm infra:status
task infra:logsFollow the logs of those three containerspnpm infra:logs
task infra:downStop and remove thempnpm infra:down
task docker:devBuild and run the apps in containers too, with your code mountedpnpm docker:dev
task docker:dev:downStop that stackpnpm docker:dev:down

task infra does not start Postgres or RabbitMQ. Getting started covers those.

Database

TaskWhat it doesRuns
task migration:generate NAME=add_widgetGenerate a migration from your entity changes. NAME is optional. Without it the script makes up a namepnpm migration:generate
task migration:runApply every pending migration to the database in DATABASE_URLpnpm migration:run
task migration:revertUndo the most recent migrationpnpm migration:revert
task seedBring the demo school's seed data in line with the configured counts. Safe to repeatpnpm seed:sync
task seed:stressLoad a large data set for load testingpnpm seed:stress

Check where DATABASE_URL points

migration:run, migration:revert, and the seed tasks change whatever database .env.local points at. Before you run one, make sure that is your own development database and not a shared one.

Read a generated migration before you run it. The database has the workflow.

Quality

TaskWhat it doesRuns
task testRun unit testspnpm test
task test:watchRun unit tests again on each savepnpm test:watch
task test:covRun unit tests with coveragepnpm test:cov
task test:e2eRun end-to-end testspnpm test:e2e
task lintRun ESLint, fixing what it canpnpm lint
task formatRun Prettierpnpm format
task checkRun lint, then testslint, test
task buildBuild the appspnpm build

Shared types

The type bus shares TypeScript types with the Education Hub. How Chowbea works explains it.

TaskWhat it doesRuns
task busExtract shared types to chowbea.bus.jsonpnpm bus:extract
task bus:watchExtract again on each save. task dev already runs thispnpm bus:watch
task bus:checkValidate without writing. This is the CI checkpnpm bus:check
task bus:diffCompare with staging. Fails if a type was removedpnpm bus:diff

Rover sandbox image

These manage the container image Rover's sandbox runs in, published to GitHub Container Registry.

TaskWhat it doesRuns
task sandbox:publish TAG=my-tagBuild and push the image. TAG is optionalscripts/sandbox-image.sh publish
task sandbox:probeStart the configured sandbox and check it has what the Dockerfile installsnode scripts/sandbox-probe.mjs
task sandbox:listList every published versionscripts/sandbox-image.sh list
task sandbox:explain TAG=devShow what one tag containsscripts/sandbox-image.sh explain
task sandbox:delete TAG=old-thingDelete one tagscripts/sandbox-image.sh delete
task sandbox:prune KEEP=5Delete old commit-named versions, keeping the newest KEEPscripts/sandbox-image.sh prune
task sandbox:cleanDelete untagged images no tag points toscripts/sandbox-image.sh clean

Deploys

TaskWhat it doesRuns
task redeploy-railwayRedeploy the Railway services for ENVIRONMENT, which defaults to staging. For production, pass ENVIRONMENT=productionscripts/redeploy-railway-services.sh

This touches a real environment

redeploy-railway restarts live services. Only run it if you are responsible for that environment, and never against production without agreement from the team.

On this page