Open-Source Wikis

/

Traefik

/

Traefik

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:

  1. One or more providers observe an external system and push a dynamic.Configuration describing the desired routers, services, middlewares, and TLS material.
  2. A configuration watcher debounces and merges those messages into a single live snapshot.
  3. A router factory turns the snapshot into a tree of HTTP, TCP, and UDP handlers.
  4. Entry points receive client traffic on configured ports and dispatch it through the handler tree.
  5. Middlewares wrap each route to provide authentication, rate limiting, retries, compression, headers, observability, and dozens more behaviors.
  6. 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

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-version to 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-lint configured 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.

Traefik – Traefik wiki | Factory