MBC CQRS Serverless is a TypeScript framework for building serverless applications on AWS using the CQRS (Command Query Responsibility Segregation) pattern. It's built on NestJS and provides abstractions for working with AWS services like Lambda, DynamoDB, SNS, and SQS.
- CQRS Pattern: Separation of read and write operations for better scalability
- Event Sourcing: Complete audit trail of all changes
- Multi-tenancy: Built-in tenant isolation
- AWS Integration: Ready-to-use integrations with AWS services
- Local Development: Full local development support with LocalStack
- AWS Lambda (compute)
- DynamoDB (data storage)
- SNS/SQS (messaging)
- Cognito (authentication)
- API Gateway (REST APIs)
- AppSync (GraphQL)
- Step Functions (workflows)
- S3 (file storage)
- SES (email)
npm install -g @mbc-cqrs-serverless/cli
mbc new my-project
cd my-project
npm installNode.js 18 or higher is required.
- Copy environment template:
cp .env.example .env - Start LocalStack:
npm run start:localstack - Create tables:
npm run ddb:create - Start server:
npm run offline
- Commands: Write operations that change state (create, update, delete)
- Queries: Read operations that do not change state (get, list, search)
Data is isolated by tenant using partition key prefixes. Each tenant's data has a unique prefix (e.g., TENANT001#ORDER), and the framework automatically filters queries by the current tenant context.
Each entity has a version field. When updating, the framework checks that the version matches the current version in the database. If not, the update fails with a conflict error.
mbc generate module orders
mbc generate controller orders
mbc generate service ordersnpm test # Unit tests
npm run test:e2e # E2E tests
npm run test:cov # With coveragenpm init --scope mbc-cqrs-serverless -w ./packages/package-namenpm run deploy:dev # Development
npm run deploy:stg # Staging
npm run deploy:prod # Production- Create tag on
developfor alpha release - Merge to
betaand create tag for beta release - Merge to
mainand create tag for production release
GitHub Actions automatically publishes to npm when tags are pushed.
See TROUBLESHOOTING.md for common issues and solutions.
Open an issue on GitHub with:
- Description of the issue
- Steps to reproduce
- Expected vs actual behavior
- Environment details (Node version, OS, etc.)
See CONTRIBUTING.md for contribution guidelines.
- TypeScript with strict mode
- ESLint + Prettier
- All documentation in English