# hisham-sayed/mafqood architecture

> Architecture diagram of the GitHub repository hisham-sayed/mafqood, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hisham-sayed/mafqood
- Repository: https://github.com/hisham-sayed/mafqood
- Video tour (about a minute): https://gitdiagram.com/hisham-sayed/mafqood/video

## Overview

Mafqood is a missing-person and community-support backend. Its central workflow is to receive lost/found reports, exchange posts with an AI matching service, save returned matches, and notify both post owners. The tree also shows community-feed interactions, direct messaging, family location sharing, authentication, administration, and notification delivery. Sampled handlers confirm parts of the match-notification, family-access, and chat flows; other branches are represented from the tree, so their internal wiring is not inferred.

Main entry points: [`Mafqood/Features/AIIntegrationManagement/ReceiveMatchResults/ReceiveMatchResultsHandler.cs`](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/AIIntegrationManagement/ReceiveMatchResults/ReceiveMatchResultsHandler.cs) (Match results), [`Mafqood/Features/FamilyCareManagement/Child/ReviewFamilyAccess/ReviewFamilyAccessHandler.cs`](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/FamilyCareManagement/Child/ReviewFamilyAccess/ReviewFamilyAccessHandler.cs) (Family access and location), [`Mafqood/Features/ChatMessagesManagement/SendMessage/SendMessageHandler.cs`](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/ChatMessagesManagement/SendMessage/SendMessageHandler.cs) (Chat messaging), [`Mafqood/Common/Notifications/NotificationService.cs`](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/NotificationService.cs) (Notification service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity and administration"]
  node_auth["Authentication"]
  node_admin["Admin tools"]
end

subgraph group_reports["Reports and matching"]
  node_posts["Lost/found posts<br/>[Post.cs]"]
  node_ai["AI matching<br/>[AiModelService.cs]"]
  node_ai_sync["Post sync job<br/>[AiPostSyncJob.cs]"]
  node_match_results["Match results"]
  node_match_store[("Match records<br/>[AiMatchResult.cs]")]
end

subgraph group_community["Community and chat"]
  node_feed["Feed ranking"]
  node_interactions["Post interactions"]
  node_chat["Chat messaging"]
  node_chat_store[("Chat records<br/>[ChatMessage.cs]")]
end

subgraph group_family["Family care"]
  node_family["Family access and location"]
  node_family_store[("Family records<br/>[FamilyMember.cs]")]
  node_location_filter["Location filtering"]
end

subgraph group_delivery["Notification delivery"]
  node_notification_service["Notification service"]
  node_dispatcher["Channel dispatcher"]
  node_notification_store[("Notification records<br/>[Notification.cs]")]
  node_event_handlers["Notification events"]
  node_realtime["Realtime delivery"]
  node_push["Push delivery"]
end

node_person(("App user"))
node_ai_service{{"External AI service"}}
node_fcm{{"Firebase Cloud Messaging"}}
node_signalr(("Connected clients"))

node_person -->|"authenticates"| node_auth
node_person -->|"reports"| node_posts
node_posts -.->|"syncs posts"| node_ai_sync
node_ai_sync -.->|"submits posts"| node_ai_service
node_ai_service -->|"returns matches"| node_match_results
node_match_results -->|"reads posts"| node_posts
node_match_results -->|"writes matches"| node_match_store
node_match_results -->|"publishes events"| node_event_handlers
node_person -->|"browses feed"| node_feed
node_person -->|"interacts"| node_interactions
node_person -->|"sends messages"| node_chat
node_chat -->|"writes messages"| node_chat_store
node_chat -->|"sends realtime updates"| node_signalr
node_person -->|"manages family access"| node_family
node_family -->|"updates membership"| node_family_store
node_family -.->|"filters locations"| node_location_filter
node_family -->|"publishes review event"| node_event_handlers
node_event_handlers -.->|"creates notifications"| node_notification_service
node_notification_service -->|"persists notification"| node_notification_store
node_notification_service -->|"dispatches notification"| node_dispatcher
node_dispatcher -->|"routes realtime"| node_realtime
node_dispatcher -->|"routes push"| node_push
node_realtime -->|"delivers events"| node_signalr
node_push -->|"sends push"| node_fcm
node_person -.->|"administers"| node_admin

click node_auth "https://github.com/hisham-sayed/mafqood/tree/master/Mafqood/Features/AuthenticationManagement"
click node_admin "https://github.com/hisham-sayed/mafqood/tree/master/Mafqood/Features/AdminManagement"
click node_posts "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Posts/Post.cs"
click node_ai "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/AiIntegration/AiModelService.cs"
click node_ai_sync "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/AIIntegrationManagement/Jobs/AiPostSyncJob.cs"
click node_match_results "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/AIIntegrationManagement/ReceiveMatchResults/ReceiveMatchResultsHandler.cs"
click node_match_store "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Posts/AiMatchResult.cs"
click node_feed "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/FeedManagement/Scoring/PostScoringService.cs"
click node_interactions "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/PostInteractionsManagement/AddComment/AddCommentHandler.cs"
click node_chat "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/ChatMessagesManagement/SendMessage/SendMessageHandler.cs"
click node_chat_store "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Chat/ChatMessage.cs"
click node_family "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/FamilyCareManagement/Child/ReviewFamilyAccess/ReviewFamilyAccessHandler.cs"
click node_family_store "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/FamilyCare/FamilyMember.cs"
click node_location_filter "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Location/LocationFilterService.cs"
click node_notification_service "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/NotificationService.cs"
click node_dispatcher "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/NotificationDispatcher.cs"
click node_notification_store "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Notifications/Notification.cs"
click node_event_handlers "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/EventHandlers/AiMatchResultEventHandler.cs"
click node_realtime "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/RealtimeDeliveryChannel.cs"
click node_push "https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/PushDeliveryChannel.cs"

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,node_admin,node_person,node_signalr toneBlue
class node_posts,node_ai,node_ai_sync,node_match_results,node_match_store toneAmber
class node_feed,node_interactions,node_chat,node_chat_store toneMint
class node_family,node_family_store,node_location_filter toneRose
class node_notification_service,node_dispatcher,node_notification_store,node_event_handlers,node_realtime,node_push,node_ai_service,node_fcm toneIndigo
```

## Components

### Identity and administration

- [Authentication](https://github.com/hisham-sayed/mafqood/tree/master/Mafqood/Features/AuthenticationManagement): `Mafqood/Features/AuthenticationManagement`
- [Admin tools](https://github.com/hisham-sayed/mafqood/tree/master/Mafqood/Features/AdminManagement): `Mafqood/Features/AdminManagement`

### Reports and matching

- [Lost/found posts](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Posts/Post.cs): `Mafqood/Entities/Posts/Post.cs`
- [AI matching](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/AiIntegration/AiModelService.cs): `Mafqood/Common/AiIntegration/AiModelService.cs`
- [Post sync job](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/AIIntegrationManagement/Jobs/AiPostSyncJob.cs): `Mafqood/Features/AIIntegrationManagement/Jobs/AiPostSyncJob.cs`
- [Match results](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/AIIntegrationManagement/ReceiveMatchResults/ReceiveMatchResultsHandler.cs): `Mafqood/Features/AIIntegrationManagement/ReceiveMatchResults/ReceiveMatchResultsHandler.cs`
- [Match records](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Posts/AiMatchResult.cs): `Mafqood/Entities/Posts/AiMatchResult.cs`

### Community and chat

- [Feed ranking](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/FeedManagement/Scoring/PostScoringService.cs): `Mafqood/Features/FeedManagement/Scoring/PostScoringService.cs`
- [Post interactions](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/PostInteractionsManagement/AddComment/AddCommentHandler.cs): `Mafqood/Features/PostInteractionsManagement/AddComment/AddCommentHandler.cs`
- [Chat messaging](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/ChatMessagesManagement/SendMessage/SendMessageHandler.cs): `Mafqood/Features/ChatMessagesManagement/SendMessage/SendMessageHandler.cs`
- [Chat records](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Chat/ChatMessage.cs): `Mafqood/Entities/Chat/ChatMessage.cs`

### Family care

- [Family access and location](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Features/FamilyCareManagement/Child/ReviewFamilyAccess/ReviewFamilyAccessHandler.cs): `Mafqood/Features/FamilyCareManagement/Child/ReviewFamilyAccess/ReviewFamilyAccessHandler.cs`
- [Family records](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/FamilyCare/FamilyMember.cs): `Mafqood/Entities/FamilyCare/FamilyMember.cs`
- [Location filtering](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Location/LocationFilterService.cs): `Mafqood/Common/Location/LocationFilterService.cs`

### Notification delivery

- [Notification service](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/NotificationService.cs): `Mafqood/Common/Notifications/NotificationService.cs`
- [Channel dispatcher](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/NotificationDispatcher.cs): `Mafqood/Common/Notifications/Dispatching/NotificationDispatcher.cs`
- [Notification records](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Entities/Notifications/Notification.cs): `Mafqood/Entities/Notifications/Notification.cs`
- [Notification events](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/EventHandlers/AiMatchResultEventHandler.cs): `Mafqood/Common/Notifications/EventHandlers/AiMatchResultEventHandler.cs`
- [Realtime delivery](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/RealtimeDeliveryChannel.cs): `Mafqood/Common/Notifications/Dispatching/RealtimeDeliveryChannel.cs`
- [Push delivery](https://github.com/hisham-sayed/mafqood/blob/master/Mafqood/Common/Notifications/Dispatching/PushDeliveryChannel.cs): `Mafqood/Common/Notifications/Dispatching/PushDeliveryChannel.cs`

### Other components

- **App user**
- **External AI service**
- **Firebase Cloud Messaging**
- **Connected clients**

## Connections

- App user → Authentication: authenticates
- App user → Lost/found posts: reports
- Lost/found posts → Post sync job: syncs posts
- Post sync job → External AI service: submits posts
- External AI service → Match results: returns matches
- Match results → Lost/found posts: reads posts
- Match results → Match records: writes matches
- Match results → Notification events: publishes events
- App user → Feed ranking: browses feed
- App user → Post interactions: interacts
- App user → Chat messaging: sends messages
- Chat messaging → Chat records: writes messages
- Chat messaging → Connected clients: sends realtime updates
- App user → Family access and location: manages family access
- Family access and location → Family records: updates membership
- Family access and location → Location filtering: filters locations
- Family access and location → Notification events: publishes review event
- Notification events → Notification service: creates notifications
- Notification service → Notification records: persists notification
- Notification service → Channel dispatcher: dispatches notification
- Channel dispatcher → Realtime delivery: routes realtime
- Channel dispatcher → Push delivery: routes push
- Realtime delivery → Connected clients: delivers events
- Push delivery → Firebase Cloud Messaging: sends push
- App user → Admin tools: administers
