Open-Source Wikis

/

Caddy

/

Apps

caddyserver/caddy

Apps

An "app" in Caddy is a top-level module that implements Start() and Stop(). The Caddy core loads apps from Config.AppsRaw (caddy.go) and runs each one for the lifetime of the configuration. Apps are the only modules with empty namespaces — their module ID is a single label.

The standard build ships four apps:

App ID Source Purpose
http modules/caddyhttp/app.go Production-ready HTTP/1.1, HTTP/2, HTTP/3 server with auto-HTTPS
tls modules/caddytls/tls.go Certificate loading, ACME issuance, connection policies
pki modules/caddypki/pki.go Internal certificate authority (with optional ACME server)
events modules/caddyevents/app.go Pub/sub for inter-module events

Apps cooperate at runtime: http provisions before tls so it can register the names it needs certificates for, then tls actually obtains them. pki provides the local CA that tls defaults to for internal-name certificates. events is consumed by both http and tls for hooks like cert renewal notifications.

App lifecycle

graph LR
    A[Config loaded] --> B[Provision apps in dependency order]
    B --> C[Validate each app]
    C --> D[Start apps]
    D --> E[serve traffic]
    E --> F{Reload?}
    F -->|yes| G[Stop new app order]
    F -->|no| H[wait for shutdown]
    G --> B
    H --> I[Cleanup on context cancel]

The app interface itself (caddy.go) is intentionally tiny:

type App interface {
    Start() error
    Stop() error
}

Lifecycle hooks (Provision, Validate, Cleanup) come from the broader module interfaces. Apps almost always implement all of them.

Pages

  • HTTP app — servers, listeners, routes, matchers, handlers, automatic HTTPS
  • TLS app — issuers, loaders, certificate cache, connection policies
  • PKI app — internal CA, intermediates, ACME server
  • Events app — emitting and subscribing to events

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Apps – Caddy wiki | Factory