A connection represents Sourcebot’s link to a code host platform (GitHub, GitLab, etc). Connections are defined within the config file you provide Sourcebot. Each connection defines how Sourcebot should authenticate and interact with a particular host, and which repositories to sync and index from that host. Connections are uniquely identified by their name.
Example config with two connections
{
    "$schema": "https://raw.githubusercontent.com/sourcebot-dev/sourcebot/main/schemas/v3/index.json",
    "connections": {
        // 1. A connection to GitHub.com
        "github-connection": {
            "type": "github",
            "repos": [
                "sourcebot-dev/sourcebot"
            ],
            "token": {
                "env": "GITHUB_TOKEN"
            }
        },
        // 2. A self-hosted GitLab instance
        "gitlab-connection": {
            "type": "gitlab",
            "url": "https://gitlab.example.com",
            "groups": [
                "my-group",
                "my-other-group/sub-group"
            ],
            "token": {
                "env": "GITLAB_TOKEN"
            }
        }
    }
}
Configuration files must conform to the JSON schema.

Connection Syncing

When a connection is first discovered, or the resyncConnectionIntervalMs setting has exceeded, the connection will be synced. This consists of:
  1. Fetching the latest changes from HEAD (and any additional branches) from the code host.
  2. Re-indexing the repository.
This is processed in a job queue, and is parallelized across multiple worker processes. Jobs will take longer to complete the first time a repository is synced, or when a diff is large. On the home page, you can view the sync status of ongoing jobs:

Platform Connection Guides

To learn more about how to create a connection for a specific code host, check out the guides below.
Missing your code host? Submit a feature request on GitHub.

Schema reference