WIP DOCUMENTATION
Muchas is an opinionated microservice nodejs framework. We use a set of other frameworks to build a rich ecoystem with a standard way of building applications.
npm i -s muchas-framework
We are explain using the default folder strucuture. The MuchasFr
import MuchasFramework from 'muchas-framework';
(async () => await MuchasFramework.init())();
We can use two files to define our environment variables, we use the muchas.yml
to help us organize our config object and a .env file for dynamic configuration values.
All the ${VARIABLE} will be replaced buy the environment variables
env: ${NODE_ENV} # Enviroment (development, production)
name: ${PROJECT_NAME} # Project name
debug: # Debug options
port: ${DEBUG_PORT} # NodeJS debug port
web: # Web server
port: ${SERVER_PORT} # Web server port
headers: # Web server default response headers
Access-Control-Allow-Origin: '*'
Access-Control-Allow-Methods: '*'
Access-Control-Allow-Headers: '*'
health: # Health web server
port: 9000 # Health web server port
apm: # Application performance management
host: ${APM_HOST} # Host
logLevel: ${APM_LEVEL} # Level
sample: 0.2 # Sample rate
logger: # Logger
elasticsearch: # Elasticsearch logger
host: ${LOGGER_ELASTIC_HOST} # Elastic host
level: ${LOGGER_ELASTIC_LEVEL} # Log level
database: # Database
uri: ${DATABASE_URI} # Database URI
model: # Models
path: ${MODELS_PATH} # Model base path
broker: # Broker
host: ${BROKER_HOST} # Broker Host
components: # Components
path: ${COMPONENTS_PATH} # Components base path
NODE_ENV=development
DATABASE_URI=mongodb://mongo/muchas
SERVER_PORT=6028
BROKER_HOST=rabbit
COMPONENTS_PATH=dist/tests/integration/components
MODELS_PATH=dist/tests/integration/models
LOGGER_ELASTIC_HOST=http://elastic:9200
LOGGER_ELASTIC_LEVEL=error
PROJECT_NAME=muchas
APM_HOST=http://elastic-apm:8200
APM_LEVEL=error
The web application uses express under the hood
We support amqp protocol for our message broker and we encourage to use it with RabbitMQ
Level | Priority |
---|---|
error | 0 |
warn | 1 |
info | 2 |
verbose | 3 |
debug | 4 |
silly | 5 |