Goals & OKRs
Relevant source files
The following files were used as context for generating this wiki page:
- apps/gauzy/src/app/pages/goals/goals.component.ts
- packages/mcp-server/src/lib/tools/goals.ts
- packages/mcp-server/src/lib/tools/key-results.ts
- packages/core/src/lib/goal/default-goals.ts
- packages/core/src/lib/keyresult-template/default-keyresult-templates.ts
- apps/gauzy-e2e/src/integration/GoalsTest.ts
- apps/gauzy-e2e/src/integration/GoalsKPITest.ts
- README.md
- packages/ui-core/i18n/assets/i18n/en.json
The Goals & OKRs (Objectives and Key Results) module is a core feature of the Gauzy platform, designed for setting, tracking, and managing goals across different hierarchical levels of an organization. It enables users to define high-level objectives and measure their achievement through specific, measurable key results. This system supports goal alignment for individuals, teams, and the entire organization.
The feature is accessible through the main UI and programmatically via the Model Context Protocol (MCP) server, which exposes a rich set of tools for interacting with goals and key results.
Sources: README.md, apps/gauzy/src/app/pages/goals/goals.component.ts, packages/mcp-server/src/lib/tools/goals.ts
Core Concepts
The system is built around two primary entities: Goals (Objectives) and Key Results.
- Goal (Objective): A high-level, ambitious target. Goals are defined with a name, a deadline, and an owner. They can exist at three distinct levels:
Organization: A top-level goal for the entire company.Team: A goal specific to a department or team.Employee: A personal goal for an individual.
- Key Result: A measurable outcome required to achieve a Goal. Each Goal is composed of one or more Key Results. Progress on Key Results contributes to the overall progress of the parent Goal.
Sources: packages/core/src/lib/goal/default-goals.ts:2-18, apps/gauzy/src/app/pages/goals/goals.component.ts:101-107
Data Model
The relationship between Goals and Key Results is a one-to-many association. A single Goal can have multiple Key Results, and the progress of a Goal is a weighted calculation of the progress of its associated Key Results.
The following diagram illustrates the basic entity relationship.
This ER diagram shows that a GOAL can have one or more KEY_RESULT entities.
Sources: apps/gauzy/src/app/pages/goals/goals.component.ts:18-25, packages/mcp-server/src/lib/tools/goals.ts:50-60, packages/mcp-server/src/lib/tools/key-results.ts:170-180
Key Result Types
Key Results can be of different types to accommodate various measurement methods:
| Type | Description |
|---|---|
Numerical | Progress is measured by a numerical value moving from an initial to a target value. |
True/False | A binary task that is either done (1) or not done (0). |
Currency | Progress is measured in a monetary value. |
KPI | Progress is tied to a pre-defined Key Performance Indicator (KPI). |
Task | Progress is linked to the completion of a specific task within the system. |
Sources: packages/core/src/lib/keyresult-template/default-keyresult-templates.ts:5-100, packages/ui-core/i18n/assets/i18n/en.json:1330-1336
Frontend Implementation
The primary user interface for this feature is the GoalsComponent.
Sources: apps/gauzy/src/app/pages/goals/goals.component.ts
Component Responsibilities
The GoalsComponent is responsible for:
- Fetching and displaying all goals and their associated key results for the selected organization.
- Providing UI elements to filter goals by level (
All,Team,Organization,Employee). - Handling user interactions to create, view, edit, and delete goals and key results.
- Opening dialogs (
EditObjectiveComponent,EditKeyResultsComponent, etc.) for CRUD operations. - Calculating and displaying the progress of each goal based on its key results.
Sources: apps/gauzy/src/app/pages/goals/goals.component.ts:70-365
User Flow for Creating a Goal
The following sequence diagram illustrates the process of creating a new goal from the user interface.
This diagram shows the sequence of events when a user creates a new goal through the UI.
Sources: apps/gauzy/src/app/pages/goals/goals.component.ts:286-318
Key Methods in GoalsComponent
| Method | Description |
|---|---|
loadPage() | Fetches all goals and their related entities from the backend using GoalService. |
createObjective() | Opens a dialog to create a new goal. It checks if the maximum number of objectives has been reached before proceeding. |
addKeyResult() | Opens a dialog to add a new key result to an existing goal. It also checks for limits. |
calculateGoalProgress(keyResults) | Calculates the overall progress of a goal based on the progress and weight of its key results. |
filterGoals(selection, allGoals) | Filters the displayed list of goals based on the user's selection (e.g., 'My Objectives', 'Team Objectives'). |
Sources: apps/gauzy/src/app/pages/goals/goals.component.ts:149-365
API and Tooling (MCP Server)
The Goals & OKRs module is exposed through a set of tools in the MCP (Model Context Protocol) server, allowing for programmatic access and automation. These tools wrap the platform's REST API endpoints.
Sources: packages/mcp-server/src/lib/tools/goals.ts, packages/mcp-server/src/lib/tools/key-results.ts
Goal Tools
These tools manage Goal entities.
| Tool Name | Description |
|---|---|
get_goals | Get a paginated list of goals for the organization. |
get_goal_count | Get the total count of goals. |
get_goal | Get a specific goal by its ID. |
create_goal | Create a new goal. |
update_goal | Update an existing goal. |
update_goal_progress | Update the progress of a specific goal. |
delete_goal | Delete a goal by its ID. |
get_my_goals | Get goals assigned to the current authenticated user. |
get_team_goals | Get goals for a specific team. |
get_goal_statistics | Get goal statistics for the organization. |
align_goals | Align one goal with another (parent-child relationship). |
get_goal_templates | Get a list of available goal templates. |
Sources: packages/mcp-server/src/lib/tools/goals.ts:27-434
Key Result Tools
These tools manage KeyResult entities.
| Tool Name | Description |
|---|---|
get_key_results | Get a paginated list of key results. |
get_key_result_count | Get the total count of key results. |
get_key_result | Get a specific key result by its ID. |
create_key_result | Create a new key result. |
update_key_result | Update an existing key result. |
update_key_result_progress | Update the progress of a key result. |
delete_key_result | Delete a key result by its ID. |
get_key_results_by_goal | Get all key results for a specific goal. |
get_my_key_results | Get key results assigned to the current user. |
create_key_result_update | Create a progress update entry for a key result. |
get_key_result_updates | Get all progress updates for a key result. |
get_key_result_statistics | Get statistics for key results. |
Sources: packages/mcp-server/src/lib/tools/key-results.ts:27-386
Default Data and Templates
The system is seeded with default goals and key result templates to provide examples and starting points for users.
Default Goals
A set of default goals is available to illustrate usage at different organizational levels.
| Goal Name | Level |
|---|---|
| Improve product performance | Organization |
| Successfully launch version 2 of our main product | Organization |
| Redesign and launch our new landing page | Team |
| Increase quality of releases and make sure they are timely | Team |
| Identify problems with current user interface | Employee |
Sources: packages/core/src/lib/goal/default-goals.ts:1-19
Key Result Templates
The system also includes templates that bundle a goal with a set of pre-defined key results. For example, the "Redesign and launch our new landing page" template includes:
- Design new version of our site structure, navigation and all pages.
- Conduct stakeholder interviews with 10 people from sales and marketing.
- With development and marketing, launch by September 1st.
- User-test page prototypes on 10 people.
- Test existing landing page and sub-pages on external users for understanding issues.
Sources: packages/core/src/lib/keyresult-template/default-keyresult-templates.ts:40-84
End-to-End Testing
The core functionality of the Goals & OKRs feature is validated through end-to-end (E2E) tests, which simulate a typical user workflow.
The following diagram shows the flow of the main E2E test for goals.
This flowchart outlines the steps in the GoalsTest.ts E2E test, covering the full CRUD lifecycle of a goal and its key result.