Skip to content

Multi-projects

Sometimes you may want to split your LikeC4 model into multiple ones, based on domains, teams, or any other criteria.

You can do this by creating multiple projects in your workspace and linking them together.
You can also use this feature to share your model with other teams or projects.

Create likec4.config.json files in the folders you want to be projects:

  • Directorycloud
    • likec4.config.json
    • service1.c4
    • service2.c4
  • Directoryexternals
    • likec4.config.json
    • amazon.c4

Projects can be nested.
In this case, files from the nested project are not part of the parent project.

  • Directorycloud
    • likec4.config.json
    • service1.c4
    • service2.c4
    • Directorynested
      • likec4.config.json
      • service3.c4 // this will be part of the ‘nested’ project, not the ‘cloud’ project

You can import elements from other projects by using the import keyword.

import { serviceA } from 'projectA'
model {
serviceB = service {
-> serviceA.api 'calls serviceA'
}
}

At the moment, the only way to share specification (or any other parts of the model) is to use symlinks:

  • Directoryshared
    • specs.c4
  • Directorycloud
    • specs.c4 // -> ../shared/specs.c4
    • likec4.config.json
  • Directoryexternals
    • specs.c4 // -> ../shared/specs.c4
    • likec4.config.json