Muchas Framework
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.
Installing
npm i -s muchas-framework
How it works
We are explain using the default folder strucuture. The MuchasFr
Quick start
; await MuchasFramework.init;
muchas.yml and .env
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.
muchas.yml example
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
.env example
NODE_ENV=developmentDATABASE_URI=mongodb://mongo/muchasSERVER_PORT=6028BROKER_HOST=rabbitCOMPONENTS_PATH=dist/tests/integration/componentsMODELS_PATH=dist/tests/integration/modelsLOGGER_ELASTIC_HOST=http://elastic:9200LOGGER_ELASTIC_LEVEL=errorPROJECT_NAME=muchasAPM_HOST=http://elastic-apm:8200APM_LEVEL=error
Web
The web application uses express under the hood
Broker
We support amqp protocol for our message broker and we encourage to use it with RabbitMQ
Message Queue
RPC (Beta)
Routines
Health
Logger
Levels
Level | Priority |
---|---|
error | 0 |
warn | 1 |
info | 2 |
verbose | 3 |
debug | 4 |
silly | 5 |