Project Structure – Source and Compiled Outputs

This section outlines how the DocuWriter.ai n8n nodes are organized in source form under nodes/ and how they’re consumed by n8n from the compiled dist/ directory. It covers the main action node, the trigger node, and credential definitions.

Source Directory (nodes/)

The nodes/ folder contains the original TypeScript implementation of all n8n nodes:

  • Action Node

    • File: nodes/DocuWriter/DocuWriter.node.ts
    • Description: Implements the DocuWriter.ai action node. It defines a class DocuWriter that handles resources such as Code Documentation, Code Tests, Code Comments, UML Diagrams, Code Optimization, Generations, and User Info, all extending INodeType .
  • Trigger Node

    • File: nodes/DocuWriterTrigger/DocuWriterTrigger.node.ts
    • Description: Defines a webhook trigger docuWriterTrigger which listens for generation.created events from the DocuWriter.ai API.
  • Credentials Definition

    • File: credentials/DocuWriterApi.credentials.ts
    • Description: Implements DocuWriterApi credential type. It uses generic authentication via an API token header and includes a test request to /user.

Compiled Output (dist/)

n8n requires compiled JavaScript. All TS files under nodes/ and credentials/ compile to dist/:

Location Description
dist/nodes/DocuWriter/DocuWriter.node.js Compiled JavaScript for the action node
dist/nodes/DocuWriterTrigger/DocuWriterTrigger.node.js Compiled JavaScript for the trigger node
dist/credentials/DocuWriterApi.credentials.js Compiled JavaScript for DocuWriter.ai API credentials
index.js Stub for package.json main; exports empty object
# Typical build command
pnpm run build

How n8n Loads These Files

  1. Manifest Registration
    n8n reads the node definitions from the compiled files under dist/nodes/.... The manifest (auto-generated during build) registers:

    • docuWriter from dist/nodes/DocuWriter/DocuWriter.node.js
    • docuWriterTrigger from dist/nodes/DocuWriterTrigger/DocuWriterTrigger.node.js
  2. Credentials Registration
    The credential type docuWriterApi is loaded from dist/credentials/DocuWriterApi.credentials.js.

  3. Execution Environment

    • Requires Node.js ≥ 18.10
    • Uses pnpm as the package manager for workspace management and fast builds.
{
  "commands": {
    "npm": "npm install",
    "yarn": "yarn add",
    "pnpm": "pnpm add",
    "bun": "bun add"
  }
}

Summary of Responsibilities

  • Source (nodes/, credentials/)

    • Author and maintain business logic in TS.
    • Define node properties, parameters, and execution methods.
  • Compiled (dist/)

    • Provide n8n with production-ready JS.
    • Keep source and runtime cleanly separated.

By following this structure, DocuWriter.ai nodes remain easy to develop, test, and deploy, while n8n seamlessly consumes the compiled artifacts at runtime.