How passbolt/passbolt_api works
• Clients and User Interfaces:
• Browser Extensions, Mobile apps, Desktop app (when available) and CLI.
• Web-based user interface (the “webroot” directory and templates).
• API/Application Layer:
• The “src/Controller” and “src/Component” layers expose APIs (HTTP endpoints) that the various clients interact with.
• This layer implements authentication controllers (AuthLogin, AuthLogout, AuthVerify, etc.) and various domain-specific controllers (Users, Groups, Resources, Secrets).
• Middleware:
• A set of middlewares (found under “src/Middleware”) that handle cross-cutting concerns: session management, CSRF protection, SSL enforcement, API versioning, and specific security headers (like GpgAuthHeadersMiddleware).
• Business Logic / Services Layer:
• “src/Service” hosts a rich service layer that manages core business logic. For example, separate services to handle authentication tokens, groups, secrets, permissions, resources, password expiry, and the OpenPGP/GPG key processing. There are dedicated services for healthchecks and integration with external systems.
• Plugin Modules:
• The “plugins” directory contains multiple plugins such as JWTAuthentication, Folders, EmailDigest, MultiFactorAuthentication and others. Each can be represented as a distinct module that integrates with the overall application.
• Data Persistence:
• External Infrastructure:
• Integration points with external systems such as an email server (configured via SMTP settings, see “plugins/PassboltCe/SmtpSettings” and “src/Mailer”), as well as connections for healthchecks.
Relationships and Data Flows
• To connect the services layer to the database (for CRUD operations) and to external services such as an email server or third-party integrations.
Architectural Patterns & Design Principles
• Modular Architecture: The project’s design supports extendability via its plugins, meaning that many features (authentication, logging, localization, password expiry, resource sharing) are implemented as attachable modules.
• Layered Architecture: There is a clear separation of concerns between the presentation layer (controllers/views), request processing (middleware), business logic (services) and persistence (model/database).
• Use of Standard Framework Patterns: The project follows conventions typical of CakePHP (such as MVC, use of behaviors on models, and component-based controllers).