The MBC CLI is a command-line interface tool that helps you initialize and manage MBC CQRS Serverless applications. It provides commands for project creation, version management, and development workflow automation.
To install the mbc
command globally, run:
npm install -g @mbc-cqrs-serverless/cli
The CLI provides flexible options for creating new projects:
mbc new [projectName[@version]]
- Create a new project in the current directory:
mbc new
- Create a project with a specific name:
mbc new my-cqrs-app
- Create a project with a specific version:
mbc new my-cqrs-app@0.1.45
The CLI creates a standardized project structure:
my-cqrs-app/
├── src/
│ ├── commands/ # Command handlers
│ ├── events/ # Event handlers
│ ├── interfaces/ # TypeScript interfaces
│ └── services/ # Business logic services
├── test/
│ ├── e2e/ # End-to-end tests
│ └── unit/ # Unit tests
├── package.json
└── serverless.yml # Serverless Framework configuration
- After creating a project, install dependencies:
cd my-cqrs-app
npm install
- Build the project:
npm run build
- Start local development environment:
npm run offline:docker # Start local infrastructure
npm run migrate # Run database migrations
npm run offline:sls # Start serverless offline
-
mbc new
: Create a new project -
mbc version
: Display CLI version -
mbc help
: Show command help -
mbc list
: List available project templates
The CLI supports configuration through:
- Command line arguments
- Environment variables
- Configuration files
Example configuration file (.mbcrc.json
):
{
"defaultTemplate": "basic",
"region": "ap-northeast-1",
"stage": "dev"
}
Visit https://mbc-cqrs-serverless.mbc-net.com/ to view the full documentation, including:
- Detailed CLI commands and options
- Project setup and configuration
- Development server setup
- Available endpoints and services
Common issues and solutions:
- Version not found:
mbc new myapp@999.999.999
# Error: Version not found. Available versions: [0.1.45, 0.1.44, ...]
Solution: Use mbc list versions
to see available versions.
- Project creation fails:
mbc new my-project
# Error: Directory not empty
Solution: Use a new directory or remove existing files.
Copyright © 2024, Murakami Business Consulting, Inc. https://www.mbc-net.com/
This project and sub projects are under the MIT License.