Sourcegraph architecture overview
This is a high level overview of Sourcegraph's architecture so you can understand how our systems fit together. You can click on each component to jump to its respective code repository or subtree.
Note that almost every service has a link back to the frontend, from which is gathers configuration updates. These edges are omitted for clarity.
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 and enterprise/cmd folders.
- zoekt-indexserver and zoekt-webserver provide indexed search. They are written in Go.
- Syntect server is our syntax highlighting service written in Rust. It is not horizontally scalable so only 1 replica is supported.
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.
- sourcegraph/deploy-sourcegraph-dot-com is a fork of the above that is used to deploy to the Kubernetes cluster that serves https://sourcegraph.com.
References
Here are some references to help you understand how multiple systems fit together:
- Life of a search query
- Life of a repository
- Life of a ping
- Search pagination
- Code intelligence
- Sourcegraph extension architecture
- Future topics we will cover here:
- Web app and browser extension architecture