# Project overview ## Purpose Mail Safehouse is a self-hosted web application that backs up a Microsoft 365 tenant and restores from those backups. It replaces Veeam Backup for Microsoft 365, with three priorities: 1. **Simple to run**: one compose file, few moving parts, sensible defaults. 2. **Modular**: each workload is a self-contained module that can be enabled, disabled, versioned and tested on its own. 3. **Documented**: every public interface is documented in code, and the docs site is generated from the same repository. ## Scope ### Modules in scope (v1) | Module | Protects | |-------------|---------------------------------------------------------------------------| | `exchange` | User, shared and resource mailboxes: mail, calendar, contacts, tasks | | `onedrive` | OneDrive for Business drives, files, versions (optional), sharing info | | `sharepoint`| Sites, document libraries, lists, pages, site permissions | | `entra` | Users, groups, apps, service principals, Conditional Access, roles, etc. | ### Modules planned for later | Module | Protects | |-------------|---------------------------------------------------------------------------| | `teams` | Teams, channels, settings, membership, tabs, channel messages | Teams is not used in the initial tenant, so it is not part of v1. The module contract is designed with it in mind (see {doc}`modules`). Files in Teams channels live in SharePoint and are already covered by the `sharepoint` module. ### Exports EML (mail), ICS (calendar), VCF (contacts) and original files are in scope from the start. **PST** export is wanted and planned as a follow-up within the Exchange work; see {doc}`modules` (Exchange) for why it is a separate step. ### Out of scope for v1 - Multi-tenant / MSP mode (the data model keeps a `tenant_id` everywhere so this can be added later without a migration of the backup format). - Intune, Planner, Power Platform, Exchange Online transport configuration (candidates for later modules). - Agents installed on Windows hosts. Everything goes through Microsoft Graph. ## Initial deployment profile The first production target is deliberately small, which shapes the defaults: | Aspect | Initial target | |--------------|--------------------------------------------------| | Tenants | One (the owner's own tenant) | | Users | About 10 | | Data | Under 50 GB total | | Storage | Local disk on the Docker host (`filesystem` backend) | | Workers | One worker container is enough | The design still allows more users, S3 storage and more workers later; those paths are built but not tuned or load-tested until they are needed. ## Functional requirements - **FR-1** Enable or disable each module from the UI or config; a disabled module does no discovery and no jobs, but its existing backups stay browsable until retention removes them. - **FR-2** Auto-discover protectable objects (mailboxes, drives, sites, …) and protect them by include/exclude rules (all users, group membership, explicit lists). - **FR-3** Incremental backups using Graph delta queries; a full pass only on first run or when a delta token expires. - **FR-4** Schedules per backup job, with per-job retention. - **FR-5** Point-in-time browse and search of backed-up items. - **FR-6** Restore to original location, to an alternate location (another mailbox/site), or export as a download (EML, later PST, for mail). - **FR-7** Entra ID: show differences between two snapshots, and restore individual objects or properties. - **FR-8** Job history, per-item error reporting, and email notifications to backup admins via Graph or SMTP ({doc}`notifications`). - **FR-9** Audit log of every browse, restore, export and setting change. ## Non-functional requirements - **NFR-1** All components run as containers; the host needs only Docker Engine with the Compose plugin (Ubuntu 26.04 LTS; RHEL 9/10 with Docker CE). Podman is not supported. See {doc}`deployment`. - **NFR-2** Backup data encrypted at rest; optional immutable storage. - **NFR-3** Respects Graph throttling (429/503 `Retry-After`) and scales by adding worker containers. - **NFR-4** 100% of public Python APIs have docstrings (enforced in CI). - **NFR-5** Open source under the Apache License 2.0 ({doc}`../adr/0005-licence`).