The backend of a slack bot to help and nurture our team mates


Stored into the /components folder. Each one of them comes with an index.js file that acts as a manifest telling systemic how to wire components but most important in which order starting and stopping them.


  • app: healthy-thoughts root system (component).
  • logger: logging utility component.
  • express: express server component.
  • config: configuration manager component.
  • routes: express server routes component.
    • routes.admin: admin api routes sub-components.


The root component defining the service system.


The logging component providing the following logs structure:

{TIMESTAMP} | {LOG_LEVEL} [{healthy-thoughts}] | {MESSAGE}


An express server that always comes in handy to expose at least a set of admin endpoints for monitoring purposes.


The component in charge of mixing and set up the configuration defined into the files of the folder /config in order to come up with the correct configuration for the given run mode:

  • default
  • local
  • test
  • build
  • prod


The component in charge of specifiyng the routes to be exposed by the express component. Note that the express endpoints are secured thanks to helmet.


The admin api sub-component in charge of exposing the /__/manifest endpoint.


The configuration is scattered across different files and mixed according to the service run mode as said above. The intesting bit is the fact that is stored in js objects and is definable per-component and per-sub-component.

E.g. routes and routes.admin default configuration:

    routes: {
		admin: {
			swaggerValidator: {
				apiDocEndpoint: '/__/docs/api',
				validateRequests: true,
				validateResponses: true,
				validationEndpoint: '/test',
				format: 'yaml',
				yaml: {
					file: './docs/syncapi.yaml',


The /docs folder holds the synchronous api documentation for the endpoints exposed by the routes component. As defined in the above section the syncapi.yaml is used by the swagger-endpoint-validator in order to:

  • validate the requests and responses.
  • expose the swagger api documentation at the /__/docs/api endpoint.


  • Dokcerfile: the service is dockerized and ready to be shipped thanks to the Dockerfile.


The service comes whit an easy and lean makefile that can be used as a base for any CI/CD tool that need to manage the service.


Starting the service means to start the system components and sub-components in the proper order. Something that the index.js and the system.js files are taking care of.

npm run start


The service comes with a simple tests framework already in place in the /test folder.

running the tests

npm run test


View Github