$ show albertito/chasquid
chasquid is a production-grade SMTP (email) server written in Go, focusing on simplicity, security, and ease of operation. It handles incoming and outgoing email with full support for modern email security standards including STARTTLS, DKIM signing and verification, SPF checking, MTA-STS enforcement, and per-domain security level tracking. The server architecture is modular: the main daemon delegates SMTP protocol handling to the internal/smtpsrv package, manages a persistent email queue via internal/queue, performs alias resolution with hooks via internal/aliases, and delivers mail either locally through an LMTP-based MDA (cmd/mda-lmtp) or remotely via SMTP courier with TLS and MX fallback. Authentication integrates with Dovecot or a local user database using scrypt password hashing. Configuration is defined via protobuf text format, supporting hot reload of domains, users, and aliases without restart. The repository includes CLI tools for administration (chasquid-util), SMTP connectivity checking (smtp-check), and Dovecot authentication testing (dovecot-auth-cli). A comprehensive test suite covers unit, integration, and fuzz tests, with test data for DKIM, SPF, aliases, and various protocol edge cases. The repository also provides a Dockerfile for containerized deployment and extensive documentation in Markdown and man pages. While primarily an application, the codebase contains several well-designed internal packages that could be extracted for reuse, such as the network tracing library, safe I/O utilities, and OpenMetrics exporter.
The LLM identified 3 files worth highlighting for reuse:
Provides a generic event tracing infrastructure with context propagation, latency histograms, and an HTTP debug handler that renders recursive trace trees with HTML templates and CSS. Self-contained, uses only standard library, and can be extracted for any Go service requiring detailed request tracing without external dependencies.
Implements atomic file writes by writing to a temporary file and then renaming, with optional post-write operations such as fsync, chown, and permission setting. Small, well-tested utility that can be reused across projects requiring safe file updates without data corruption.
Exports Go expvar metrics in OpenMetrics text format for Prometheus scraping. Provides typed helpers (Gauge, Counter) and an HTTP handler. Self-contained and lightweight, useful for adding standardized metrics to any Go server.