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 playgroundRepository layout
| Path | Content |
|---|---|
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.yaml | The 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
| Script | Purpose |
|---|---|
pnpm lint / pnpm lint:fix | ESLint |
pnpm test | Unit and integration tests (needs MongoDB) |
pnpm test:contract | The 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:server | Type check of the server core |
pnpm api-codegen | Regenerates the client from openapi/docs.yaml |
pnpm --filter @sfxcode/mongocamp-server-core api-types | Regenerates the server types from the spec |
pnpm --filter mongocamp-docs dev | This documentation site |
Changing the API
- Edit
openapi/docs.yaml. - Run
pnpm api-codegenandpnpm --filter @sfxcode/mongocamp-server-core api-types. - Implement the route in
packages/server-core/src/routes. - 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.
