Stalwart Mail Server offers support for two types of database backends: SQLite and FoundationDB. The choice between these two depends primarily on the scale and distribution of your mail server setup.
SQLite is recommended for single node installations, owing to its simplicity and reliability for such setups. SQLite's features make it an ideal choice for environments where the overhead of a large database system may not be necessary. For redundancy, SQLite's data can be replicated using external solutions such as Litestream, which provides continuous replication of SQLite databases.
FoundationDB is recommended for distributed environments, as it is designed for high-scale, fault-tolerant and distributed systems. FoundationDB's capabilities, including its ability to handle large volumes of data across many machines while maintaining consistency and performance, make it a good fit for distributed scenarios.