Basic Usage

Step-by-step walkthrough of creating and running your first Morax monorepo.

The Interactive Wizard

When you execute npm create morax@latest, you will be guided through a series of intuitive terminal prompts:

Terminal Output
$ npm create morax

? What is the name of your monorepo? › my-project

? Select applications in apps/:
  [x] Next.js Application (web)
  [x] Vite + React Template (desktop)

? Select shared packages in packages/:
  [x] Shared UI Components (@workspace/ui)
  [x] TypeScript Configurations (@workspace/typescript-config)
  [x] ESLint Base Rules (@workspace/eslint-config)

✔ Created workspace configuration
✔ Executing official generators dynamically...
✔ Injecting workspace symlinks into packages
✔ Bootstrapping dependencies via pnpm install...

✨ Successfully initialized my-project!

Monorepo Directory Layout

Morax generates a clean, standard pnpm monorepo structure. Applications live in apps/, while reusable packages live in packages/:

Directory Tree
my-project/
├── apps/
│   ├── web/               # Next.js 15+ App Router application
│   └── desktop/           # Vite + React single page app
├── packages/
│   ├── ui/                # Shared UI component library
│   ├── eslint-config/     # Unified ESLint flat configs
│   └── typescript-config/ # Shared tsconfig bases
├── package.json           # Root workspace scripts & dependencies
└── pnpm-workspace.yaml    # PNPM packages declaration

Running Workspace Commands

Enter your new project folder and use pnpm to execute commands across your entire monorepo:

Project Root
cd my-project

# Run all applications concurrently in development mode
pnpm dev

# Build all applications and packages
pnpm build

# Run linter across all packages
pnpm lint

To run scripts for a specific application only, use the --filter flag:

Filtered Execution
# Run only the Next.js web application
pnpm --filter web dev

# Run only the Vite desktop application
pnpm --filter desktop dev

Importing Shared Packages

Morax automatically links shared packages into your application package.json files using pnpm’s workspace:* protocol.

You can import components directly into your Next.js or Vite apps with zero extra build steps:

apps/web/src/app/page.tsx
// Inside apps/web/src/app/page.tsx
import { Button } from '@workspace/ui/components/button';

export default function Page() {
  return (
    <main>
      <h1>Hello from Next.js</h1>
      <Button variant="default">Shared UI Button</Button>
    </main>
  );
}