Skip to content
Snippets Groups Projects

Organizations service

What it does

This service provides a list of organizations with different information about it (such as description, logo..etc).
In our application, one organization is usually a provider of data, used in the Portail Open Data. It can be a public actor or a private one.

How it works

organizations-service

The entrypoint of the service is a REST API provided by a NestJS application. This backend application interacts with a PostgresSQL database through an ORM called TypeORM.

API documentation

NestJS provides a swagger module that can be easily integrated. Using specific annotations alongside your endpoints declaration, this module will automatically generates a swagger documentation, reachable at /api-docs.

Service health

NestJS provides a health module based on Terminus, that gives you the opportunity to declare predifined or custom health indicators. It exposes the health status of the service at /health.
This service will return a 200 http status code when all indicators are healthy. Otherwise it will return a 503 http status code.

For this service we declared an health indicator that verifies that it can connect to the database.

Stats

We are using a Node module called swagger-stats.
It traces API calls, monitors API performance and usage statistics. It exposes the metrics in different formats, such as Prometheus format, so you may use Prometheus and Graphana for API monitoring and alterting.
Those metrics are available at /swagger-stats/metrics.

For more information about this module, visit the official swagger-stat page.

Docker

It is possible to run this service using Docker containers, using the docker-compose.yml and Dockerfile files.
For more information, refer to the project [organizations-service][add a link]