## Documentation Index

Fetch the complete documentation index at: [/llms.txt](https://hub-docs.wundergraph.com/llms.txt)

Use this file to discover all available pages before exploring further.

The GitLab integration is a powerful feature that bridges your GraphQL schema management with your development workflow. This integration allows you to automatically sync schema in proposals with GitLab projects, streamlining your development process and keeping your schemas in sync with your codebase.

## Setup and Configuration

1. Navigate to the "Integrations" tab under "Settings".
2. Click the "Connect GitLab" button.

3. Choose your GitLab instance type.

A dialog will appear asking you to choose your GitLab instance type. WunderGraph Hub supports two connection flows:

- GitLab.com (Cloud)
- Self-Hosted / GitLab Enterprise

Use this option if your repositories are hosted on [gitlab.com](https://gitlab.com/).

1. Select the **GitLab.com** tab in the dialog.
2. Click **Connect** — you will be redirected to GitLab.com to authorize the WunderGraph Hub application.
3. Grant the necessary permissions (`api`, `read_repository`, `write_repository`).
4. Once authorized, you will be redirected back to WunderGraph Hub.

Use this option if your organization runs a self-hosted or enterprise GitLab instance. Before connecting, you need to create a GitLab OAuth application on your instance. See the [GitLab App Setup guide](https://hub-docs.wundergraph.com/integrations/git/gitlab-app-setup) for step-by-step instructions.

1. Select the **Self-Hosted** tab in the dialog.
2. Enter your **GitLab Instance URL** (e.g., `https://gitlab.example.com`). Must use HTTPS.
3. Enter the **Application ID (Client ID)** from your GitLab OAuth application.
4. Enter the **Secret (Client Secret)** from your GitLab OAuth application.
5. Click **Connect** — you will be redirected to your GitLab instance to authorize the application.
6. Once authorized, you will be redirected back to WunderGraph Hub.

4. Navigate to any of your graphs, click the dropdown in the top-left corner, select "Integrations", then select "Git".

5. Select the GitLab projects you want to connect to each subgraph.
6. Click "Save Mappings" to connect the projects.

This will create initialization MRs in all selected projects with the respective subgraph schema.

## Merge Request Lifecycle

The GitLab integration automatically synchronizes merge request states with your schema proposal status, ensuring your development workflow stays aligned with your schema management process. **Merge Request State Management:**

| State | Behavior |
| --- | --- |
| **Ready for Review** | When a proposal is created in opened state, a merge request is automatically created in “ready for review” state across all mapped projects. |
| **Draft** | When a proposal is moved to draft state, the merge request transitions to draft state. |
| **Closed** | When the proposal is closed, the corresponding merge request is also closed. |
| **Reopened** | If a closed proposal is reopened, the merge request is also reopened. |

## How It Works

### Streamlined Development Workflow

The GitLab integration eliminates the friction between schema design and implementation by automatically creating branches in your mapped projects whenever a schema proposal is made. This means developers can immediately start implementing changes without manual setup.

### Automatic Merge Request Creation

When a schema proposal is created in the hub, the integration automatically:

- Creates a new branch in the mapped project
- Stores the proposed schema files directly in the branch
- Creates a merge request with the schema changes on new changes after creating a proposal or by opening the proposal.
