Skip to main content

new Command

Create a new Stratix project with the new command.

Usage​

stratix new <project-name> [options]

Interactive Mode​

stratix new

You'll be prompted for:

  • Project name
  • Project template (DDD, Modular, Minimal)
  • Package manager (npm, pnpm, yarn)
  • Install dependencies (yes/no)

Non-Interactive Mode​

stratix new my-app --template ddd --pm pnpm --skip-install

Options​

OptionAliasDescriptionDefault
--template-tProject templateddd
--package-manager--pmPackage managernpm
--skip-installSkip dependency installationfalse
--skip-gitSkip git initializationfalse
--directory-dTarget directory<project-name>

Templates​

DDD Template (Default)​

Domain-Driven Design structure:

stratix new my-app --template ddd

Structure:

my-app/
├── src/
│ ├── domain/
│ │ ├── entities/
│ │ ├── value-objects/
│ │ └── services/
│ ├── application/
│ │ ├── commands/
│ │ └── queries/
│ ├── infrastructure/
│ │ ├── persistence/
│ │ └── http/
│ └── main.ts
├── tests/
├── package.json
└── tsconfig.json

Modular Template​

Bounded contexts for microservices:

stratix new my-app --template modular

Structure:

my-app/
├── src/
│ ├── contexts/
│ │ ├── products/
│ │ │ ├── domain/
│ │ │ ├── application/
│ │ │ └── infrastructure/
│ │ └── orders/
│ │ ├── domain/
│ │ ├── application/
│ │ └── infrastructure/
│ └── main.ts
├── tests/
├── package.json
└── tsconfig.json

Minimal Template​

Bare-bones setup:

stratix new my-app --template minimal

Structure:

my-app/
├── src/
│ └── main.ts
├── package.json
└── tsconfig.json

Examples​

Create with pnpm​

stratix new my-app --pm pnpm

Create without installing​

stratix new my-app --skip-install
cd my-app
pnpm install

Create in specific directory​

stratix new my-app --directory ./projects/my-app

Create modular project​

stratix new my-microservices --template modular

What Gets Created​

Files​

  • package.json - Project metadata and dependencies
  • tsconfig.json - TypeScript configuration
  • .eslintrc.js - ESLint configuration
  • .prettierrc - Prettier configuration
  • .gitignore - Git ignore rules
  • README.md - Project documentation
  • src/main.ts - Application entry point

Dependencies​

Core:

  • @stratix/core - Core framework
  • @stratix/runtime - Application runtime

Dev Dependencies:

  • typescript - TypeScript compiler
  • @types/node - Node.js type definitions
  • eslint - Linting
  • prettier - Code formatting
  • jest - Testing framework

Post-Creation Steps​

After creating a project:

cd my-app

# Install dependencies (if skipped)
npm install

# Add extensions
stratix add @stratix/http-fastify
stratix add @stratix/postgres

# Generate code
stratix generate entity Product

# Build
npm run build

# Run
npm start

Best Practices​

1. Use DDD Template for Most Projects​

stratix new my-app --template ddd

2. Use Modular for Microservices​

stratix new my-services --template modular

3. Choose Package Manager Wisely​

# pnpm - Fast, efficient
stratix new my-app --pm pnpm

# npm - Standard
stratix new my-app --pm npm

# yarn - Alternative
stratix new my-app --pm yarn

4. Skip Install in CI/CD​

stratix new my-app --skip-install

Next Steps​