# zahra-ahmd/kindred-fyp architecture

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

- Interactive diagram: https://gitdiagram.com/zahra-ahmd/kindred-fyp
- Repository: https://github.com/zahra-ahmd/kindred-fyp

## Overview

This repository appears to implement a social app centered on MBTI personality and interest-based connections, with a FastAPI service that predicts personality types from user posts. The main backend path fetches posts and predicts types; the client also contains onboarding, posting, discovery, profiles, messaging, and personality-history features. Several app routes were not sampled, so their interactions and persistence details are represented as subsystems without inferred call edges.

Main entry points: [`my-app/lib/supabase.js`](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/lib/supabase.js) (Supabase client), [`my-app/components/RootLayout.jsx`](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/RootLayout.jsx) (App shell), [`backend/app/main.py`](https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/app/main.py) (Prediction API), [`my-app/helpers/personalityHistory.jsx`](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/helpers/personalityHistory.jsx) (Interest-based history)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Mobile app"]
  node_authflows["Sign-in and onboarding"]
  node_app_shell["App shell<br/>[RootLayout.jsx]"]
  node_auth_state["Auth state<br/>[AuthContext.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_user_data["User data service<br/>[userService.js]"]
end

subgraph group_personality["Personality"]
  node_compatibility["MBTI compatibility scores"]
  node_personality_insights["Personality insights"]
  node_personality_history["Interest-based history"]
  node_interest_map["Interest trait mapping<br/>[mapping.js]"]
end

subgraph group_social["Social features"]
  node_post_creation["Create posts<br/>[add_post.jsx]"]
  node_feed["Home feed<br/>[home.jsx]"]
  node_discovery["Explore people<br/>[explore.jsx]"]
  node_recommendations["User recommendations"]
  node_profiles["Profiles"]
  node_messaging["Messages and inbox"]
  node_notifications["Notifications<br/>[notifications.jsx]"]
end

subgraph group_backend["Prediction service"]
  node_backend_api["Prediction API<br/>[main.py]"]
  node_post_fetch["Fetch user posts<br/>[supabase_utils.py]"]
  node_post_processing["Post processing helper<br/>[get_posts.py]"]
  node_mbti_model["MBTI prediction model<br/>[make_prediction.py]"]
end

node_person(("App user"))
node_database[("Supabase")]

node_person -.->|"uses"| node_authflows
node_person -.->|"creates posts"| node_post_creation
node_person -.->|"browses"| node_discovery
node_app_shell -->|"uses"| node_auth_state
node_app_shell -->|"uses"| node_supabase_client
node_app_shell -->|"uses"| node_user_data
node_user_data -->|"queries"| node_supabase_client
node_recommendations -->|"queries and stores"| node_supabase_client
node_recommendations -->|"scores matches"| node_compatibility
node_personality_history -->|"reads and writes"| node_supabase_client
node_personality_history -->|"scores interests"| node_interest_map
node_backend_api -->|"fetches posts"| node_post_fetch
node_backend_api -->|"predicts types"| node_mbti_model
node_post_fetch -.->|"reads posts"| node_database
node_backend_api -.->|"returns predictions"| node_person

click node_authflows "https://github.com/zahra-ahmd/kindred-fyp/tree/main/my-app/app/(auth)"
click node_app_shell "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/RootLayout.jsx"
click node_auth_state "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/contexts/AuthContext.js"
click node_supabase_client "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/lib/supabase.js"
click node_user_data "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/services/userService.js"
click node_post_creation "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/add_post.jsx"
click node_feed "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/home.jsx"
click node_discovery "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/explore.jsx"
click node_recommendations "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/RecommendationsList.jsx"
click node_compatibility "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/utils/mbtiCompatibility.js"
click node_profiles "https://github.com/zahra-ahmd/kindred-fyp/tree/main/my-app/app/profile"
click node_messaging "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/services/messageServices.jsx"
click node_notifications "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/notifications.jsx"
click node_personality_insights "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/PersonalityInsightsSection.jsx"
click node_personality_history "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/helpers/personalityHistory.jsx"
click node_interest_map "https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/helpers/mapping.js"
click node_backend_api "https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/app/main.py"
click node_post_fetch "https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/supabase_utils.py"
click node_post_processing "https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/get_posts.py"
click node_mbti_model "https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/make_prediction.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_authflows,node_app_shell,node_auth_state,node_supabase_client,node_user_data,node_person toneBlue
class node_compatibility,node_personality_insights,node_personality_history,node_interest_map,node_database toneAmber
class node_post_creation,node_feed,node_discovery,node_recommendations,node_profiles,node_messaging,node_notifications toneMint
class node_backend_api,node_post_fetch,node_post_processing,node_mbti_model toneRose
```

## Components

### Mobile app

- [Sign-in and onboarding](https://github.com/zahra-ahmd/kindred-fyp/tree/main/my-app/app/(auth)): `my-app/app/(auth)`
- [App shell](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/RootLayout.jsx): `my-app/components/RootLayout.jsx`
- [Auth state](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/contexts/AuthContext.js): `my-app/contexts/AuthContext.js`
- [Supabase client](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/lib/supabase.js): `my-app/lib/supabase.js`
- [User data service](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/services/userService.js): `my-app/services/userService.js`

### Personality

- [MBTI compatibility scores](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/utils/mbtiCompatibility.js): `my-app/utils/mbtiCompatibility.js`
- [Personality insights](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/PersonalityInsightsSection.jsx): `my-app/components/PersonalityInsightsSection.jsx`
- [Interest-based history](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/helpers/personalityHistory.jsx): `my-app/helpers/personalityHistory.jsx`
- [Interest trait mapping](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/helpers/mapping.js): `my-app/helpers/mapping.js`

### Social features

- [Create posts](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/add_post.jsx): `my-app/app/(tabs)/add_post.jsx`
- [Home feed](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/home.jsx): `my-app/app/(tabs)/home.jsx`
- [Explore people](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/(tabs)/explore.jsx): `my-app/app/(tabs)/explore.jsx`
- [User recommendations](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/components/RecommendationsList.jsx): `my-app/components/RecommendationsList.jsx`
- [Profiles](https://github.com/zahra-ahmd/kindred-fyp/tree/main/my-app/app/profile): `my-app/app/profile`
- [Messages and inbox](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/services/messageServices.jsx): `my-app/services/messageServices.jsx`
- [Notifications](https://github.com/zahra-ahmd/kindred-fyp/blob/main/my-app/app/notifications.jsx): `my-app/app/notifications.jsx`

### Prediction service

- [Prediction API](https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/app/main.py): `backend/app/main.py`
- [Fetch user posts](https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/supabase_utils.py): `backend/files/supabase_utils.py`
- [Post processing helper](https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/get_posts.py): `backend/files/get_posts.py`
- [MBTI prediction model](https://github.com/zahra-ahmd/kindred-fyp/blob/main/backend/files/make_prediction.py): `backend/files/make_prediction.py`

### Other components

- **App user**
- **Supabase**

## Connections

- App user → Sign-in and onboarding: uses
- App user → Create posts: creates posts
- App user → Explore people: browses
- App shell → Auth state: uses (evidence: `my-app/components/RootLayout.jsx`)
- App shell → Supabase client: uses (evidence: `my-app/components/RootLayout.jsx`)
- App shell → User data service: uses (evidence: `my-app/components/RootLayout.jsx`)
- User data service → Supabase client: queries (evidence: `my-app/services/userService.js`)
- User recommendations → Supabase client: queries and stores (evidence: `my-app/components/RecommendationsList.jsx`)
- User recommendations → MBTI compatibility scores: scores matches (evidence: `my-app/components/RecommendationsList.jsx`)
- Interest-based history → Supabase client: reads and writes (evidence: `my-app/helpers/personalityHistory.jsx`)
- Interest-based history → Interest trait mapping: scores interests (evidence: `my-app/helpers/personalityHistory.jsx`)
- Prediction API → Fetch user posts: fetches posts (evidence: `backend/app/main.py`)
- Prediction API → MBTI prediction model: predicts types (evidence: `backend/app/main.py`)
- Fetch user posts → Supabase: reads posts
- Prediction API → App user: returns predictions
