Module Authoring
Full public documentation is available at https://exetjs.com/.
A ExetJS module must be explicit and readable.
HTTP feature structure
src/modules/example/
├─ example.module.ts
├─ example.routes.ts
├─ example.controller.ts
├─ example.service.ts
├─ example.repository.ts
├─ example.schema.ts
├─ example.types.ts
└─ index.ts
Module contract
export const exampleModule: ExetModule = {
name: "example",
basePath: "/example",
register: (ctx) => {
return {
router: createExampleRouter(...),
};
},
};
Template manifest
Every installable template needs manifest.json.
The CLI uses this file to determine:
- files to copy;
- dependencies to add;
- env entries to append;
- module import and module registry entry.
Resource modules
Infrastructure modules can omit routes, controllers and basePath. Return a disposer from register and declare any startup dependencies through dependsOn. Release partially acquired resources if registration throws; the engine can dispose only successfully returned resources.
A DB module includes its module factory, config, driver, connection lifecycle, types, errors and exports. DB template authoring happens in tools/db-core, followed by pnpm db:generate and pnpm db:check.
A template manifest may set minimumCoreVersion to require a lifecycle-capable Core. A self-contained module template may set moduleDirectory to its source module directory; the installer maps that directory to the consumer’s configured module path and adjusts its registry import. Environment entries may contain comments associated with each setting.
Documentation contract
Installable module documentation is part of the module contract. A module change is incomplete until its reference documentation is updated.
Update the relevant docs whenever a template changes any of the following:
- public exports or public TypeScript types;
manifest.jsondependencies, environment entries orminimumCoreVersion;- routes, request validation or response behavior;
- configuration keys, defaults or precedence;
- lifecycle states, health behavior or error codes;
- native client shape or provider-specific behavior;
- production prerequisites or security-sensitive behavior.
For repository-wide rules, see Documentation.