Skip to main content

Check out Port for yourselfย 

Working with monorepos


After connecting your Git provider to Port, Port will automatically create an entity for each repository in the organization in which you installed the integration.

If you're working with a monorepo and would like to create an entity for each microservice in a single repository instead, you can do that by making an adjustment to your Git integration's mapping:

  1. Go to the data-sources page of your portal.
  2. Under Exporters, click on the Git provider you would like to edit, for example:


  1. A window will open with a YAML mapping of the integration.
    Use the following snippet as needed for your use-case (either add the folder entry to the resources array, or replace the entire YAML with it):
Choose repos and folders to include

In the snippet below, change the path and repos fields to your desired values before copying.

resources:
- kind: folder
selector:
query: "true" # JQ boolean query. If evaluated to false - skip syncing the object.
folders: # Specify the repositories and folders to include under this relative path.
- path: apps/* # Relative path to the folders within the repositories.
repos: # List of repositories to include folders from.
- backend-service
- frontend-service
port:
entity:
mappings:
identifier: ".folder.name"
title: ".folder.name"
blueprint: '"service"'
properties:
url: .repo.html_url + "/tree/" + .repo.default_branch + "/" + .folder.path
readme: file://README.md
  1. Click on Resync to apply the changes.

  2. Head back to your catalog, as you can see Port has now created an entity for each folder in the specified repositories, instead of creating an entity for each repository.