# The Library

This doc briefly runs through each package in the `libs/infrastructure-components` library.

## Components

This is for high level abstractions, such as `NewGRPCService`, or `NewHTTPService`.

These use the lower-level components to create a higher level abstraction for a certain infrastructure usecase.

For example, a GRPC service, which is configured to use the Postgres cluster and the Redis cluster automatically, and exposes the gRPC connection on a specified port number.

For now, we only really have a gRPC component and a HTTP component, but we can add more as needed. For example, we could create a Kafka Component.

## Container

This package is for creating Docker container configurations as part of Deployments.

## Deployment

This package is for creating Deployments.

## Docker

This package is for creating and building Docker images. Which the `container` package can utilise.

## Resources

A series of constants for container resources, such as CPU and Memory. These are a few sesible defaults, for example:

```golang
var ResourcesSmall = corev1.ResourceRequirementsArgs{
    Limits: pulumi.StringMap{
        "cpu":    pulumi.String("250m"),
        "memory": pulumi.String("128Mi"),
    },
    Requests: pulumi.StringMap{
        "cpu":    pulumi.String("125m"),
        "memory": pulumi.String("64Mi"),
    },
}
```

## Scaffold

Packages up lower level components, such as `Deployment`, `Container` and `Docker` into a single function, which can be used to create a new service.

This package also starts the Pulumi process, as well as creating a service's config. The `Run` method, takes a yaml config file, as seen and explained in [Creating your first service](https://docs.mediamagic.dev/product-docs/libs/infrastructure-components/docs/creating-your-first-service).

This is the package you will likely want to use, if you're doing something typical. Such as running a gRPC service with sensible defaults.
