Developing & hosting custom microservices

A Hasura project is composed of a set of microservices. These include certain Hasura microservices but can also include your own microservices.

Some typical examples of microservices you would add to your application include, an API service, a webapp, a microservice that serves static files, for a simple HTML site or a SPA (eg: React), a ready made microservice like the ghost blog-engine or a ‘stateful’ microservice like a database.

NOTE: If you’re starting a new hasura project, head to hasura.io/hub to find the right stack boilerplate and follow the guide there!

If you’re thinking about adding a new microservice to your existing Hasura project, pick up one of the following guides:

Here’s what your Hasura cluster looks like before and after you add custom microservices:

../../_images/adding-custom-microservices.png

These are the 3 key steps you need to follow for deploying any microservice:

  1. Create a folder inside the microservices directory in your project.
  2. Configure git push hasura master to build and deploy your microservice.
  3. Expose the microservice externally to the world by adding a route (subdomain, or path).

This is what your project folder might look like once you’ve added a microservice:

├── microservices/
    └── app/              # a new folder to contain microservice code/config
        ├── k8s.yaml
        ├── Dockerfile
        └── src/
└── conf/
    ├── routes.yaml       # a new route entry in this file
    └── ci.yaml           # a new entry here to enable git-push

Now that you’re familiar with the basic concepts of what a microservice is, pick up one of the following guides and get started: