Sourcegraph Architecture Overview
This is a high level overview of Sourcegraph's architecture so you can understand how our systems fit together.
Clients
We maintain multiple Sourcegraph clients:
These clients generally communicate with a Sourcegraph instance (either https://sourcegraph.com or a private customer instance) through our GraphQL API. There are also a small number of REST endpoints for specific use-cases.
Services
Our backend is composed of multiple services:
- Most are Go services found in the cmd folder.
- Syntect server is our syntax highlighting service written in Rust. It is not horizontally scalable so only 1 replica is supported.
- LSIF server provide precise code intelligence based on the LSIF data format. It is written in TypeScript.
- zoekt-indexserver and zoekt-webserver provide indexed search. It is written in Go.
Infrastructure
- sourcegraph/infrastructure contains Terraform configurations for Cloudflare DNS and Site 24x7 monitoring, as well as build steps for various docker images. Only private docker images should be added here, public ones belong in the main repository.
- sourcegraph/deploy-sourcegraph contains YAML that can be used by customers to deploy Sourcegraph to a Kubernetes cluster.
- sourcegraph/deploy-sourcegraph-docker contains a pure-Docker cluster deployment reference that some one-off customers use to deploy Sourcegraph to a non-Kubernetes cluster.
Guides
Here are some guides to help you understand how multiple systems fit together:
- Life of a search query
- Search pagination
- Future topics we will cover here:
- Life of a repository (i.e. how does code end up on gitserver?)
- Sourcegraph extension architecture
- Web app and browser extension architecture