traefik/traefik
Traefik
Traefik is a modern HTTP reverse proxy and load balancer written in Go. Instead of asking operators to maintain a static list of routes, it watches the platform you already run (Docker, Kubernetes, Consul, Nomad, ECS, etc.) and rebuilds its routing table on the fly.
What this codebase contains
This repository is the source for the traefik binary itself. It is a single-binary Go project, plus a TypeScript/Vue dashboard under webui/ that is embedded into the Go binary at build time.
The core flow is short to describe and long to implement:
- One or more providers observe an external system and push a
dynamic.Configurationdescribing the desired routers, services, middlewares, and TLS material. - A configuration watcher debounces and merges those messages into a single live snapshot.
- A router factory turns the snapshot into a tree of HTTP, TCP, and UDP handlers.
- Entry points receive client traffic on configured ports and dispatch it through the handler tree.
- Middlewares wrap each route to provide authentication, rate limiting, retries, compression, headers, observability, and dozens more behaviors.
- Services terminate the request at one or more backends, optionally requesting TLS certificates from an ACME resolver along the way.
All of this runs inside one process, supervised by cmd/traefik/traefik.go.
Who this wiki is for
- Engineers reading the source for the first time and trying to figure out where to look.
- Contributors adding a new provider, middleware, or load-balancing strategy.
- Operators who want to understand how a config change becomes a routed request.
For end-user documentation (configuration reference, how-to guides, migration notes), see the official site at https://doc.traefik.io/traefik/. The official docs live under docs/content/ in this repo.
Where to start
- New to the codebase? Read Architecture and then pick a provider page in Providers.
- Want to run it locally? See Getting started.
- Confused by a term? Check the Glossary.
- Want to file a PR? See How to contribute.
Repository facts
- Language: Go (
223k LOC across 749 files) and a TypeScript/Vue dashboard (12k LOC). - Module path:
github.com/traefik/traefik/v3. - Go toolchain pinned in
.go-versionto Go 1.25. - First commit: August 2015. Tag count: 544. v1.0.0 in 2016, v2.0.0 in 2019, v3.0.0 in April 2024.
- Lint:
golangci-lintconfigured in.golangci.yml. - License: MIT (
LICENSE.md).
Key entry files
| File | Purpose |
|---|---|
cmd/traefik/traefik.go |
Process entry point, wires providers, server, observability. |
pkg/config/static/static_config.go |
Schema for the static configuration file/CLI flags. |
pkg/config/dynamic/http_config.go |
Schema for the dynamic configuration (routers, services, middlewares). |
pkg/server/server.go |
The lifecycle owner that ties entry points and the watcher together. |
pkg/server/configurationwatcher.go |
Debounces and applies provider updates. |
pkg/server/routerfactory.go |
Builds router trees from configuration. |
pkg/server/server_entrypoint_tcp.go |
TCP/HTTP/HTTP3 entry point implementation. |
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.