Skip to content

Contributing ​

Setup ​

  • Node.js 24 (use a version manager like nvm)
  • pnpm
  • A MongoDB for the tests (docker run -d -p 27017:27017 mongo:7)
bash
pnpm install
pnpm dev:prepare # build the module stub and the type stubs
pnpm dev # start the playground

Repository layout ​

PathContent
src/The Nuxt module: options, composables, server composables, embedded server handler
src/runtime/api/The generated OpenAPI client (pnpm api-codegen, do not edit)
packages/server-core/@sfxcode/mongocamp-server-core, the server
apps/server/The standalone server (Nitro 3) and its Dockerfiles (Node, Bun, Deno)
openapi/docs.yamlThe OpenAPI spec, the contract between server and client
playground/A Nuxt app using the module
test/Module tests and the contract suites (test/contract)
docs/This site (VitePress)

Playground environment ​

Create playground/.env:

bash
MONGOCAMP_URL=
MONGOCAMP_ADMIN_USER=admin
MONGOCAMP_ADMIN_PASSWORD=secret
NITRO_MONGOCAMP_API_KEY=

With the embedded server the playground makes sure that the user from .env exists as an administrator.

Scripts ​

ScriptPurpose
pnpm lint / pnpm lint:fixESLint
pnpm testUnit and integration tests (needs MongoDB)
pnpm test:contractThe contract suites of the REST API against the in-process core. With BASE_URL, BASE_PREFIX, DATABASE and GEODATA_DATABASE they run against any running server.
pnpm typecheck:serverType check of the server core
pnpm api-codegenRegenerates the client from openapi/docs.yaml
pnpm --filter @sfxcode/mongocamp-server-core api-typesRegenerates the server types from the spec
pnpm --filter mongocamp-docs devThis documentation site

Changing the API ​

  1. Edit openapi/docs.yaml.
  2. Run pnpm api-codegen and pnpm --filter @sfxcode/mongocamp-server-core api-types.
  3. Implement the route in packages/server-core/src/routes.
  4. Add contract tests. The REST API pages of this site update on their own, because they are generated from the spec.

Releases ​

pnpm release lints, tests, bumps the version with changelogen, copies the version to the workspace packages and publishes @sfxcode/mongocamp-server-core and @sfxcode/nuxt-mongocamp-server.

Released under the MIT License.