Under Development
stars

About NeoMutt’s Architecture#

NeoMutt is a large C codebase that stays intentionally modular. It keeps core utilities in shared libraries, while protocol backends, UI components, and feature areas live in dedicated directories. This separation makes it possible to evolve features (like Notmuch integration or new UI behaviors) without rewriting the whole client.

Codebase Overview#

At a high level, the source tree mirrors the mental model of a terminal MUA:

  • Core utilities and shared infrastructure live in mutt/ and adjacent helpers like muttlib.c.

  • Protocol backends are isolated in imap/, pop/, smtp/, and nntp/.

  • Local mailbox formats live in maildir/, mbox/, and mh/.

  • Message handling and MIME logic live under email/.

  • UI elements and menus are separated into gui/, menu/, pager/, index/, and sidebar/.

  • Feature areas live in their own directories such as notmuch/, ncrypt/, autocrypt/, and compress/.

This organization keeps concerns narrow and makes it easier to replace or extend parts of the stack.

Library Modules#

NeoMutt uses internal libraries to make boundaries explicit:

  • libmutt: shared utilities for strings, files, dates, memory, and other core helpers.

  • libemail: structures and logic for messages, headers, MIME parsing, threading, and tagging.

  • libconn: network connections, TLS, and SASL/auth plumbing.

  • libncrypt: encryption and signing APIs and backend glue.

  • libgui: curses UI, windows, dialogs, and rendering.

Each library exposes a clear surface area and keeps implementation details contained.

The Configuration System#

Configuration is a first-class part of the architecture, not an afterthought. NeoMutt parses config files into typed variables, applies precedence rules, and allows runtime changes via commands. This makes the UI, message handling, and backend behavior all configurable without recompilation. For details, see Configuration File Syntax and Options.

Mailbox Backends#

Mail storage and access are modular. Local formats (mbox, MMDF, MH, Maildir) are handled separately from remote protocols (IMAP, POP3, NNTP). Notmuch integration sits alongside these backends and provides a query-based virtual mailbox model. For how each backend is configured, see Mailbox Formats, IMAP, and Notmuch.

The MIME Parser#

NeoMutt handles MIME as a core competency. The email library parses MIME structures, decodes parts, and hands them to the pager or external handlers. The mailcap system and MIME type mappings are designed to keep rendering flexible and secure. See MIME Types and MIME.

Pattern Matching Engine#

Patterns are the backbone of search, limit, tagging, and many hooks. This shared engine is reused across the UI and configuration system so the same language drives selection, filtering, and automation. See Patterns, Regex, and the Searching Email tutorial.

The GUI and Curses Layer#

NeoMutt is a curses-based UI with a clear separation between data structures and rendering. The index, pager, menus, and sidebar are independent components that share a common window and dialog framework. This modular UI makes it possible to customize layout and behavior without forking the client. For a tour, see Getting Started.

Build System and Dependencies#

The build system wires optional features (crypto, IMAP/SMTP, Notmuch, Lua) based on available libraries. This keeps the binary lean while allowing distributions to enable richer feature sets. Build details are documented in the NeoMutt build guide and source tree.

Source code: https://github.com/neomutt/neomutt