# Project Model

> For the complete documentation index, see [llms.txt](https://plugins.jetbrains.com/docs/intellij/llms.txt).

This topic considers the concept of projects based on the IntelliJ Platform and related subjects, such as modules, libraries, facets, and SDKs.

> **Note: Workspace Model API (2024.2+)**
> The [Workspace Model](workspace-model.html) API is available since 2024.2 for use by third-party plugins and should be preferred over using the Project Model API. See [Interoperability with Project Model API](workspace-model.html#interoperability) and [Usage Examples](workspace-model-usages.html).
>
>
>
> Since the 2020.3 release, related internal changes are included; see this [blog post](https://blog.jetbrains.com/platform/2020/10/new-implementation-of-project-model-interfaces-in-2020-3/) for details. This shouldn't affect any plugins using the Project Model API properly and which don't access internal classes.

## Project Model Hierarchy

The project model organizes files into a four-level hierarchy:

1. [Project](#project) — the top-level container for all project content.

2. [Module](#module) — a discrete unit of functionality within a project. Each module's root configuration is available through [ModuleRootManager](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootManager.java).

3. Content Root ([ContentEntry](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ContentEntry.java)) — a directory on disk owned by a module, defining the filesystem boundary for that module's files. A module may have multiple content roots.

4. Source Root and Exclude Root — designated subdirectories within a content root. Represented by [SourceFolder](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/SourceFolder.java) and [ExcludeFolder](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ExcludeFolder.java), both extending [ContentFolder](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ContentFolder.java). See [Module](module.html) for details.

Key entry points for querying the project model:

* [ProjectRootManager](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectRootManager.java) — project-wide root information and change notifications.

* [ModuleRootManager](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ModuleRootManager.java) — per-module access to content entries, source roots, and order entries.

* [ProjectFileIndex](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/projectModel-api/src/com/intellij/openapi/roots/ProjectFileIndex.java) — fast queries from a [VirtualFile](virtual-file.html) to its owning module, content root, and source root type.

## Project

> **TL;DR**
> Reference: [Project](project.html)
>
>
>
> Product Help: [Projects](https://www.jetbrains.com/help/idea/creating-and-managing-projects.html)

A project encapsulates all of a project's source code, libraries, and build instructions into a single organizational unit.

> **Tip:**
> Everything in the IntelliJ Platform SDK is done within the context of a project.

A project defines collections referred to as [Modules](#module) and [Libraries](#library). Depending on the project's logical and functional requirements, a single-module or a multi-module project can be created.

## Module

> **TL;DR**
> Reference: [Module](module.html)
>
>
>
> Product Help: [Modules](https://www.jetbrains.com/help/idea/creating-and-managing-modules.html)

A module is a discrete unit of functionality that can be run, tested, and debugged independently. Modules include such things as source code, build scripts, unit tests, deployment descriptors, etc.

In a project, each module can use a specific [Software Development Kit (SDK)](#sdk) or inherit the SDK defined at the project level. A module can depend on other modules of the project.

## Library

> **TL;DR**
> Reference: [Library](library.html)
>
>
>
> Product Help: [Libraries](https://www.jetbrains.com/help/idea/library.html)

A library is an archive of compiled code (such as JAR files) on which modules depend. The IntelliJ Platform supports three types of libraries: Module, Project, and Global Libraries.

## SDK

> **TL;DR**
> Reference: [SDK](sdk.html)
>
>
>
> Product Help: [SDK](https://www.jetbrains.com/help/idea/sdk.html)

Every project uses a Software Development Kit (SDK). For Java projects, SDK is referred to as JDK (Java Development Kit).

The SDK determines which API library is used to build the project. For a multi-module project, the project SDK is common for all [modules](#module) within the project by default. Optionally, a project can configure an individual SDK for each module.

## Facet

> **TL;DR**
> Reference: [Facet](facet.html)
>
>
>
> Product Help: [Facets](https://www.jetbrains.com/help/idea/facet-page.html)

A facet represents a certain configuration, specific for a particular framework or technology associated with a [module](#module). A module can have multiple facets.

## Configuration

> **TL;DR**
> Product Help: [Project Structure](https://www.jetbrains.com/help/idea/project-settings-and-structure.html)

The user can configure all entities listed above in the Project Structure dialog.

Use [ProjectSettingsService](https://github.com/JetBrains/intellij-community/tree/idea/263.7307.200/platform/lang-api/src/com/intellij/openapi/roots/ui/configuration/ProjectSettingsService.java) to open related entries programmatically.

