How caddyserver/caddy works
Caddy is an extensible server platform whose principal workflow is to load JSON or adapt Caddyfile configuration, start configured apps, and serve HTTP(S) requests. Its major runtime capabilities include automatic certificate management, a modular HTTP handler stack, reverse proxying, static files, and an administrative API. The graph combines README-documented product behavior with relationships visible in sampled source; several runtime links are dashed where their implementation was not sampled.
Main entry points: routes.go Routes and handlers · server.go HTTP server · automation.go TLS automation · load.go Config loading
Components 26
Configuration
- Caddyfile parser
caddyconfig/caddyfile/parse.go - HTTP adapter
caddyconfig/httpcaddyfile/httptype.go - Config loading
caddyconfig/load.go
HTTP services
- HTTP app
modules/caddyhttp/app.go - HTTP server
modules/caddyhttp/server.go - Routes and handlers
modules/caddyhttp/routes.go - Reverse proxy
modules/caddyhttp/reverseproxy/reverseproxy.go - FastCGI client
modules/caddyhttp/reverseproxy/fastcgi/client.go - Static files
modules/caddyhttp/fileserver/staticfiles.go - HTTP templates
modules/caddyhttp/templates/tplcontext.go - HTTP/2 push
modules/caddyhttp/push/handler.go
TLS and PKI
- TLS automation
modules/caddytls/automation.go - Local PKI
modules/caddypki/ca.go - ACME server
modules/caddypki/acmeserver/acmeserver.go
Platform services
- Caddy CLI
cmd/main.go - Admin API
admin.go - Module registry
modules.go - Standard modules
modules/standard/imports.go - Certificate storage
modules/filestorage/filestorage.go - Logging
modules/logging/filewriter.go - Metrics
modules/metrics/metrics.go
Other components
- Operator
- Native JSON config
- HTTP clients
- Upstream services
- Certificate issuers
Connections 23
- Operator → Caddy CLI: runs
- Caddy CLI → Config loading: loads config
cmd/main.go - Caddy CLI → HTTP adapter: adapts config
- Caddyfile parser → HTTP adapter: parses directives
caddyconfig/httpcaddyfile/httptype.go - HTTP adapter → HTTP app: builds app config
caddyconfig/httpcaddyfile/httptype.go - Config loading → Native JSON config: loads JSON
- Config loading → Admin API: configures runtime
- Standard modules → Module registry: registers modules
modules/standard/imports.go - HTTP app → HTTP server: starts servers
- HTTP server → Routes and handlers: dispatches requests
- Routes and handlers → Reverse proxy: routes to
- Reverse proxy → FastCGI client: uses FastCGI
- Reverse proxy → Upstream services: forwards requests
- Routes and handlers → Static files: routes to
- Routes and handlers → HTTP templates: renders templates
- Routes and handlers → HTTP/2 push: may push resources
- HTTP app → TLS automation: uses TLS
- TLS automation → Certificate issuers: obtains certificates
- TLS automation → Local PKI: supports local CA
- Local PKI → ACME server: serves ACME
- TLS automation → Certificate storage: stores certificates
- HTTP server → Logging: logs requests
- HTTP server → Metrics: exports metrics