Muchas Framework
raw JSON →Muchas is an opinionated microservice NodeJS framework designed to streamline and standardize application development by providing a cohesive, integrated ecosystem of established libraries. It leverages Express under the hood for building web applications, Mongoose for robust Object Data Modeling (ODM) with MongoDB databases, and `amqp.node` for efficient message brokering, encouraging use with RabbitMQ. The framework enforces a specific application structure and relies heavily on external configuration, utilizing `muchas.yml` for structured configuration and `.env` files for dynamic environment variables, which dictate crucial settings such as server ports, database connection URIs, and component loading paths. At version `0.0.130`, it signifies a project in its nascent or experimental stages, which implies that the APIs are highly unstable and prone to frequent, potentially undocumented breaking changes even between minor or patch releases. Its "WIP DOCUMENTATION" status further underscores this instability and suggests an irregular or effectively halted release cadence. Key differentiators include its strong opinions on how microservices should be built, providing out-of-the-box components for web servers, message brokers, scheduled routines, health monitoring, and an extensible logging system with built-in Elasticsearch integration. This approach aims to reduce boilerplate and enforce best practices across a suite of services, though it demands adherence to its specific architectural choices.
Common errors
error Error: listen EADDRINUSE: address already in use :::<port_number> ↓
error ReferenceError: MuchasFramework is not defined ↓
error MongoServerSelectionError: connect ECONNREFUSED <ip>:<port> ↓
error (amqp.node) Channel closed by server: 406 (PRECONDITION_FAILED) - parameters for queue '<queue_name>' in vhost '/' are different. ↓
Warnings
breaking The package is pre-1.0 (version 0.0.130) and actively states "WIP DOCUMENTATION". This implies an unstable API with frequent, undocumented breaking changes that can occur between patch versions. ↓
gotcha Heavy reliance on external configuration via 'muchas.yml' and '.env' files for fundamental settings like ports, database URIs, and component paths. Misconfiguration will lead to runtime errors or unexpected behavior. ↓
gotcha The project appears to be unmaintained or abandoned, with the last publish over four years ago. This means there will be no security updates, bug fixes, or feature enhancements from the original authors. ↓
gotcha The framework uses a global initialization pattern (MuchasFramework.init()), which can make testing and mocking difficult without careful design patterns or explicit framework support for dependency injection. ↓
Install
npm install muchas-framework yarn add muchas-framework pnpm add muchas-framework Imports
- MuchasFramework wrong
const MuchasFramework = require('muchas-framework');correctimport MuchasFramework from 'muchas-framework'; - Web wrong
import Web from 'muchas-framework/lib/web';correctimport { Web } from 'muchas-framework'; - Logger wrong
import { createLogger } from 'muchas-framework';correctimport { Logger } from 'muchas-framework'; - Broker wrong
import { BrokerService } from 'muchas-framework';correctimport { Broker } from 'muchas-framework';
Quickstart
import MuchasFramework from 'muchas-framework';
(async () => {
try {
console.log('Initializing Muchas Framework...');
await MuchasFramework.init();
console.log('Muchas Framework initialized successfully.');
// In a real application, you'd start listening for messages or requests here.
// Example: MuchasFramework.web.start() or register broker consumers.
// Note: The framework typically relies on configuration files (muchas.yml, .env)
// for port numbers, database URIs, etc.
} catch (error) {
console.error('Failed to initialize Muchas Framework:', error);
process.exit(1);
}
})();