# andrewsherif0/talent-website architecture

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

- Interactive diagram: https://gitdiagram.com/andrewsherif0/talent-website
- Repository: https://github.com/andrewsherif0/talent-website

## Overview

1. **Overall shape**
   - This is a **Next.js App Router** monolith written in **TypeScript**, with a clear split between **public marketplace UX**, **authenticated/auth flows**, and a **separate admin console**.
   - The backend is not a separate service; it is primarily implemented through **Next.js route handlers** under `app/api` plus **Supabase** for persistence, auth, and some admin access patterns.

2. **Top-level route boundaries**
   - `app/(main)` contains the public/product-facing experience.
   - `app/(auth)` contains login and registration screens.
   - `app/(admin)` contains the internal admin area with its own layout and dashboard pages.
   - These route groups are the main diagram boundary lines: they share the same deployment, but have different layouts, navigation, and access expectations.

3. **Public marketplace surface**
   - The main product pages include **home, about, explore, brands, jobs, talent profiles, profile pages, community Q&A, and chat**.
   - The talent profile area is especially rich: it is composed of many sections such as hero, trust, reviews, packages, portfolio, usage rights, booking bar, and sidebar cards, indicating a detailed profile-driven booking/collaboration flow.
   - The jobs, brands, explore, and community pages each have their own local component sets, suggesting they are feature pages rather than generic content pages.

4. **Authenticated user flows**
   - The auth screens are isolated in `app/(auth)` and likely feed into role-aware behavior elsewhere in the app.
   - There are dedicated profile routes for `/profile/me` and `/profile/[username]`, plus API endpoints like `/api/me` and `/api/me/role`, showing that user identity and role are core platform concerns.
   - The chat area is also a first-class authenticated workspace, with a list/detail layout for conversations and message composition.

5. **Admin console**
   - The admin area has its own shell components: `AdminShell`, `AdminSidebar`, `AdminTopbar`, and reusable admin UI primitives like tables, pagination, badges, modals, and loading states.
   - Admin pages cover **dashboard, talents, bookings, brands, reviews, verifications, and settings**.
   - The presence of route handlers for CRUD operations and moderation tasks indicates the admin console is operational, not just read-only reporting.

6. **API layer**
   - The API surface is large and domain-oriented: `app/api/chat`, `app/api/community`, `app/api/jobs`, `app/api/reviews`, `app/api/profile`, `app/api/portfolio`, and `app/api/me`.
   - There is also a `/api/v1` namespace for public/stable endpoints such as **health, talents, bookings, and upload**, which suggests a versioned external API boundary separate from internal app routes.
   - Admin-only endpoints under `app/api/admin` cover maintenance tasks, seeding, debugging, schema checks, migrations, and entity management.

7. **Domain feature modules**
   - The `features/` directory contains reusable domain logic instead of putting everything in route components.
   - Notable modules include `features/admin/services/admin.service.ts`, `features/talent-profile/services/talent-profile.service.ts`, and a talent profile transformer layer.
   - This suggests a separation between **UI components**, **feature-specific business logic**, and **data shaping/normalization**.

8. **Supabase as the system of record**
   - `lib/supabase/client.ts`, `server.ts`, and `admin.ts` show three distinct access modes: browser client, server-side access, and elevated admin access.
   - The `supabase/migrations` folder defines the backend schema evolution, including bookings/reviews, community tables, talent brands, talent status, RLS fixes, and rating triggers.
   - The app depends on Supabase not just for database storage, but also for auth-bound server access patterns and likely media/storage operations such as avatar upload.

9. **Data flow pattern**
   - The dominant flow is: **page/component → route handler or service → Supabase client → database/migrations-backed schema**.
   - Client components under `app/**/_components` handle interactive UI, while server routes in `app/api` encapsulate mutations, admin operations, and data retrieval.
   - Some pages are likely server-rendered shells that compose client components for filtering, tables, chat widgets, and editor interactions.

10. **Chat and community as interactive subsystems**
   - Chat is split into conversation list, message input, message bubbles, and a conversation detail view, implying a real-time or near-real-time messaging workflow.
   - Community has question and answer endpoints plus a dedicated question detail page, representing a Q&A content model with its own CRUD/API layer.
   - These two subsystems are separate but structurally similar: both combine content feeds, detail views, and API-backed interactions.

11. **Operations, migrations, and seed tooling**
   - The repo includes a notable amount of operational tooling: scripts for database checks, fixes, migrations, seeding, and Supabase testing.
   - There are also admin API routes for seeding and migration execution, which means the app supports both local/CLI operations and in-app operational workflows.
   - This is important architecturally: the system is designed to be maintained through schema-first database changes plus repeatable seed/reset flows.

12. **Shared UI and cross-cutting concerns**
   - Shared UI lives in `components/`, including the global navbar/footer and reusable profile/chat/admin widgets.
   - `contexts/SiteContext.tsx` and `hooks/useIsMobile.ts` indicate some client-side global state and responsive behavior.
   - `lib/recalcRating.ts` plus the related migration trigger imply that ratings are a derived business metric maintained consistently across writes and database triggers.

13. **What to show in an architecture diagram**
   - Draw three main front-end zones: **public marketplace**, **auth**, and **admin**.
   - Underneath them, show a **shared API layer** with domain endpoints and a **Supabase-backed persistence layer** with separate client/server/admin access.
   - Add side systems for **migrations/seed scripts**, **uploads**, **chat/community content**, and **admin maintenance routes** as operational and domain-specific supporting flows.

Main entry points: [`app/(main)/layout.tsx`](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/layout.tsx) (Main site), [`app/api`](https://github.com/andrewsherif0/talent-website/tree/main/app/api) (App APIs), [`lib/supabase/client.ts`](https://github.com/andrewsherif0/talent-website/blob/main/lib/supabase/client.ts) (Supabase access), [`app/layout.tsx`](https://github.com/andrewsherif0/talent-website/blob/main/app/layout.tsx) (App shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front_end["Front-end app"]
  node_root_app["App shell<br/>nextjs root<br/>[layout.tsx]"]
  node_main_layout["Main site<br/>route group<br/>[layout.tsx]"]
  node_auth_layout["Auth area<br/>route group<br/>[layout.tsx]"]
  node_home_marketplace["Home<br/>public page<br/>[page.tsx]"]
  node_feature_pages["Browse pages<br/>marketplace features<br/>[page.tsx]"]
  node_talent_profile["Talent profile<br/>profile experience<br/>[page.tsx]"]
  node_profile_area["My profile<br/>account pages<br/>[page.tsx]"]
  node_chat_workspace["Chat<br/>messaging workspace<br/>[page.tsx]"]
  node_community_qa["Community Q&A<br/>discussion feature<br/>[page.tsx]"]
  node_auth_pages["Login / register<br/>auth pages<br/>[page.tsx]"]
  node_feature_services["Feature logic<br/>domain services"]
  node_shared_ui["Shared UI<br/>reusable components<br/>[Navbar.tsx]"]
end

subgraph group_admin["Admin console"]
  node_admin_layout["Admin area<br/>route group<br/>[layout.tsx]"]
  node_admin_shell["Admin shell<br/>admin chrome<br/>[AdminShell.tsx]"]
  node_admin_pages["Admin pages<br/>admin workflows<br/>[page.tsx]"]
end

subgraph group_api["API layer"]
  node_api_router["App APIs<br/>route handlers"]
  node_api_v1["Public API v1<br/>versioned api<br/>[route.ts]"]
  node_api_admin["Admin APIs<br/>ops endpoints<br/>[route.ts]"]
end

subgraph group_infra["Data and ops"]
  node_supabase_access["Supabase access<br/>database clients<br/>[client.ts]"]
  node_schema_ops["Schema ops<br/>migrations and seeds"]
end

node_root_app -->|"routes to"| node_main_layout
node_root_app -->|"routes to"| node_auth_layout
node_root_app -->|"routes to"| node_admin_layout
node_main_layout -->|"hosts"| node_home_marketplace
node_main_layout -->|"hosts"| node_feature_pages
node_main_layout -->|"hosts"| node_talent_profile
node_main_layout -->|"hosts"| node_profile_area
node_main_layout -->|"hosts"| node_chat_workspace
node_main_layout -->|"hosts"| node_community_qa
node_auth_layout -->|"hosts"| node_auth_pages
node_admin_layout -->|"wraps"| node_admin_shell
node_admin_layout -->|"hosts"| node_admin_pages
node_home_marketplace -->|"uses"| node_shared_ui
node_talent_profile -->|"uses"| node_feature_services
node_chat_workspace -->|"reads/writes"| node_api_router
node_community_qa -->|"reads/writes"| node_api_router
node_feature_pages -->|"reads"| node_api_router
node_profile_area -->|"reads/writes"| node_api_router
node_admin_pages -->|"operates through"| node_api_admin
node_api_router -->|"persists via"| node_supabase_access
node_api_v1 -->|"publishes via"| node_supabase_access
node_api_admin -->|"privileged access"| node_supabase_access
node_supabase_access -->|"backed by"| node_schema_ops
node_schema_ops -->|"shapes"| node_feature_services

click node_root_app "https://github.com/andrewsherif0/talent-website/blob/main/app/layout.tsx"
click node_main_layout "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/layout.tsx"
click node_auth_layout "https://github.com/andrewsherif0/talent-website/blob/main/app/(auth)/layout.tsx"
click node_admin_layout "https://github.com/andrewsherif0/talent-website/blob/main/app/(admin)/layout.tsx"
click node_home_marketplace "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/home/page.tsx"
click node_feature_pages "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/explore/page.tsx"
click node_talent_profile "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/talent/[handle]/page.tsx"
click node_profile_area "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/profile/me/page.tsx"
click node_chat_workspace "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/chat/page.tsx"
click node_community_qa "https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/community/page.tsx"
click node_auth_pages "https://github.com/andrewsherif0/talent-website/blob/main/app/(auth)/login/page.tsx"
click node_admin_shell "https://github.com/andrewsherif0/talent-website/blob/main/components/admin/AdminShell.tsx"
click node_admin_pages "https://github.com/andrewsherif0/talent-website/blob/main/app/(admin)/admin/page.tsx"
click node_api_router "https://github.com/andrewsherif0/talent-website/tree/main/app/api"
click node_api_v1 "https://github.com/andrewsherif0/talent-website/blob/main/app/api/v1/health/route.ts"
click node_api_admin "https://github.com/andrewsherif0/talent-website/blob/main/app/api/admin/seed-all/route.ts"
click node_feature_services "https://github.com/andrewsherif0/talent-website/blob/main/features/talent-profile/services/talent-profile.service.ts"
click node_shared_ui "https://github.com/andrewsherif0/talent-website/blob/main/components/Navbar.tsx"
click node_supabase_access "https://github.com/andrewsherif0/talent-website/blob/main/lib/supabase/client.ts"
click node_schema_ops "https://github.com/andrewsherif0/talent-website/blob/main/supabase/migrations/create_bookings_reviews.sql"

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_root_app,node_main_layout,node_auth_layout,node_home_marketplace,node_feature_pages,node_talent_profile,node_profile_area,node_chat_workspace,node_community_qa,node_auth_pages,node_feature_services,node_shared_ui toneBlue
class node_admin_layout,node_admin_shell,node_admin_pages toneAmber
class node_api_router,node_api_v1,node_api_admin toneMint
class node_supabase_access,node_schema_ops toneRose
```

## Components

### Front-end app

Next.js route groups and shared client-facing UI

- [App shell](https://github.com/andrewsherif0/talent-website/blob/main/app/layout.tsx): nextjs root · Global application entry and shared metadata/layout · `app/layout.tsx`
- [Main site](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/layout.tsx): route group · Public marketplace route boundary · `app/(main)/layout.tsx`
- [Auth area](https://github.com/andrewsherif0/talent-website/blob/main/app/(auth)/layout.tsx): route group · Login and registration boundary · `app/(auth)/layout.tsx`
- [Home](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/home/page.tsx): public page · Landing page and featured talent surface · `app/(main)/home/page.tsx`
- [Browse pages](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/explore/page.tsx): marketplace features · About, explore, brands, and jobs experience pages · `app/(main)/explore/page.tsx`
- [Talent profile](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/talent/[handle]/page.tsx): profile experience · Rich profile page with booking, packages, reviews, portfolio, and trust sections · `app/(main)/talent/[handle]/page.tsx`
- [My profile](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/profile/me/page.tsx): account pages · Self profile and public username profile routes · `app/(main)/profile/me/page.tsx`
- [Chat](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/chat/page.tsx): messaging workspace · Conversation list, detail view, and message composition · `app/(main)/chat/page.tsx`
- [Community Q&A](https://github.com/andrewsherif0/talent-website/blob/main/app/(main)/community/page.tsx): discussion feature · Question feed and question detail pages · `app/(main)/community/page.tsx`
- [Login / register](https://github.com/andrewsherif0/talent-website/blob/main/app/(auth)/login/page.tsx): auth pages · Authentication entry screens · `app/(auth)/login/page.tsx`
- [Feature logic](https://github.com/andrewsherif0/talent-website/blob/main/features/talent-profile/services/talent-profile.service.ts): domain services · Admin and talent-profile services plus transformers · `features/talent-profile/services/talent-profile.service.ts`
- [Shared UI](https://github.com/andrewsherif0/talent-website/blob/main/components/Navbar.tsx): reusable components · Navbar, footer, profile widgets, chat widget, and admin primitives · `components/Navbar.tsx`

### Admin console

Internal management surface and admin UI

- [Admin area](https://github.com/andrewsherif0/talent-website/blob/main/app/(admin)/layout.tsx): route group · Internal admin route boundary · `app/(admin)/layout.tsx`
- [Admin shell](https://github.com/andrewsherif0/talent-website/blob/main/components/admin/AdminShell.tsx): admin chrome · Shared admin navigation and layout primitives · `components/admin/AdminShell.tsx`
- [Admin pages](https://github.com/andrewsherif0/talent-website/blob/main/app/(admin)/admin/page.tsx): admin workflows · Dashboard, talents, bookings, brands, reviews, verifications, and settings · `app/(admin)/admin/page.tsx`

### API layer

Route handlers for domain data, auth, and versioned endpoints

- [App APIs](https://github.com/andrewsherif0/talent-website/tree/main/app/api): route handlers · Domain APIs for chat, community, jobs, profiles, reviews, and me · `app/api`
- [Public API v1](https://github.com/andrewsherif0/talent-website/blob/main/app/api/v1/health/route.ts): versioned api · Stable external endpoints for health, talents, bookings, and upload · `app/api/v1/health/route.ts`
- [Admin APIs](https://github.com/andrewsherif0/talent-website/blob/main/app/api/admin/seed-all/route.ts): ops endpoints · Maintenance, seeding, migration, debugging, and admin CRUD routes · `app/api/admin/seed-all/route.ts`

### Data and ops

Supabase access plus schema, migration, and seed tooling

- [Supabase access](https://github.com/andrewsherif0/talent-website/blob/main/lib/supabase/client.ts): database clients · Browser, server, and admin Supabase clients · `lib/supabase/client.ts`
- [Schema ops](https://github.com/andrewsherif0/talent-website/blob/main/supabase/migrations/create_bookings_reviews.sql): migrations and seeds · Database migrations, triggers, and seed scripts · `supabase/migrations/create_bookings_reviews.sql`

## Connections

- App shell → Main site: routes to · Global app shell composes the public route group
- App shell → Auth area: routes to · Global app shell composes the auth route group
- App shell → Admin area: routes to · Global app shell composes the admin route group
- Main site → Home: hosts · Public landing and featured content pages
- Main site → Browse pages: hosts · About, explore, brands, and jobs pages
- Main site → Talent profile: hosts · Deep talent collaboration and booking profile
- Main site → My profile: hosts · Self and public profile routes
- Main site → Chat: hosts · Authenticated messaging workspace
- Main site → Community Q&A: hosts · Question feed and detail views
- Auth area → Login / register: hosts · Login and registration screens
- Admin area → Admin shell: wraps · Admin area uses dedicated shell and navigation
- Admin area → Admin pages: hosts · Administrative operational pages
- Home → Shared UI: uses · Public pages compose shared chrome and widgets
- Talent profile → Feature logic: uses · Profile rendering and shaping logic
- Chat → App APIs: reads/writes · Conversation and message operations
- Community Q&A → App APIs: reads/writes · Questions and answers CRUD
- Browse pages → App APIs: reads · Marketplace listings and filters
- My profile → App APIs: reads/writes · Profile and role-aware user data
- Admin pages → Admin APIs: operates through · Admin CRUD and moderation workflows
- App APIs → Supabase access: persists via · Application data access through Supabase clients
- Public API v1 → Supabase access: publishes via · Versioned external endpoints backed by Supabase
- Admin APIs → Supabase access: privileged access · Elevated admin operations against the database
- Supabase access → Schema ops: backed by · Clients rely on migrations, triggers, and seeded schema
- Schema ops → Feature logic: shapes · Schema and derived rating logic inform feature services
