# What Is the Main Executable or Entry Point for Archify?

> Discover the main executable entry point for Archify. Learn how bin/archify.mjs serves as the primary command declared in package.json for this project.

- Repository: [tt-a1i/archify](https://github.com/tt-a1i/archify)
- Tags: how-to-guide
- Published: 2026-08-13

---

**The main executable entry point for Archify is `bin/archify.mjs`, declared in [`package.json`](https://github.com/tt-a1i/archify/blob/main/package.json) under the `bin` field as the `archify` command.**

The `tt-a1i/archify` repository distributes a Node.js command-line tool for generating architecture diagrams. Understanding the main executable or entry point for Archify is essential for developers contributing to the codebase, debugging CLI behavior, or extending the tool with custom renderers.

## Entry Point Declaration in package.json

The Node.js package manifest defines the CLI binary in the `bin` field. According to the source code in [`archify/package.json`](https://github.com/tt-a1i/archify/blob/main/archify/package.json), the `archify` command maps directly to the module script at `./bin/archify.mjs`:

```json
"bin": {
  "archify": "./bin/archify.mjs"
}

```

When users install the package globally via `npm install -g` or run it via `npx`, the `archify` shell command resolves to this file. The path is relative to the package root, placing the executable logic inside the `bin/` directory.

## The CLI Shim: bin/archify.mjs

`archify/bin/archify.mjs` serves as the primary bootstrap script. It begins with a shebang line that ensures Unix-like systems execute it with Node.js:

```javascript
#!/usr/bin/env node

```

This module handles **argument parsing**, **command dispatch**, and **workflow orchestration**. Rather than implementing rendering logic directly, it acts as a router that validates incoming CLI flags and delegates to specialized sub-modules. The script supports high-level commands including `render`, `compare`, `deliver`, `preview`, and others, making it the central dispatcher for the entire Archify toolchain.

## Command Dispatch and Renderer Selection

Once invoked, the entry point parses the command-line arguments to determine which **renderer** to load. Archify supports multiple diagram types:

- **architecture**
- **workflow**
- **sequence**
- **dataflow**
- **lifecycle**

The entry point selects the appropriate renderer implementation and coordinates **rendering**, **validation**, **delivery**, **preview**, and **comparison** workflows. All state management and I/O operations for these commands originate from the logic defined in `bin/archify.mjs`.

## Available CLI Commands

You can invoke the following commands through the main executable. Each call ultimately executes the logic inside `bin/archify.mjs` before delegating to the specific renderer:

```bash

# Render an architecture diagram to HTML

archify render architecture path/to/model.json output.html

# Compare two versions and generate a diff report

archify compare architecture base.json head.json diff.html --receipt diff.receipt.json

# Deliver (render + validate + write) a workflow diagram

archify deliver workflow diagram.json workflow.html --open

# Start an interactive live preview for a sequence diagram

archify preview sequence flow.json

# Display help and available options

archify --help

```

## Renderer Execution Flow

After the entry point identifies the command and diagram type, it delegates actual rendering work to specialized modules located under `archify/renderers/<type>/render-<type>.mjs`. For example:

- `archify/renderers/architecture/render-architecture.mjs`
- `archify/renderers/workflow/render-workflow.mjs`

This separation of concerns keeps the entry point lightweight while allowing each diagram type to maintain its own validation and generation logic.

## Summary

- The **main executable entry point** is defined in [`archify/package.json`](https://github.com/tt-a1i/archify/blob/main/archify/package.json) under `bin.archify`, pointing to `bin/archify.mjs`.
- `bin/archify.mjs` is a shebang-enabled Node.js module that parses CLI arguments and dispatches to sub-commands.
- The entry point supports diagram types including **architecture**, **workflow**, **sequence**, **dataflow**, and **lifecycle**.
- Actual rendering implementations reside in `archify/renderers/<type>/render-<type>.mjs`, invoked by the CLI shim.
- Commands such as `render`, `compare`, `deliver`, and `preview` are all orchestrated from this single entry point.

## Frequently Asked Questions

### What file does the `archify` command resolve to?

When you type `archify` in your terminal, the shell resolves the command to `archify/bin/archify.mjs` as defined in the `bin` field of [`package.json`](https://github.com/tt-a1i/archify/blob/main/package.json). This file contains the shebang `#!/usr/bin/env node` and serves as the primary bootstrap script for the CLI.

### How does Archify handle CLI argument parsing?

The entry point script `bin/archify.mjs` performs the initial argument parsing to identify the sub-command (such as `render`, `compare`, or `preview`) and any flags like `--open` or `--receipt`. It then validates the inputs and selects the appropriate renderer before executing the requested workflow.

### Where are the diagram rendering implementations located?

Specific rendering logic is not contained in the entry point itself. Instead, `bin/archify.mjs` delegates to modules located at `archify/renderers/<type>/render-<type>.mjs`, where `<type>` corresponds to the diagram category (e.g., `architecture`, `workflow`, `sequence`).

### Can I run the entry point directly without installing the package?

Yes. Because `bin/archify.mjs` includes the `#!/usr/bin/env node` shebang and uses ECMAScript modules (`.mjs` extension), you can execute it directly with Node.js from the repository root:

```bash
node archify/bin/archify.mjs --help

```