# pathangufran/multi-tenant-saas-platform architecture

> Architecture diagram of the GitHub repository pathangufran/multi-tenant-saas-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pathangufran/multi-tenant-saas-platform
- Repository: https://github.com/pathangufran/multi-tenant-saas-platform

## Overview

This repository is a multi-service backend for a tenant-based collaboration and project-management product. Its principal workflow is authenticated users operating within a tenant to manage projects and tasks, with related tags, comments, and attachments; supporting services handle tenant membership and RBAC, notifications and email, exports, and reports. The graph preserves the distinct service and domain stages. Source excerpts show selected service calls and persistence; the README is empty and many views and integration paths were not sampled, so those links are omitted or marked unverified.

Main entry points: [`services/core-service/apps/common/domain_rules.py`](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/common/domain_rules.py) (Tenant integrity rules), [`services/core-service/apps/tasks/models.py`](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/models.py) (Task records), [`services/core-service/apps/tags/services.py`](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tags/services.py) (Tags), [`services/core-service/apps/comments/services.py`](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/comments/services.py) (Comments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and tenancy"]
  node_auth_api["Authentication API<br/>[views.py]"]
  node_auth_service["Authentication service<br/>[services.py]"]
  node_auth_audit["Authentication audit<br/>[audit_service.py]"]
  node_user_store[("User records<br/>[models.py]")]
  node_tenant_api["Tenant API<br/>[views.py]"]
  node_tenant_context["Tenant context resolution<br/>[context_service.py]"]
  node_membership["Membership service"]
  node_tenant_rbac["Tenant RBAC<br/>[rbac_service.py]"]
  node_tenant_store[("Tenant records<br/>[models.py]")]
end

subgraph group_workspace["Workspace management"]
  node_core_api["Workspace API<br/>[views.py]"]
  node_projects["Projects<br/>[services.py]"]
  node_project_store[("Project records<br/>[models.py]")]
  node_tasks["Tasks<br/>[services.py]"]
  node_task_store[("Task records<br/>[models.py]")]
  node_domain_rules["Tenant integrity rules<br/>[domain_rules.py]"]
  node_tags["Tags<br/>[services.py]"]
  node_tag_store[("Tag records<br/>[models.py]")]
  node_comments["Comments<br/>[services.py]"]
  node_comment_store[("Comment records<br/>[models.py]")]
  node_attachments["Attachments<br/>[services.py]"]
  node_attachment_store[("Attachment records<br/>[models.py]")]
end

subgraph group_messaging["Notifications and email"]
  node_notifications["In-app notifications<br/>[services.py]"]
  node_notification_store[("Notification records<br/>[models.py]")]
  node_notification_tasks["Notification tasks<br/>[tasks.py]"]
  node_email_tasks["Email tasks<br/>[tasks.py]"]
  node_email_service["Email delivery<br/>[services.py]"]
  node_email_provider["Email providers<br/>[providers.py]"]
end

subgraph group_outputs["Exports and reporting"]
  node_exports["Export generation<br/>[services.py]"]
  node_export_store[("Export records<br/>[models.py]")]
  node_export_storage["Export file storage<br/>[storage.py]"]
  node_reports["Report generation<br/>[services.py]"]
  node_report_tasks["Report tasks<br/>[tasks.py]"]
end

subgraph group_platform["Shared runtime"]
end

node_client(("User / client"))

node_client -.->|"sends requests"| node_auth_api
node_auth_api -.->|"dispatches to"| node_auth_service
node_auth_service -->|"checks credentials"| node_user_store
node_auth_service -->|"records events"| node_auth_audit
node_client -.->|"sends requests"| node_tenant_api
node_tenant_api -.->|"dispatches to"| node_tenant_context
node_tenant_context -->|"loads tenant"| node_tenant_store
node_tenant_context -->|"checks membership"| node_membership
node_membership -->|"uses tenant models"| node_tenant_store
node_tenant_rbac -->|"uses tenant models"| node_tenant_store
node_client -.->|"sends requests"| node_core_api
node_core_api -.->|"dispatches to"| node_projects
node_core_api -.->|"dispatches to"| node_tasks
node_projects -->|"reads and writes"| node_project_store
node_tasks -->|"validates tenant"| node_domain_rules
node_tasks -->|"reads and writes"| node_task_store
node_domain_rules -->|"checks project"| node_project_store
node_domain_rules -->|"checks task"| node_task_store
node_domain_rules -->|"checks tag"| node_tag_store
node_tags -->|"validates tenant"| node_domain_rules
node_tags -->|"reads and writes"| node_tag_store
node_tags -->|"checks task"| node_task_store
node_comments -->|"validates task"| node_domain_rules
node_comments -->|"checks task"| node_task_store
node_comments -->|"reads and writes"| node_comment_store
node_attachments -->|"validates task"| node_domain_rules
node_attachments -->|"checks task"| node_task_store
node_attachments -->|"uses attachment records"| node_attachment_store
node_notifications -->|"reads and writes"| node_notification_store
node_notification_tasks -->|"invokes service"| node_notifications
node_email_tasks -->|"invokes service"| node_email_service
node_email_service -->|"sends through"| node_email_provider
node_exports -->|"reads and writes"| node_export_store
node_exports -->|"stores files"| node_export_storage
node_report_tasks -->|"invokes service"| node_reports

click node_auth_api "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/views.py"
click node_auth_service "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/services.py"
click node_auth_audit "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/audit_service.py"
click node_user_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/users/models.py"
click node_tenant_api "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/views.py"
click node_tenant_context "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/context_service.py"
click node_membership "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/membership_service.py"
click node_tenant_rbac "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/rbac_service.py"
click node_tenant_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/models.py"
click node_core_api "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/views.py"
click node_projects "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/projects/services.py"
click node_project_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/projects/models.py"
click node_tasks "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/services.py"
click node_task_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/models.py"
click node_domain_rules "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/common/domain_rules.py"
click node_tags "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tags/services.py"
click node_tag_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tags/models.py"
click node_comments "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/comments/services.py"
click node_comment_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/comments/models.py"
click node_attachments "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/attachments/services.py"
click node_attachment_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/attachments/models.py"
click node_notifications "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/services.py"
click node_notification_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/models.py"
click node_notification_tasks "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/tasks.py"
click node_email_tasks "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/tasks.py"
click node_email_service "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/services.py"
click node_email_provider "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/providers.py"
click node_exports "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/services.py"
click node_export_store "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/models.py"
click node_export_storage "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/storage.py"
click node_reports "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/reports/services.py"
click node_report_tasks "https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/reports/tasks.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth_api,node_auth_service,node_auth_audit,node_user_store,node_tenant_api,node_tenant_context,node_membership,node_tenant_rbac,node_tenant_store,node_client toneBlue
class node_core_api,node_projects,node_project_store,node_tasks,node_task_store,node_domain_rules,node_tags,node_tag_store,node_comments,node_comment_store,node_attachments,node_attachment_store toneAmber
class node_notifications,node_notification_store,node_notification_tasks,node_email_tasks,node_email_service,node_email_provider toneMint
class node_exports,node_export_store,node_export_storage,node_reports,node_report_tasks toneRose
```

## Components

### Identity and tenancy

- [Authentication API](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/views.py): `services/auth-service/apps/authentication/views.py`
- [Authentication service](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/services.py): `services/auth-service/apps/authentication/services.py`
- [Authentication audit](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/authentication/audit_service.py): `services/auth-service/apps/authentication/audit_service.py`
- [User records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/auth-service/apps/users/models.py): `services/auth-service/apps/users/models.py`
- [Tenant API](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/views.py): `services/tenant-service/apps/tenants/views.py`
- [Tenant context resolution](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/context_service.py): `services/tenant-service/apps/tenants/context_service.py`
- [Membership service](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/membership_service.py): `services/tenant-service/apps/tenants/membership_service.py`
- [Tenant RBAC](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/rbac_service.py): `services/tenant-service/apps/tenants/rbac_service.py`
- [Tenant records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/tenant-service/apps/tenants/models.py): `services/tenant-service/apps/tenants/models.py`

### Workspace management

- [Workspace API](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/views.py): `services/core-service/apps/tasks/views.py`
- [Projects](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/projects/services.py): `services/core-service/apps/projects/services.py`
- [Project records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/projects/models.py): `services/core-service/apps/projects/models.py`
- [Tasks](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/services.py): `services/core-service/apps/tasks/services.py`
- [Task records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tasks/models.py): `services/core-service/apps/tasks/models.py`
- [Tenant integrity rules](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/common/domain_rules.py): `services/core-service/apps/common/domain_rules.py`
- [Tags](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tags/services.py): `services/core-service/apps/tags/services.py`
- [Tag records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/tags/models.py): `services/core-service/apps/tags/models.py`
- [Comments](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/comments/services.py): `services/core-service/apps/comments/services.py`
- [Comment records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/comments/models.py): `services/core-service/apps/comments/models.py`
- [Attachments](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/attachments/services.py): `services/core-service/apps/attachments/services.py`
- [Attachment records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/core-service/apps/attachments/models.py): `services/core-service/apps/attachments/models.py`

### Notifications and email

- [In-app notifications](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/services.py): `services/notification-service/apps/notifications/services.py`
- [Notification records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/models.py): `services/notification-service/apps/notifications/models.py`
- [Notification tasks](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/notifications/tasks.py): `services/notification-service/apps/notifications/tasks.py`
- [Email tasks](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/tasks.py): `services/notification-service/apps/email_service/tasks.py`
- [Email delivery](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/services.py): `services/notification-service/apps/email_service/services.py`
- [Email providers](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/email_service/providers.py): `services/notification-service/apps/email_service/providers.py`

### Exports and reporting

- [Export generation](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/services.py): `services/notification-service/apps/exports/services.py`
- [Export records](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/models.py): `services/notification-service/apps/exports/models.py`
- [Export file storage](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/exports/storage.py): `services/notification-service/apps/exports/storage.py`
- [Report generation](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/reports/services.py): `services/notification-service/apps/reports/services.py`
- [Report tasks](https://github.com/pathangufran/multi-tenant-saas-platform/blob/main/services/notification-service/apps/reports/tasks.py): `services/notification-service/apps/reports/tasks.py`

### Other components

- **User / client**

## Connections

- User / client → Authentication API: sends requests
- Authentication API → Authentication service: dispatches to
- Authentication service → User records: checks credentials (evidence: `services/auth-service/apps/authentication/services.py`)
- Authentication service → Authentication audit: records events (evidence: `services/auth-service/apps/authentication/services.py`)
- User / client → Tenant API: sends requests
- Tenant API → Tenant context resolution: dispatches to
- Tenant context resolution → Tenant records: loads tenant (evidence: `services/tenant-service/apps/tenants/context_service.py`)
- Tenant context resolution → Membership service: checks membership (evidence: `services/tenant-service/apps/tenants/context_service.py`)
- Membership service → Tenant records: uses tenant models (evidence: `services/tenant-service/apps/tenants/membership_service.py`)
- Tenant RBAC → Tenant records: uses tenant models (evidence: `services/tenant-service/apps/tenants/rbac_service.py`)
- User / client → Workspace API: sends requests
- Workspace API → Projects: dispatches to
- Workspace API → Tasks: dispatches to
- Projects → Project records: reads and writes (evidence: `services/core-service/apps/projects/services.py`)
- Tasks → Tenant integrity rules: validates tenant (evidence: `services/core-service/apps/tasks/services.py`)
- Tasks → Task records: reads and writes (evidence: `services/core-service/apps/tasks/services.py`)
- Tenant integrity rules → Project records: checks project (evidence: `services/core-service/apps/common/domain_rules.py`)
- Tenant integrity rules → Task records: checks task (evidence: `services/core-service/apps/common/domain_rules.py`)
- Tenant integrity rules → Tag records: checks tag (evidence: `services/core-service/apps/common/domain_rules.py`)
- Tags → Tenant integrity rules: validates tenant (evidence: `services/core-service/apps/tags/services.py`)
- Tags → Tag records: reads and writes (evidence: `services/core-service/apps/tags/services.py`)
- Tags → Task records: checks task (evidence: `services/core-service/apps/tags/services.py`)
- Comments → Tenant integrity rules: validates task (evidence: `services/core-service/apps/comments/services.py`)
- Comments → Task records: checks task (evidence: `services/core-service/apps/comments/services.py`)
- Comments → Comment records: reads and writes (evidence: `services/core-service/apps/comments/services.py`)
- Attachments → Tenant integrity rules: validates task (evidence: `services/core-service/apps/attachments/services.py`)
- Attachments → Task records: checks task (evidence: `services/core-service/apps/attachments/services.py`)
- Attachments → Attachment records: uses attachment records (evidence: `services/core-service/apps/attachments/services.py`)
- In-app notifications → Notification records: reads and writes (evidence: `services/notification-service/apps/notifications/services.py`)
- Notification tasks → In-app notifications: invokes service (evidence: `services/notification-service/apps/notifications/tasks.py`)
- Email tasks → Email delivery: invokes service (evidence: `services/notification-service/apps/email_service/tasks.py`)
- Email delivery → Email providers: sends through (evidence: `services/notification-service/apps/email_service/services.py`)
- Export generation → Export records: reads and writes (evidence: `services/notification-service/apps/exports/services.py`)
- Export generation → Export file storage: stores files (evidence: `services/notification-service/apps/exports/services.py`)
- Report tasks → Report generation: invokes service (evidence: `services/notification-service/apps/reports/tasks.py`)
