Project config
To define a project, create a likec4.config.json
file in the folder.
All files in the folder (and subfolders) will be part of this project:
Directoryexternals
- amazon.c4
- …
Directoryservices
- service1.c4
- service2.c4
- …
- specification.c4
- likec4.config.json
Configuration
Section titled “Configuration”The likec4.config.json
file must have the name of the project.
{ "$schema": "https://likec4.dev/schemas/config.json", "name": "project-name", // required "title": "Project Title" // optional}
The name must be unique if you use multiple projects.
Exclude files
Section titled “Exclude files”By default, LikeC4 recursively scans in the project folder.
You can exclude files by adding an exclude
array to the config file.
{ "name": "project-name", "exclude": [ "**/node_modules/**" ]}
If no exclude pattern is provided, LikeC4 uses ["**/node_modules/**"]
as default.
The exclude pattern is the same as the one used by picomatch.
Image Aliases
Section titled “Image Aliases”When using local images in your LikeC4 model, you can create aliases for the folder your images are in to make them more readable and the files more transportable.
Use the likec4.config.json
to add an imageAliases
field:
{ "name": "project-name", "imageAliases": { "@": "./images", "@root": "../../some-more-images" }}
You can then use the alias in your model:
// ./amazon.c4model { serviceA = service { icon: @/service-a.png }
serviceB = service { icon: @root/service-b.png }}
// ./externals/externals.c4model { serviceC = service { icon: @/service-c.png }}
Directorysome-more-images
- service-b.png
- …
Directorydocs
Directoryproject
Directoryimages
- service-a.png
- service-c.png
- …
Directoryexternals
- externals.c4
- likec4.config.json
- amazon.c4
- …
Naming Rules
Section titled “Naming Rules”When using image aliases, keep the following rules in mind:
- Aliases must start with
@
and can include letters, numbers, and underscores. - The alias must be unique within the project.
- The alias can point to a relative or absolute path.
Defaults
Section titled “Defaults”{ "imageAliases": { "@": "./images", }}
When no LikeC4 configuration file is found, or when no imageAliases
field is found, LikeC4 uses the following defaults:
{ "imageAliases": { "@": "./images", }}
This is true even if you specify other aliases. Simply override the @
to change the default location.
{ "imageAliases": { "@": "./my-images", }}