Skip to main content
Node Blueprint uses a monorepo structure powered by Yarn Workspaces to manage multiple packages in a single repository.

Overview

The monorepo contains two main applications:
node-blueprint/
├── apps/
│   ├── create-node-blueprint/    # CLI package
│   └── web/                      # Documentation site
├── package.json                  # Root package.json with workspaces config
└── yarn.lock                     # Shared lockfile

Workspace Configuration

The root package.json defines the workspace structure:
{
  "name": "node-blueprint",
  "private": true,
  "workspaces": [
    "apps/*"
  ]
}
All packages in the apps/ directory are automatically included as workspaces.

Package Details

create-node-blueprint (CLI)

Location: apps/create-node-blueprint/ Package Name: create-node-blueprint Version: 1.6.1 Purpose: The main CLI package that users install via npm create node-blueprint

Directory Structure

apps/create-node-blueprint/
├── src/
│   ├── constants/        # Constants and configuration
│   ├── enums/           # TypeScript enums
│   ├── program/         # CLI program logic
│   ├── prompts/         # Interactive prompts
│   ├── services/        # Core services (file operations, etc.)
│   ├── template/        # Template files for generation
│   │   ├── base/        # Base project files
│   │   ├── common/      # Shared template files
│   │   ├── frameworks/  # Framework-specific templates
│   │   ├── orms/        # ORM-specific templates
│   │   └── util/        # Utility templates
│   ├── types/           # TypeScript type definitions
│   └── utils/           # Helper utilities
├── dist/                # Built output (generated)
├── package.json
├── tsconfig.json
└── index.ts             # Entry point

Key Files

  • index.ts: The main entry point for the CLI
  • src/template/: Contains all template files that get copied to generated projects
  • package.json: Defines the CLI package configuration and dependencies

Build Process

The CLI uses a custom build process:
"scripts": {
  "clean": "rm -rf dist",
  "copy": "cp -r src/template dist/src",
  "build": "yarn run clean && tsc && yarn run copy",
  "postbuild": "chmod +x dist/index.js"
}
  1. clean: Removes old build artifacts
  2. tsc: Compiles TypeScript to JavaScript
  3. copy: Copies template files to dist (templates aren’t compiled)
  4. postbuild: Makes the CLI executable

Dependencies

Key Dependencies:
  • @clack/prompts - Beautiful CLI prompts
  • yargs - Command-line argument parsing
  • ejs - Template rendering
  • fs-extra - Enhanced file system operations
  • consola - Console logging
  • ora - Terminal spinners

web (Documentation Site)

Location: apps/web/ Package Name: @node-blueprint/web Purpose: The documentation website built with React and Vite

Technology Stack

  • Framework: React 19
  • Build Tool: Vite
  • Styling: Tailwind CSS 4
  • UI Components: Radix UI
  • Routing: React Router 7
  • Analytics: Vercel Analytics & PostHog

Build Process

"scripts": {
  "dev": "vite",
  "build": "tsc -b && vite build",
  "preview": "vite preview"
}

Workspace Scripts

The root package.json provides convenient scripts to work with both packages:
"scripts": {
  "dev:web": "yarn workspace @node-blueprint/web dev",
  "dev:cli": "yarn workspace create-node-blueprint dev",
  "build:web": "yarn workspace @node-blueprint/web build",
  "build:cli": "yarn workspace create-node-blueprint build",
  "build": "yarn build:cli && yarn build:web"
}

Script Breakdown

ScriptDescription
yarn dev:webStart the docs site dev server
yarn dev:cliRun the CLI with tsx (no build needed)
yarn build:webBuild the docs site for production
yarn build:cliBuild the CLI package
yarn buildBuild both CLI and docs

Working with Workspaces

Running Commands in a Specific Workspace

# Run a script in a specific workspace
yarn workspace create-node-blueprint <command>
yarn workspace @node-blueprint/web <command>

# Examples
yarn workspace create-node-blueprint build
yarn workspace @node-blueprint/web dev

Installing Dependencies

# Install for all workspaces (from root)
yarn install

# Add a dependency to a specific workspace
yarn workspace create-node-blueprint add <package-name>
yarn workspace @node-blueprint/web add <package-name>

# Add a dev dependency
yarn workspace create-node-blueprint add -D <package-name>

Why Yarn Workspaces?

Benefits:
  1. Single lockfile - All dependencies locked in one place
  2. Shared dependencies - Common packages are deduplicated
  3. Easy cross-package development - Work on multiple packages simultaneously
  4. Simplified scripts - Run commands across all packages from root
  5. Consistent versioning - Manage versions from one place

Template Organization

The template system is organized by concern:
src/template/
├── base/          # Base files every project needs
│                  # (package.json, tsconfig.json, .gitignore, etc.)
├── common/        # Common code shared across configurations
│                  # (middleware, utils, config)
├── frameworks/    # Framework-specific code
│   ├── express/
│   └── fastify/
├── orms/          # ORM-specific code
│   ├── drizzle/
│   ├── prisma/
│   └── mongoose/
└── util/          # Utility templates
Templates use EJS for dynamic content generation based on user selections.

Development Flow

Typical development workflow:
1

Make changes

Edit files in the appropriate workspace (apps/create-node-blueprint or apps/web)
2

Test locally

For CLI changes:
yarn dev:cli
# or
yarn build:cli && create-node-blueprint
For docs changes:
yarn dev:web
3

Build for production

yarn build

Next Steps

Local Setup

Set up your development environment

Adding Templates

Learn how to add new templates

Build docs developers (and LLMs) love