This repository is a multi-package NicTool workspace that includes:
- A Node.js API service (
api) that talks to MySQL and uses JWT auth. - Shared DNS/domain libraries (
dns-resource-record,dns-zone,dns-nameserver,validate). - A web client (
client). - A legacy Perl NicTool stack (
NicTool).
When making changes, treat this as a set of related but independently runnable packages.
High-level dependency flow:
dns-resource-record: record-level parsing/validation/conversion.dns-zone: zone-level import/export and zone-rule validation, built ondns-resource-record.dns-nameserver: nameserver config parsers, built ondns-zone.validate: NicTool object schema validation (group/user/zone/etc).api: HTTP API service using@nictool/validateand@nictool/dns-resource-record, plus MySQL.client: browser UI that consumes API behavior.NicTool: legacy server/client implementation (Perl stack).
-
All commands are run from within the relevant package directory (e.g.,
cd NicToolorcd dns-resource-record). -
There is no single root
package.jsonfor all packages. Run install/test/lint inside the package you are changing. -
Keep changes scoped. If you need to change API behavior, update the API package and its tests, but do not make sweeping changes to shared libraries unless necessary.
-
Respect each package's existing module system:
- ESM packages exist (
api,dns-resource-record,dns-zone,dns-nameserver,client). - Convert CommonJS in (
validate) to ESM
- ESM packages exist (
-
Preserve package-local formatting/lint style. Do not run sweeping repo-wide formatting.
- Service entry:
server.jscallsroutes/index.jsstartup. - Routing lives in
routes/*.js; data access and business logic live inlib/*.js. - Route validation schemas come from
@nictool/validate. - Config is YAML-driven via
conf.d/*.ymland loaded throughlib/config.js. - Tests are
node --test, orchestrated bytest.sh. test.shsets up and tears down DB fixtures; keep tests compatible with that flow.
If you change an API route or payload shape:
- Update route handler in
routes/. - Update related logic in
lib/as needed. - Update route/lib tests (
routes/*.test.js,lib/*.test.js). - Keep validation contracts in sync with
@nictool/validate.
- API tests expect a local MySQL instance and schema initialization from
api/sql. - Never introduce real secrets.
- Prefer environment overrides or test/dev config blocks instead of hardcoding credentials.
- Do not commit local machine paths, ad hoc cert material, or one-off debug config changes.
- Contains object/schema validation used by API routes.
- CommonJS exports (
module.exportspattern). - Tests run with
node --test.
- Record-level parser/validator/import/export library.
- Focus on RFC-compliant RR behavior and conversion fidelity.
- Tests use Mocha.
- Zone-level import/export and coexistence rules for records.
- Uses
dns-resource-recordunderneath. - Tests use Mocha.
- Parses nameserver config formats (bind, knot, maradns, nsd, tinydns).
- Uses
dns-zone. - Tests use Mocha.
client: Vite-based web UI with Bootstrap/Sass.- Keep API contract assumptions aligned with current API responses.
- Avoid changing API payload formats only to satisfy UI code unless requested.
- This is the legacy Perl implementation and has different conventions/tooling.
- Do not apply Node package assumptions in this tree.
- Make minimal, isolated changes when touching this area.
apinpm testnpm run lintnpm run prettier
validatenpm testnpm run lintnpm run prettier
dns-resource-recordnpm testnpm run lintnpm run prettier
dns-zonenpm testnpm run lintnpm run prettier
dns-nameservernpm testnpm run lint
clientnpm run develop(ornpm run start)npm run buildnpm run lintnpm run prettier
Run the smallest relevant test/lint set for changed files first, then broaden if needed.
- Keep patches small and targeted.
- Preserve existing naming and file layout.
- Add or update tests for behavior changes.
- Avoid dependency churn unless required for the task.
- Prefer explicit error handling and clear return shapes in API code.
- Keep commits focused by package or concern.
- Include a brief rationale in commit messages when behavior changes.
- Mention cross-package impact explicitly when a change in one package affects another.