# saadkhan7336/brandin architecture

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

- Interactive diagram: https://gitdiagram.com/saadkhan7336/brandin
- Repository: https://github.com/saadkhan7336/brandin

## Overview

1. **What this repo is**
   - A React single-page application built with Create React App, centered on a two-sided marketplace for **brands and influencers**.
   - The product spans campaign creation, influencer discovery, collaboration management, chat, notifications, and payments.

2. **Top-level UI structure**
   - `src/pages` contains the route-level screens.
   - `src/components` contains reusable UI and domain widgets.
   - Shared primitives live under `components/common`, while larger layouts and role-specific shells are split into `components/layout`, `components/campaign`, `components/chat`, `components/collaboration`, `components/payment`, etc.

3. **Primary experience split: public vs authenticated**
   - Public marketing and informational pages include landing, features, blog, case studies, help center, contact, privacy policy.
   - Auth pages cover login, registration, forgot/reset password, OTP verification, and OAuth callback.
   - Protected app areas are behind route guards in `src/routes/ProtectedRoute.jsx` and `PublicRoute.jsx`.

4. **Role-based product areas**
   - The app is clearly divided into **brand** and **influencer** flows.
   - Brand-side screens cover dashboards, profile views, influencer search, requests, and campaign management.
   - Influencer-side screens cover requests, profile management, campaign detail, discovery/explore, and collaboration actions.
   - This role split is reinforced in layout components under `components/layout/brand` and `components/layout/influencer`.

5. **Campaign subsystem**
   - Campaign creation and lifecycle management live in `pages/campaign` and `components/campaign`.
   - Supporting UI includes campaign cards, filters, stats, lists, and modals for cancel, delete, and extend-duration actions.
   - The campaign area appears to be the main object that connects discovery, applications, and collaboration.

6. **Collaboration and deliverables subsystem**
   - Collaboration pages manage the execution phase after a campaign/request is accepted.
   - `pages/collaboration` includes overview, tasks, deliverables, detail views, and board/list presentations.
   - Modals like agreement, cancellation summary, and payout confirmation indicate a workflow with contract, task tracking, and settlement steps.

7. **Messaging and realtime activity**
   - Chat is a distinct subsystem with its own layout, message bubble, and forward modal components.
   - `src/context/SocketContext.jsx`, `redux/slices/chatSlice.js`, `presenceSlice.js`, and `notificationSlice.js` imply realtime socket-driven updates for messaging, presence, and alerts.
   - `MessagesPage.jsx` is the route-level entry point for this interaction layer.

8. **Payments and financial workflow**
   - Payment-related UI is isolated under `components/payment` and `pages/payments`.
   - `StripeProvider`, `CheckoutForm`, and `PaymentModal` indicate Stripe-backed checkout/payment handling.
   - The payment area likely supports campaign funding, payouts, or subscription/settings flows rather than generic e-commerce.

9. **Data and state architecture**
   - Global application state is managed with Redux in `src/redux/store.js`.
   - Slices are domain-based: auth, user, profiles, campaigns, chat, collaboration, explore, notifications, presence.
   - This suggests page components fetch/dispatch through feature services and then render from Redux state rather than keeping everything local.

10. **Service boundary and backend integration**
   - All backend interaction is funneled through `src/services`, with separate modules for API wiring, endpoints, campaigns, chat, collaboration, notifications, payments, profiles, activity, and AI.
   - `api.js` and `endpoints.js` act as the shared transport/config layer, while domain services encapsulate feature-specific calls.
   - `aiService.js` and components under `components/ai` suggest AI-assisted campaign/influencer selection as a distinct capability.

11. **Shared application scaffolding**
   - `DashboardLayout`, `Navbar`, `Sidebar`, `LandingNavbar`, `NotificationPanel`, and `ProfileDropdown` provide the app shell and navigation.
   - Common UI utilities such as buttons, modals, banners, cards, loading states, and verification badges are reused across domains to keep the interface consistent.
   - `ErrorBoundary` and `LoadingFallback` show the app is designed to handle route/component failures and async loading states centrally.

12. **Styling and runtime**
   - The frontend uses Tailwind CSS (`tailwind.config.js`) alongside `src/index.css`.
   - It is a browser-delivered React SPA, with `public/index.html` and CRA build/start scripts defining the runtime/deployment model.
   - The architecture is client-heavy: pages orchestrate state and services, while domain components handle presentation and interaction.

Main entry points: [`src/pages/collaboration/CollaborationsPage.jsx`](https://github.com/saadkhan7336/brandin/blob/main/src/pages/collaboration/CollaborationsPage.jsx) (Collaborations), [`src/services/api.js`](https://github.com/saadkhan7336/brandin/blob/main/src/services/api.js) (API client), [`src/redux/store.js`](https://github.com/saadkhan7336/brandin/blob/main/src/redux/store.js) (Store), [`src/routes/AppRoutes.jsx`](https://github.com/saadkhan7336/brandin/blob/main/src/routes/AppRoutes.jsx) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core app"]
  node_src_app_js["App<br/>SPA root<br/>[App.js]"]
  node_src_routes_approutes_jsx["Routes<br/>route map<br/>[AppRoutes.jsx]"]
  node_src_routes_publicroute_jsx["Public gate<br/>route guard<br/>[PublicRoute.jsx]"]
  node_src_routes_protectedroute_jsx["Protected gate<br/>route guard<br/>[ProtectedRoute.jsx]"]
  node_src_components_layout_dashboardlayout_jsx["Dashboard shell<br/>layout"]
end

subgraph group_public["Public access"]
  node_src_pages_landingpage_jsx["Landing<br/>public page<br/>[LandingPage.jsx]"]
  node_src_pages_auth_login_jsx["Login<br/>auth page<br/>[Login.jsx]"]
end

subgraph group_brand["Brand flow"]
  node_src_pages_brand_searchinfluencers_jsx["Search influencers<br/>brand page"]
  node_src_pages_brand_mydrequests_jsx["My requests<br/>brand page<br/>[MyRequests.jsx]"]
  node_src_pages_campaign_createcampaign_jsx["Create campaign<br/>campaign page<br/>[CreateCampaign.jsx]"]
  node_src_pages_campaign_campaignhub_jsx["Campaign hub<br/>campaign page<br/>[CampaignHub.jsx]"]
  node_src_pages_dashboard_branddashboard_jsx["Brand dashboard<br/>[BrandDashboard.jsx]"]
end

subgraph group_influencer["Influencer flow"]
  node_src_pages_dashboard_influencerdashboard_jsx["Influencer dashboard"]
  node_src_pages_influencer_influencerrequests_jsx["Requests<br/>influencer page"]
end

subgraph group_ops["Operations"]
  node_src_pages_collaboration_collaborationspage_jsx["Collaborations<br/>collab page"]
  node_src_pages_collaboration_deliverablespage_jsx["Deliverables<br/>collab page"]
  node_src_pages_messagespage_jsx["Messages<br/>chat page<br/>[MessagesPage.jsx]"]
  node_src_pages_payments_paymentsdashboard_jsx["Payments<br/>finance page"]
  node_src_redux_store_js["Store<br/>[store.js]"]
  node_src_redux_slices_campaignslice_js["Campaign state<br/>redux slice<br/>[campaignSlice.js]"]
  node_src_redux_slices_chatslice_js["Chat state<br/>redux slice<br/>[chatSlice.js]"]
  node_src_context_socketcontext_jsx["Socket context<br/>realtime context<br/>[SocketContext.jsx]"]
  node_src_services_api_js["API client<br/>transport<br/>[api.js]"]
  node_src_services_campaignservice_js["Campaign API<br/>domain service<br/>[campaignService.js]"]
  node_src_services_chatservice_js["Chat API<br/>domain service<br/>[chatService.js]"]
  node_src_services_collaborationservice_js["Collab API<br/>domain service"]
  node_src_services_paymentservice_js["Payment API<br/>domain service<br/>[paymentService.js]"]
end

node_src_app_js -->|"mounts"| node_src_routes_approutes_jsx
node_src_routes_approutes_jsx -->|"public"| node_src_routes_publicroute_jsx
node_src_routes_approutes_jsx -->|"protected"| node_src_routes_protectedroute_jsx
node_src_routes_publicroute_jsx -->|"exposes"| node_src_pages_landingpage_jsx
node_src_routes_publicroute_jsx -->|"exposes"| node_src_pages_auth_login_jsx
node_src_routes_protectedroute_jsx -->|"wraps"| node_src_components_layout_dashboardlayout_jsx
node_src_components_layout_dashboardlayout_jsx -->|"renders"| node_src_pages_dashboard_branddashboard_jsx
node_src_components_layout_dashboardlayout_jsx -->|"renders"| node_src_pages_dashboard_influencerdashboard_jsx
node_src_pages_dashboard_branddashboard_jsx -->|"links"| node_src_pages_brand_searchinfluencers_jsx
node_src_pages_brand_searchinfluencers_jsx -->|"feeds"| node_src_pages_brand_mydrequests_jsx
node_src_pages_brand_searchinfluencers_jsx -->|"starts"| node_src_pages_campaign_createcampaign_jsx
node_src_pages_campaign_createcampaign_jsx -->|"promotes"| node_src_pages_campaign_campaignhub_jsx
node_src_pages_dashboard_influencerdashboard_jsx -->|"links"| node_src_pages_influencer_influencerrequests_jsx
node_src_pages_influencer_influencerrequests_jsx -->|"accepts"| node_src_pages_collaboration_collaborationspage_jsx
node_src_pages_collaboration_collaborationspage_jsx -->|"tracks"| node_src_pages_collaboration_deliverablespage_jsx
node_src_pages_collaboration_collaborationspage_jsx -->|"coordinates"| node_src_pages_messagespage_jsx
node_src_pages_messagespage_jsx -->|"uses"| node_src_context_socketcontext_jsx
node_src_redux_store_js -->|"contains"| node_src_redux_slices_campaignslice_js
node_src_redux_store_js -->|"contains"| node_src_redux_slices_chatslice_js
node_src_redux_store_js -->|"integrates"| node_src_context_socketcontext_jsx
node_src_pages_campaign_campaignhub_jsx -->|"calls"| node_src_services_campaignservice_js
node_src_pages_messagespage_jsx -->|"calls"| node_src_services_chatservice_js
node_src_pages_collaboration_collaborationspage_jsx -->|"calls"| node_src_services_collaborationservice_js
node_src_pages_payments_paymentsdashboard_jsx -->|"calls"| node_src_services_paymentservice_js
node_src_services_campaignservice_js -->|"through"| node_src_services_api_js
node_src_services_chatservice_js -->|"through"| node_src_services_api_js
node_src_services_collaborationservice_js -->|"through"| node_src_services_api_js
node_src_services_paymentservice_js -->|"through"| node_src_services_api_js

click node_src_app_js "https://github.com/saadkhan7336/brandin/blob/main/src/App.js"
click node_src_routes_approutes_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/routes/AppRoutes.jsx"
click node_src_routes_publicroute_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/routes/PublicRoute.jsx"
click node_src_routes_protectedroute_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/routes/ProtectedRoute.jsx"
click node_src_components_layout_dashboardlayout_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/components/layout/DashboardLayout.jsx"
click node_src_pages_landingpage_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/LandingPage.jsx"
click node_src_pages_auth_login_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/auth/Login.jsx"
click node_src_pages_brand_searchinfluencers_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/brand/SearchInfluencers.jsx"
click node_src_pages_brand_mydrequests_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/brand/MyRequests.jsx"
click node_src_pages_campaign_createcampaign_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/campaign/CreateCampaign.jsx"
click node_src_pages_campaign_campaignhub_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/campaign/CampaignHub.jsx"
click node_src_pages_dashboard_branddashboard_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/dashboard/BrandDashboard.jsx"
click node_src_pages_dashboard_influencerdashboard_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/dashboard/InfluencerDashboard.jsx"
click node_src_pages_influencer_influencerrequests_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/influencer/InfluencerRequests.jsx"
click node_src_pages_collaboration_collaborationspage_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/collaboration/CollaborationsPage.jsx"
click node_src_pages_collaboration_deliverablespage_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/collaboration/DeliverablesPage.jsx"
click node_src_pages_messagespage_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/MessagesPage.jsx"
click node_src_pages_payments_paymentsdashboard_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/pages/payments/PaymentsDashboard.jsx"
click node_src_redux_store_js "https://github.com/saadkhan7336/brandin/blob/main/src/redux/store.js"
click node_src_redux_slices_campaignslice_js "https://github.com/saadkhan7336/brandin/blob/main/src/redux/slices/campaignSlice.js"
click node_src_redux_slices_chatslice_js "https://github.com/saadkhan7336/brandin/blob/main/src/redux/slices/chatSlice.js"
click node_src_context_socketcontext_jsx "https://github.com/saadkhan7336/brandin/blob/main/src/context/SocketContext.jsx"
click node_src_services_api_js "https://github.com/saadkhan7336/brandin/blob/main/src/services/api.js"
click node_src_services_campaignservice_js "https://github.com/saadkhan7336/brandin/blob/main/src/services/campaignService.js"
click node_src_services_chatservice_js "https://github.com/saadkhan7336/brandin/blob/main/src/services/chatService.js"
click node_src_services_collaborationservice_js "https://github.com/saadkhan7336/brandin/blob/main/src/services/collaborationService.js"
click node_src_services_paymentservice_js "https://github.com/saadkhan7336/brandin/blob/main/src/services/paymentService.js"

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_src_app_js,node_src_routes_approutes_jsx,node_src_routes_publicroute_jsx,node_src_routes_protectedroute_jsx,node_src_components_layout_dashboardlayout_jsx toneBlue
class node_src_pages_landingpage_jsx,node_src_pages_auth_login_jsx toneAmber
class node_src_pages_brand_searchinfluencers_jsx,node_src_pages_brand_mydrequests_jsx,node_src_pages_campaign_createcampaign_jsx,node_src_pages_campaign_campaignhub_jsx,node_src_pages_dashboard_branddashboard_jsx toneMint
class node_src_pages_dashboard_influencerdashboard_jsx,node_src_pages_influencer_influencerrequests_jsx toneRose
class node_src_pages_collaboration_collaborationspage_jsx,node_src_pages_collaboration_deliverablespage_jsx,node_src_pages_messagespage_jsx,node_src_pages_payments_paymentsdashboard_jsx,node_src_redux_store_js,node_src_redux_slices_campaignslice_js,node_src_redux_slices_chatslice_js,node_src_context_socketcontext_jsx,node_src_services_api_js,node_src_services_campaignservice_js,node_src_services_chatservice_js,node_src_services_collaborationservice_js,node_src_services_paymentservice_js toneIndigo
```

## Components

### Core app

Application bootstrap, routing, and shared shell.

- [App](https://github.com/saadkhan7336/brandin/blob/main/src/App.js): SPA root · Top-level React entry that composes the application shell. · `src/App.js`
- [Routes](https://github.com/saadkhan7336/brandin/blob/main/src/routes/AppRoutes.jsx): route map · Main route registry for public and protected screens. · `src/routes/AppRoutes.jsx`
- [Public gate](https://github.com/saadkhan7336/brandin/blob/main/src/routes/PublicRoute.jsx): route guard · Allows unauthenticated access to public pages. · `src/routes/PublicRoute.jsx`
- [Protected gate](https://github.com/saadkhan7336/brandin/blob/main/src/routes/ProtectedRoute.jsx): route guard · Blocks app areas behind authentication. · `src/routes/ProtectedRoute.jsx`
- [Dashboard shell](https://github.com/saadkhan7336/brandin/blob/main/src/components/layout/DashboardLayout.jsx): layout · Shared authenticated layout with nav, sidebar, and notifications. · `src/components/layout/DashboardLayout.jsx`

### Public access

Marketing and authentication entry points.

- [Landing](https://github.com/saadkhan7336/brandin/blob/main/src/pages/LandingPage.jsx): public page · Marketing homepage and entry point for visitors. · `src/pages/LandingPage.jsx`
- [Login](https://github.com/saadkhan7336/brandin/blob/main/src/pages/auth/Login.jsx): auth page · Authentication entry screen for returning users. · `src/pages/auth/Login.jsx`

### Brand flow

Brand-side dashboards, search, and campaign management.

- [Search influencers](https://github.com/saadkhan7336/brandin/blob/main/src/pages/brand/SearchInfluencers.jsx): brand page · Brand discovery view for finding and filtering creators. · `src/pages/brand/SearchInfluencers.jsx`
- [My requests](https://github.com/saadkhan7336/brandin/blob/main/src/pages/brand/MyRequests.jsx): brand page · Brand request inbox and response management. · `src/pages/brand/MyRequests.jsx`
- [Create campaign](https://github.com/saadkhan7336/brandin/blob/main/src/pages/campaign/CreateCampaign.jsx): campaign page · Campaign creation and setup workflow. · `src/pages/campaign/CreateCampaign.jsx`
- [Campaign hub](https://github.com/saadkhan7336/brandin/blob/main/src/pages/campaign/CampaignHub.jsx): campaign page · Campaign overview and lifecycle management screen. · `src/pages/campaign/CampaignHub.jsx`
- [Brand dashboard](https://github.com/saadkhan7336/brandin/blob/main/src/pages/dashboard/BrandDashboard.jsx): dashboard · Brand-side overview of campaign and marketplace activity. · `src/pages/dashboard/BrandDashboard.jsx`

### Influencer flow

Influencer-side views and request handling.

- [Influencer dashboard](https://github.com/saadkhan7336/brandin/blob/main/src/pages/dashboard/InfluencerDashboard.jsx): dashboard · Influencer-side overview of requests and collaborations. · `src/pages/dashboard/InfluencerDashboard.jsx`
- [Requests](https://github.com/saadkhan7336/brandin/blob/main/src/pages/influencer/InfluencerRequests.jsx): influencer page · Influencer request list and action center. · `src/pages/influencer/InfluencerRequests.jsx`

### Operations

Collaboration, chat, payments, state, and backend integration.

- [Collaborations](https://github.com/saadkhan7336/brandin/blob/main/src/pages/collaboration/CollaborationsPage.jsx): collab page · Entry point for active collaboration workspaces. · `src/pages/collaboration/CollaborationsPage.jsx`
- [Deliverables](https://github.com/saadkhan7336/brandin/blob/main/src/pages/collaboration/DeliverablesPage.jsx): collab page · Deliverable tracking and board/list views. · `src/pages/collaboration/DeliverablesPage.jsx`
- [Messages](https://github.com/saadkhan7336/brandin/blob/main/src/pages/MessagesPage.jsx): chat page · Route-level entry for chat and realtime messaging. · `src/pages/MessagesPage.jsx`
- [Payments](https://github.com/saadkhan7336/brandin/blob/main/src/pages/payments/PaymentsDashboard.jsx): finance page · Payment settings and financial workflow screen. · `src/pages/payments/PaymentsDashboard.jsx`
- [Store](https://github.com/saadkhan7336/brandin/blob/main/src/redux/store.js): redux store · Global application state container. · `src/redux/store.js`
- [Campaign state](https://github.com/saadkhan7336/brandin/blob/main/src/redux/slices/campaignSlice.js): redux slice · Campaign domain state and actions. · `src/redux/slices/campaignSlice.js`
- [Chat state](https://github.com/saadkhan7336/brandin/blob/main/src/redux/slices/chatSlice.js): redux slice · Messaging state and conversation updates. · `src/redux/slices/chatSlice.js`
- [Socket context](https://github.com/saadkhan7336/brandin/blob/main/src/context/SocketContext.jsx): realtime context · Socket-backed realtime connection for chat, presence, and alerts. · `src/context/SocketContext.jsx`
- [API client](https://github.com/saadkhan7336/brandin/blob/main/src/services/api.js): transport · Shared HTTP wiring and backend configuration. · `src/services/api.js`
- [Campaign API](https://github.com/saadkhan7336/brandin/blob/main/src/services/campaignService.js): domain service · Backend calls for campaigns and lifecycle actions. · `src/services/campaignService.js`
- [Chat API](https://github.com/saadkhan7336/brandin/blob/main/src/services/chatService.js): domain service · Backend calls for messaging and chat history. · `src/services/chatService.js`
- [Collab API](https://github.com/saadkhan7336/brandin/blob/main/src/services/collaborationService.js): domain service · Backend calls for collaboration workflows and deliverables. · `src/services/collaborationService.js`
- [Payment API](https://github.com/saadkhan7336/brandin/blob/main/src/services/paymentService.js): domain service · Backend calls for checkout, payouts, and payment settings. · `src/services/paymentService.js`

## Connections

- App → Routes: mounts · App boots the route tree.
- Routes → Public gate: public · Public paths are wrapped by the public route gate.
- Routes → Protected gate: protected · Authenticated paths are wrapped by the protected gate.
- Public gate → Landing: exposes · Public gate serves marketing pages.
- Public gate → Login: exposes · Public gate serves auth entry screens.
- Protected gate → Dashboard shell: wraps · Protected areas share the authenticated dashboard shell.
- Dashboard shell → Brand dashboard: renders · Brand dashboard is a primary dashboard view.
- Dashboard shell → Influencer dashboard: renders · Influencer dashboard is a primary dashboard view.
- Brand dashboard → Search influencers: links · Brand dashboard leads into creator discovery.
- Search influencers → My requests: feeds · Search and discovery connect to request management.
- Search influencers → Create campaign: starts · Discovery can lead into campaign creation.
- Create campaign → Campaign hub: promotes · Created campaigns flow into the campaign hub.
- Influencer dashboard → Requests: links · Influencer dashboard exposes inbound requests.
- Requests → Collaborations: accepts · Accepted requests become active collaborations.
- Collaborations → Deliverables: tracks · Collaborations branch into deliverable execution.
- Collaborations → Messages: coordinates · Collaboration work is supported by chat.
- Messages → Socket context: uses · Messaging relies on realtime socket state.
- Store → Campaign state: contains · Campaign state is part of the global store.
- Store → Chat state: contains · Chat state is part of the global store.
- Store → Socket context: integrates · Store works alongside realtime context updates.
- Campaign hub → Campaign API: calls · Campaign screens use the campaign service layer.
- Messages → Chat API: calls · Chat screen uses the chat service layer.
- Collaborations → Collab API: calls · Collaboration screens use collaboration services.
- Payments → Payment API: calls · Payment screens use the payment service layer.
- Campaign API → API client: through · Domain services use the shared API client.
- Chat API → API client: through · Domain services use the shared API client.
- Collab API → API client: through · Domain services use the shared API client.
- Payment API → API client: through · Domain services use the shared API client.
