Keep your Intended Architecture in your repository

Hello community,

You can now define the Intended Architecture of a project in a file in your repository, on SonarQube Cloud. Anyone who can administer issues on a project can also define its architecture, so the people closest to the code can start without asking for permission.

Last month your coding agent learned to define architecture with you. Today the result can live next to your code.

Add the architecture file to your repository

Add a file named sonar-architecture.json to the base directory of your project. It uses the same Intended Architecture definition as the public Web API, the SonarQube CLI, and the SonarQube MCP Server, so you, your team, and your agent all edit one format.

The next analysis reads the file and checks your code against it. The Intended Architecture page in SonarQube lets you visualize your project’s high-level blueprint, even when controlled through the file.

Review architecture changes in pull requests

Change the architecture file in the same pull request as the code it describes. Pull request analysis checks the code against the file in that branch, so you see the deviations a new architecture would raise before you merge.

Your main branch keeps its own model until the change merges. Reverting the commit restores the previous Intended Architecture.

Choose where the model lives

Each project has one source of truth. By default, SonarQube uses the file when it exists and the model saved in SonarQube when it doesn’t. While a file manages the model, editing in the Web UI is turned off and there is a message that explains it. In the project setting you can change to only allow the Web UI and ignore the file.

Define architecture with the permissions you already have

Users and groups with the Administer Issues permission on a project can now create, edit, and delete its Intended Architecture. Developers and tech leads usually hold it already through default groups.

If you need stricter separation of duties, an organization administrator can turn off “Allow issue administrators to manage project architecture” in the organization settings. After that, only users and groups with the dedicated “Administer Architecture” permission can edit.

Get started

  1. Export the current Intended Architecture with sonar architecture in the SonarQube CLI, or ask your coding agent to write the file from your current architecture.
  2. Commit the file to the base directory of your project and open a pull request.
  3. Review the deviations on the pull request, then merge.

Availability

Available now in SonarQube Cloud. SonarQube Server support comes in the next version. Supported languages: Java, C#, JavaScript, TypeScript, Python.

To learn more, see the documentation and the architecture resource center.

Tell us how it works for your team in this thread.

For a monorepo with several SonarQube projects, is the architecture file expected at each project’s configured base directory, or can one repository-level sonar-architecture.json describe multiple projects? If each project needs its own file, how are shared architecture rules handled without duplicating the same model across projects?

Hi James, thanks for the question.

Yes, the architecture file is read for each base directory sonar.projectBaseDir so that each project can be managed on its own.

For enforcing architecture rules across projects, we have dedicated features in open beta that allow enforcing boundaries across projects and checking more granular custom rules without per project setup or redundancy.

Let me know if you’re interested in joining the beta!