Skip to content

Create a MACH component

Creating a component

The easiest way to get started with a component is by looking at the cookiecutter:

mach-component-cookiecutter

We'll add a GitHub template scaffold project in the near future.

Adding it to your stack

A component can be added to your MACH stack by including it in your MACH Composer configuration.

It should be present in your:

  1. Component definitions so that MACH Composer knows where to find your component
  2. Site component configuration to include it in your MACH composer stack add site-specific configuration

The tutorial includes an example of a configuration file with a component implemented.

Using Serverless framework

The 'function'-part of a MACH component can easily be integrated with the serverless framework for "zero-friction serverless development".

This gives you a couple of features:

  • Easy local development of your function code including mocked infrastructure that might be needed for your setup
  • Build & package your function by calling sls package. More info about Packaging & Deployment

Serverless framework in your MACH deployment

Although we do encourage the usage of the serverless framework for development and packaging, we don't recommend using it for the actual MACH composer deployment itself.
More info about this in the MACH configuration deployment notes.

Further reading

Continue to component structure for an explanation of a component's internals.