Module ID Structure
A ModuleID is a dot-separated string frommodules.go:80:
- Namespace: All labels except the last (the scope)
- Name: The last label (the module’s actual name)
Examples
Namespace Methods
Frommodules.go:103:
Standard Namespaces
Apps (Top-Level)
Namespace: Empty (no dots) Apps are top-level modules that Caddy loads and runs. Frommodules/standard/imports.go:3:
HTTP Handlers
Namespace:http.handlers
Middleware that processes HTTP requests:
modules/caddyhttp/tracing/module.go:40:
HTTP Matchers
Namespace:http.matchers
Request matching logic:
TLS Modules
Namespace:tls.*
Storage Backends
Namespace:caddy.storage
Where Caddy stores TLS certificates and other data:
Logging
Namespace:caddy.logging
Events
Namespace:caddy.events
Event handling and subscription:
Config Adapters
Namespace:caddy.config_adapters
Convert other config formats to Caddy JSON:
Network Proxy
Namespace:caddy.network_proxy
Modules must implement ProxyFuncProducer from modules.go:375:
Discovering Modules
Get All Modules in a Namespace
Frommodules.go:204:
Partial scopes are not matched.
"http.handlers" will not match "http.handlers.foo.bar".Get a Specific Module
Frommodules.go:164:
List All Registered Modules
Frommodules.go:244:
Naming Conventions
From the source code and documentation:1
Use lowercase
Module IDs should be lowercase:
2
Use underscores for spaces
Separate words with underscores, not hyphens or camelCase:
3
Choose appropriate namespace
Place your module in the correct namespace:
4
Make names descriptive
The name should clearly indicate what the module does:
Reserved Module IDs
Frommodules.go:144:
Module Map Configuration
Frommodules.go:122:
Creating Custom Namespaces
You can create custom namespaces for your organization:Best Practices
Follow Standard Namespaces
Use established namespaces when your module fits an existing category
Descriptive Names
Make module names self-documenting and clear
Consistent Naming
Follow the lowercase with underscores convention
Avoid Conflicts
Use unique prefixes for custom namespaces
Next Steps
Module Development
Learn how to create modules
Plugin Tutorial
Build a complete plugin