@webship.co/workspace-nestjs 1.0.0 · github.com/webship/workspace-nestjs · npm
NestJS for the Webship Workspace dashboard: a builder that makes a NestJS app with the framework's own command-line tool (or takes one from its repository), builds it and serves it from a container of its own, the NestJS step pack wired into the testing setup of that app, and its AI items — two agents, a skill, a command and two prompts for building and testing NestJS apps — each listed in the workspace folder of its kind.
The app brings its own language in its own container. Node.js runs in the app's container, at the version of the workspace rule (24); the app is made there with the framework's command-line tool (nest new, pinned per release line: @nestjs/cli 12.0.15 for NestJS 12, the default, and 11.0.24 for 11), built there with its own build (nest build) and served with its own start (node dist/main, its start:prod). Nothing of Node.js, npm or the command-line tool runs on the machine. The app is the skeleton with the demo of the NestJS step pack, the skeleton alone, or an app of your own from its repository.
The app's server is never the container's first process. The docs' own Dockerfile runs node dist/main as the first process, and the skeleton has no app.enableShutdownHooks(): such a process does not take a stop, and is killed at the end of the runtime's timeout (10.2 s, measured). Here, on DDEV the server is a daemon of the web container, which its supervisor stops; elsewhere the core's start script is the first process and passes the stop on to the server's process group (webship/workspace#983). So an app without a shutdown hook stops at once, on every runtime.
The workspace is container-based (DDEV by default): an app is a row like any other, so the row menus the core draws (start, stop, launch, backup, clone, remove, tests) work on it; what does not apply to an app without a database is listed under What is different from a platform. The builder builds on DDEV by default, and with --runtime on Docker Compose, Podman or a Kubernetes cluster: see Runtimes.
Use it
cd ~/workspace
bash core/scripts/plugins.sh --require nestjs --with-needs # npm install into the dashboard
bash core/scripts/plugins.sh --activate nestjs --with-needs # plugins.nestjs in settings.yml
bash core/scripts/plugins.sh --install nestjs # the builder, functions, args, AI items
bash core/scripts/plugins.sh --configure nestjs # nothing to configure: it has no settings file
The same four steps are buttons on the dashboard's Settings → Plugins page. --install is idempotent. --uninstall removes what it placed; an AI item you edited stays.
Everything the plugin carries lands in the folder it belongs to, when that folder is an active workspace folder:
| What | Lands in |
|---|---|
cmd-nestjs-project.sh |
every active sites folder: dev/, test/, sandboxes/, demos/ |
The agents nestjs-app-builder, nestjs-tester |
ai-agents/ |
The skill nestjs-scenarios |
ai-skills/ |
The command /nestjs-test |
ai-commands/ |
The prompts nestjs-build-and-test, nestjs-scenarios-for-an-app |
ai-prompts/ |
There they are listed like any other item of the folder, and installed into Claude Code from there.
What it needs
A workspace starts empty, so the manifest says what else this plugin needs (needs):
- one sites folder, for the builder:
dev,test,sandboxes,demos(devis the one added when none is there). The folder also carriescmd-tools-testing.shand the Users tools this plugin's hooks answer to. ai-agents,ai-skills,ai-commandsandai-prompts: the AI folders its agents, its skill, its command and its prompts are placed in.
--require says so, --activate and --install stop until the workspace has them, and --with-needs adds what is missing first:
bash core/scripts/plugins.sh --activate nestjs --with-needs # dev and the four AI folders are required, activated and installed first
bash core/scripts/plugins.sh --install nestjs
Everything the builder runs for an app runs in the app's own container, through the container tool the workspace already needs; the plugin asks for no command of its own on the machine. Making an app downloads the command-line tool, the demo of the step pack and the app's packages from the npm registry, in the container. There is no database: the skeleton has none, and Nest takes any (an app that needs one gets it from the workspace's database plugins).
What the package holds
| Path | What it is |
|---|---|
commands/cmd-nestjs-project.sh |
The builder, in the Build list as NestJS (NestJS app), installed into every sites folder |
scripts/functions/fun-nestjs.sh |
The bash functions behind it, sourced by bootstrap once installed; the names the core's tools look for (set_nestjs_users, add_nestjs_users, cancel_nestjs_users, testing_configure_nestjs) |
scripts/args/arg-nestjs.sh |
Its argparse; the Build form draws the builder's flags from it |
testing/site.feature |
The first feature the demo template gets when testing is set up |
ai/agents/nestjs-app-builder.md |
The agent that builds and fixes apps: the build in the container, the stop, answers a person and the step pack read |
ai/agents/nestjs-tester.md |
The agent that writes and runs scenarios with the step pack, with JavaScript and without |
ai/skills/nestjs-scenarios/ |
The skill: the step pack's phrases, the traps found on a real backend, three example features |
ai/commands/nestjs-test.md |
The slash command /nestjs-test <app>: set up when missing, match every step, run, report |
ai/prompts/nestjs-build-and-test.md, nestjs-scenarios-for-an-app.md |
Two prompts: whole launch commands for a new session |
src/index.ts |
register(api): what the assistant is told about NestJS here |
features/nestjs.feature, features/nestjs-runtimes.feature |
Scenarios for the dashboard's own browser suite |
The workspacePlugin block in package.json is the manifest the installer reads.
What is different from a platform
| WordPress (a platform) | NestJS | |
|---|---|---|
| What is built | A WordPress site | A NestJS app: the skeleton of the command-line tool with the step pack's demo, the skeleton alone, or an app from its repository; NestJS 12 or 11 |
| Project | --project-type=wordpress |
--project-type=generic --webserver-type=generic, no database: the app's own start serves it |
| The language | PHP, in the container tool's image | Node.js 24 in the app's container: DDEV's web container (--nodejs-version) on DDEV; on Docker Compose, Podman and Kubernetes the core's language stack (rt_stack node 24, Node.js's own image, and rt_serve) |
| Recognised by | The project type | On DDEV a file the builder writes, .ddev/config.nestjs.yaml (it also records where the app came from); on another runtime its claim, platform: nestjs in the x-webship block of compose.yaml |
| Accounts | WP-CLI | The demo's two, admin and editor, with the workspace's password in the app's settings; an app of your own keeps its own |
| Testing | The WordPress pack | The NestJS pack, which signs in through the backend's own sign-in and reads its answers as Nest writes them |
The commands
Run it from a sites folder. --help is safe.
Build and serve an app
cd ~/workspace/dev
bash cmd-nestjs-project.sh nest1 --install # NestJS 12: the skeleton with the step pack's demo
bash cmd-nestjs-project.sh nest11 --line 11 --install # NestJS 11, the last of 11
bash cmd-nestjs-project.sh nestmin --template minimal --install # the skeleton alone: "Hello World!" at /
bash cmd-nestjs-project.sh nestown --source https://github.com/<you>/<app>.git --ref main --install
bash cmd-nestjs-project.sh nestown --source https://github.com/<you>/<repo>.git --path apps/api --install
| Flag | What it does |
|---|---|
--line 12 or --line 11 |
The release line of a new app: the command-line tool that makes it is pinned for each (12.0.15, 11.0.24). 12, the latest, by default. |
--template demo |
The default: the skeleton with the demo of @webship-js/nestjs-steps at the release the builder pins, and the packages that demo names for the line (@nestjs/swagger, @nestjs/jwt, @nestjs/terminus, @nestjs/platform-fastify, class-validator, class-transformer, hbs), at their exact versions |
--template minimal |
The skeleton alone |
--with-skills |
On NestJS 12: keep the framework's agent skills in the new app (see below) |
--source <repository> |
An app of your own instead: a NestJS app (@nestjs/core in its package.json) whose packages are its own; npm, pnpm or yarn by its lock file |
--ref <branch or tag>, --path <folder> |
Its branch or tag, and its folder in a repository of several apps |
--install |
Serve the app and check that it answers |
--runtime docker, podman or kubernetes |
Build on that runtime instead of DDEV |
The app's source is in <name>/app/, its build in <name>/app/dist/. It is served with its own start: its start:prod when that is node <file> (the skeleton's is node dist/main), else node dist/main. The builder writes the app's settings in <name>/.webship-nestjs/env, which only the project's user can read: the port its server listens on (PORT=3000) and, for the demo, the passwords of its two accounts. The builder deletes a project of the same name first.
What the command-line tool would add on NestJS 12, and the builder leaves out. Asked nothing, nest new of @nestjs/cli 12.0.15 adds two things the app does not run, so the builder passes --no-observe --skip-skills, as analytics is off in the other builders (the tool of 11 adds neither, and has no such flags):
- An observability package,
@nestjs/observe, in the app's dependencies, which sends nothing until it is linked. To have it, add it to the app and link it, in the app's container:ddev exec -d /var/www/html/app "npm install @nestjs/observe && npx @nestjs/observe link". - The framework's agent skills:
CLAUDE.md, and the skills of three coding agents in.claude/skills/and.agents/skills/. Build with--with-skillsto keep them: the builder passes the tool's--skills all, then adds the skills once the app's packages are installed (@nestjs/skills, pinned to 0.1.4). Or add them later, in the app's container:ddev exec -d /var/www/html/app "npx --yes @nestjs/skills@0.1.4 add --agent all".
AGENTS.md, the skeleton's own pointer to the framework's docs for coding agents, stays either way, as its README.md does.
The demo is a shop's API under the global prefix /v1: its products (/v1/products), a sign-in for the accounts admin and editor (POST /v1/auth/login, a bearer token), the ValidationPipe, a guard and roles (only admin removes a product), Swagger's docs at /api with their document at /api-json, a health check at /v1/health, and the shop's page at /.
Test an app
bash cmd-tools-testing.sh nest1 # webship-js, the step pack, the accounts, a first feature
bash cmd-tools-testing.sh nest1 --run --path tests/features/site.feature
The testing setup adds @webship-js/nestjs-steps to the project and lists its step definitions in cucumber.js. For the demo template it also names the demo's two accounts in worldParameters.users (their passwords from NESTJS_ADMIN_PASSWORD and NESTJS_EDITOR_PASSWORD, else the workspace's), its sign-in under its global prefix (worldParameters.nestjs.signIn.path, /v1/auth/login), and writes tests/features/site.feature. An app of your own gets the pack only: name its accounts and its sign-in in cucumber.js yourself. It changes nothing in a project that is not an app of this builder.
The requests are webship-js's own API steps; the steps of the pack sign them and read the answers as Nest writes them:
Feature: The shop's products
Background:
Given the API base URL is "/"
Scenario: The ValidationPipe refuses each field it does not take
Given I am signed in to the backend as "editor"
When I send a POST request to "/v1/products" with body:
"""
{ "name": "", "price": -1 }
"""
Then the backend should have refused "name" with "should not be empty"
And the backend should have refused "price" with "must not be less than 0"
Scenario: Only an admin removes a product
Given I am signed in to the backend as "editor"
When I send a DELETE request to "/v1/products/1"
Then the backend should have refused me as not allowed
Runtimes
The commands are the same on every runtime: the builder speaks DDEV's verbs, and on another runtime the core's layer (Webship Workspace 1.0.32 or later, webship/workspace#694 and #841) gives each verb its meaning there: the language stack builds the web image from Node.js's own image at version 24 and starts the app's server in it. The app has no database, so on Kubernetes it needs core 1.0.35 or newer (webship/workspace#884).
| Runtime | The address of the app | Proven with this builder |
|---|---|---|
| DDEV (the default) | https://<name>.ddev.site |
The demo template built and served in 1 min 50 s (Node.js 24 in DDEV's web container: the command-line tool, the demo of @webship-js/nestjs-steps 2.0.0 from npm, its packages and the build). Through its address: the shop's page, the health, both accounts signed in, a product added, the editor's removal refused (403) and the admin's done (204), the ValidationPipe's refusal, a missing route, the document and the docs. Its settings 0600 in a 0700 folder, no password in the build's log. The server runs under the web container's supervisor, never the first process: its stop took 0.13 s, and 0.16 s for the skeleton, which has no shutdown hook (the rest of ddev stop is DDEV's own). The testing setup from npm (@webship-js/nestjs-steps 2.0.0, webship-js 2.0.20) and its first feature, 6 scenarios and 33 steps, and the skill's three examples (5, 2 and 2 scenarios). The skeleton alone of NestJS 11 (--template minimal --line 11) built in 2 min 8 s, and an app from its repository (the framework's own starter repository, NestJS 12.4.0) in 1 min 15 s |
Docker Compose (--runtime docker) |
http://127.0.0.1:<port>, a free port kept in compose.yaml |
The demo template built in 2 min 43 s (the stack's web image from Node.js's own image, then the app as on DDEV), the same checks through its address. The core's start script is the web container's first process and the server its child: the web container alone stopped in 0.16 s (exit 143: the stop was passed on), the whole Stop (the app and its mail catcher) in 3.9 s, and the next start served it again. The skeleton alone of NestJS 11 built in 1 min 38 s; its web container stopped in 0.17 s, exit 143. The testing setup and its first feature (6 scenarios, 33 steps), and the skill's three examples |
Podman (--runtime podman) |
http://127.0.0.1:<port> |
The demo template built in 3 min 2 s with Node.js's own image, the same checks through its address. The core's start script is the web container's first process: the web container alone stopped in 1.34 s (exit 143), the whole Stop in 3.6 s, and the next start served it again |
Kubernetes (--runtime kubernetes) |
http://<node address>:<NodePort> |
On kind (Kubernetes 1.37.0): the demo template built in 2 min 55 s, served at the node's address, the same checks through it. The core's start script is the pod's first process: the web pod ended 0.75 s after its delete, and after the Stop and Start the app served again. The testing setup on the cluster and its first feature (6 scenarios, 33 steps), and the skill's three examples |
A project of the builder is known by DDEV's file on DDEV and by its claim on another runtime, so the testing setup, the Users tools and the dashboard's row work the same on each. Lando and Docksal are runtimes of the workspace too, not proven with this builder yet: it says so and stops, before anything is made.
Users
The demo's two accounts, admin and editor, take the workspace's password from the app's settings, written at every build. cmd-tools-add-users.sh <name> nestjs and cmd-tools-cancel-users.sh <name> nestjs say so and change nothing; an app of your own keeps its own accounts.
The AI items
| Item | Kind | What it is for |
|---|---|---|
nestjs-app-builder |
agent | Builds and fixes NestJS apps in their container: the build, the stop, answers a person and the step pack read, routes documented with their bodies and answers |
nestjs-tester |
agent | Writes and runs scenarios with the step pack: the answers first, never sleeps, never names a framework or platform in a step, runs with JavaScript and without |
nestjs-scenarios |
skill | The step pack's phrases, the traps found on a real backend, three example features that pass on the demo |
/nestjs-test <app> |
command | Sets the pack up when missing, matches every step, runs, reports |
nestjs-build-and-test |
prompt | Builds an app and proves it with its first feature |
nestjs-scenarios-for-an-app |
prompt | Writes and runs the scenarios of one app of the workspace |
Every item says the workspace is container-based (DDEV by default), and the agents and the skill send the reader to the book Automated Functional Testing Recipes first.
Develop it
npm install
npm test # builds, then the unit tests: the manifest, the scripts, the AI items, the needs
npm run lint # the TypeScript compiler, no output
CI runs the same on Node.js 24 and 26, checks that every shell script parses, and runs the plugin's webship-js features against a dashboard with the plugin installed (the reusable workflow webship/workspace/.github/workflows/plugin-browser-suite.yml). Before the features it builds the app the manifest names (featuresSite: cmd-nestjs-project.sh ci-nestjs --install --runtime docker), so the scenarios of features/nestjs-runtimes.feature tagged @needs-runtime-docker drive a real app on Docker Compose; the Podman and Kubernetes ones run where such an app is. tests/fixtures/step-definitions.txt holds the step definitions of the step pack at the version the testing hook pins and of webship-js, read from their packages: every phrase an AI item shows must match one of them.
License
ISC (see LICENSE).
Logo
The logo is Simple Icons' NestJS icon (icons/nestjs.svg of simple-icons 16.37.0, CC0-1.0), in the colour the set lists for the brand (#E0234E); its path is unmodified. It names the framework the plugin builds apps of. NestJS and its mark are its authors'. It is not covered by this package's ISC licence.