# prime-02/linkedin-clone architecture

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

- Interactive diagram: https://gitdiagram.com/prime-02/linkedin-clone
- Repository: https://github.com/prime-02/linkedin-clone

## Overview

#### Purpose and Runtime

This is a frontend-only LinkedIn-style social/professional network built with Next.js App Router, React, TypeScript, Tailwind CSS, and Zustand. It has no backend, database, API integration, authentication provider, or persistence: all interactions mutate in-memory client state and reset on refresh.

Primary application shell and global styles are defined in `app/layout.tsx`, `app/globals.css`, and `app/(main)/layout.tsx`.

#### Route Entry Points

The root route likely directs users into the sign-in flow via `app/page.tsx`; `app/login/page.tsx` accepts arbitrary credentials. Auth state is managed locally in `store/useAuthStore.ts`.

Authenticated/main-area routes are organized under the `(main)` route group:
- Feed: `app/(main)/feed/page.tsx`
- Network: `app/(main)/network/page.tsx`
- Messaging: `app/(main)/messaging/page.tsx`
- Jobs: `app/(main)/jobs/page.tsx`
- Notifications: `app/(main)/notifications/page.tsx`
- Dynamic member profile: `app/(main)/profile/[id]/page.tsx`

#### Main-Shell Composition

`app/(main)/layout.tsx` provides the shared logged-in experience, composed from navigation and rail components:
- `components/layout/Navbar.tsx`
- `components/layout/Sidebar.tsx`
- `components/layout/RightRail.tsx`

This is the main visual/control boundary: feature pages render within a persistent professional-network layout, while login is outside it.

#### Feed Lifecycle

The feed renders mock posts, supports post creation, six reaction types, comments, and incremental loading. Its central state boundary is `store/useFeedStore.ts`, initialized from `data/posts.ts` and shaped by `types/index.ts`.

Feature composition is centered on:
- `components/feed/CreatePostBox.tsx`
- `components/feed/PostCard.tsx`
- `components/feed/CommentSection.tsx`

User actions update Zustand state directly; there is no request, server validation, or durable write path.

#### Social Graph and Profiles

Profiles are dynamic routes keyed by user ID, reading from the shared user dataset in `data/users.ts`. Profile presentation is decomposed into domain sections rather than a single document:
- `components/profile/ProfileHeader.tsx`
- `components/profile/ExperienceSection.tsx`
- `components/profile/SkillsSection.tsx`

Network workflows—invitation acceptance/ignore, suggested-person connections, and connection search—are maintained in `store/useNetworkStore.ts`, using `data/connections.ts` and components such as `components/network/InvitationCard.tsx` and `components/network/PeopleYouMayKnow.tsx`.

#### Messaging, Jobs, and Notifications

Messaging uses conversation/thread mock data from `data/messages.ts` and state from `store/useMessagesStore.ts`. `components/messaging/ConversationList.tsx` selects context, while `components/messaging/ChatWindow.tsx` performs optimistic local message insertion.

Jobs are a mostly page-local browsing flow over `data/jobs.ts`, with filtering and details represented by `components/jobs/JobFilters.tsx` and `components/jobs/JobDetailsPanel.tsx`; applying produces a mock success outcome only.

Notifications are sourced from `data/notifications.ts` and managed by `store/useNotificationsStore.ts`. `components/notifications/NotificationItem.tsx` renders grouped/read-state items, and state changes drive notification badge counts in shared navigation.

#### Shared Model and UI Boundaries

`types/index.ts` is the common contract across mock datasets, stores, routes, and feature components. `data/*.ts` files are the initial-state source of truth; Zustand stores are the mutable runtime source of truth.

Reusable interface primitives—including avatar, modal, dropdown, button, and tooltip—are concentrated in `components/shared/Avatar.tsx`, `components/shared/Modal.tsx`, and `components/shared/Button.tsx`. They standardize interaction and presentation without introducing a separate design-system runtime.

Main entry points: [`app/(main)/layout.tsx`](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/layout.tsx) (Main layout), [`types/index.ts`](https://github.com/prime-02/linkedin-clone/blob/master/types/index.ts) (Shared models), [`components/feed/PostCard.tsx`](https://github.com/prime-02/linkedin-clone/blob/master/components/feed/PostCard.tsx) (Post interaction UI), [`app/(main)/profile/[id]/page.tsx`](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/profile/%5Bid%5D/page.tsx) (Member profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry &amp; Shell"]
  node_root["Root entry<br/>route<br/>[page.tsx]"]
  node_login["Login<br/>route<br/>[page.tsx]"]
  node_main_layout["Main layout<br/>route layout<br/>[layout.tsx]"]
  node_navbar["Navbar<br/>layout component<br/>[Navbar.tsx]"]
  node_rails["Side rails<br/>layout components"]
end

subgraph group_social["Social Features"]
  node_feed_route["Feed<br/>route<br/>[page.tsx]"]
  node_feed_ui["Post interaction UI<br/>feature components<br/>[PostCard.tsx]"]
  node_profiles["Member profiles<br/>dynamic route<br/>[page.tsx]"]
  node_profile_ui["Profile sections<br/>feature components<br/>[ProfileHeader.tsx]"]
  node_network["Network<br/>route<br/>[page.tsx]"]
end

subgraph group_workspace["Workspace Features"]
  node_messaging["Messaging<br/>route and UI<br/>[page.tsx]"]
  node_jobs["Jobs<br/>route and UI<br/>[page.tsx]"]
  node_notifications["Notifications<br/>route and UI<br/>[page.tsx]"]
end

subgraph group_foundation["Client Foundation"]
  node_auth[("Auth state<br/>Zustand store<br/>[useAuthStore.ts]")]
  node_feed_store[("Feed state<br/>Zustand store<br/>[useFeedStore.ts]")]
  node_posts["Post seed data<br/>mock data<br/>[posts.ts]"]
  node_users["User data<br/>mock data<br/>[users.ts]"]
  node_network_store[("Network state<br/>Zustand store<br/>[useNetworkStore.ts]")]
  node_connections["Connection data<br/>mock data<br/>[connections.ts]"]
  node_messages_store[("Message state<br/>Zustand store")]
  node_messages["Message data<br/>mock data<br/>[messages.ts]"]
  node_notifications_store[("Notification state<br/>Zustand store")]
  node_models["Shared models<br/>TypeScript contracts<br/>[index.ts]"]
  node_shared_ui["Shared UI primitives<br/>reusable components<br/>[Button.tsx]"]
end

node_root -->|"directs to"| node_login
node_login -->|"updates"| node_auth
node_auth -->|"enables"| node_main_layout
node_main_layout -->|"composes"| node_navbar
node_main_layout -->|"composes"| node_rails
node_main_layout -->|"renders"| node_feed_route
node_main_layout -->|"renders"| node_profiles
node_main_layout -->|"renders"| node_network
node_main_layout -->|"renders"| node_messaging
node_main_layout -->|"renders"| node_jobs
node_main_layout -->|"renders"| node_notifications
node_feed_route -->|"composes"| node_feed_ui
node_feed_ui -->|"reads and mutates"| node_feed_store
node_posts -->|"initializes"| node_feed_store
node_profiles -->|"composes"| node_profile_ui
node_users -->|"supplies user by ID"| node_profiles
node_network -->|"reads and mutates"| node_network_store
node_connections -->|"initializes"| node_network_store
node_messaging -->|"reads and mutates"| node_messages_store
node_messages -->|"initializes"| node_messages_store
node_notifications -->|"reads and mutates"| node_notifications_store
node_notifications_store -->|"updates badge count"| node_navbar
node_models -.->|"types"| node_feed_store
node_models -.->|"types"| node_network_store
node_models -.->|"types"| node_messages_store
node_shared_ui -.->|"standardizes interactions"| node_feed_ui
node_shared_ui -.->|"standardizes presentation"| node_profile_ui

click node_root "https://github.com/prime-02/linkedin-clone/blob/master/app/page.tsx"
click node_login "https://github.com/prime-02/linkedin-clone/blob/master/app/login/page.tsx"
click node_auth "https://github.com/prime-02/linkedin-clone/blob/master/store/useAuthStore.ts"
click node_main_layout "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/layout.tsx"
click node_navbar "https://github.com/prime-02/linkedin-clone/blob/master/components/layout/Navbar.tsx"
click node_feed_route "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/feed/page.tsx"
click node_feed_ui "https://github.com/prime-02/linkedin-clone/blob/master/components/feed/PostCard.tsx"
click node_feed_store "https://github.com/prime-02/linkedin-clone/blob/master/store/useFeedStore.ts"
click node_posts "https://github.com/prime-02/linkedin-clone/blob/master/data/posts.ts"
click node_profiles "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/profile/%5Bid%5D/page.tsx"
click node_profile_ui "https://github.com/prime-02/linkedin-clone/blob/master/components/profile/ProfileHeader.tsx"
click node_users "https://github.com/prime-02/linkedin-clone/blob/master/data/users.ts"
click node_network "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/network/page.tsx"
click node_network_store "https://github.com/prime-02/linkedin-clone/blob/master/store/useNetworkStore.ts"
click node_connections "https://github.com/prime-02/linkedin-clone/blob/master/data/connections.ts"
click node_messaging "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/messaging/page.tsx"
click node_messages_store "https://github.com/prime-02/linkedin-clone/blob/master/store/useMessagesStore.ts"
click node_messages "https://github.com/prime-02/linkedin-clone/blob/master/data/messages.ts"
click node_jobs "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/jobs/page.tsx"
click node_notifications "https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/notifications/page.tsx"
click node_notifications_store "https://github.com/prime-02/linkedin-clone/blob/master/store/useNotificationsStore.ts"
click node_models "https://github.com/prime-02/linkedin-clone/blob/master/types/index.ts"
click node_shared_ui "https://github.com/prime-02/linkedin-clone/blob/master/components/shared/Button.tsx"

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,node_login,node_main_layout,node_navbar,node_rails toneBlue
class node_feed_route,node_feed_ui,node_profiles,node_profile_ui,node_network toneAmber
class node_messaging,node_jobs,node_notifications toneMint
class node_auth,node_feed_store,node_posts,node_users,node_network_store,node_connections,node_messages_store,node_messages,node_notifications_store,node_models,node_shared_ui toneRose
```

## Components

### Entry & Shell

Public sign-in and persistent authenticated layout.

- [Root entry](https://github.com/prime-02/linkedin-clone/blob/master/app/page.tsx): route · Directs users into the sign-in flow. · `app/page.tsx`
- [Login](https://github.com/prime-02/linkedin-clone/blob/master/app/login/page.tsx): route · Accepts arbitrary credentials locally. · `app/login/page.tsx`
- [Main layout](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/layout.tsx): route layout · Persistent logged-in visual and control boundary. · `app/(main)/layout.tsx`
- [Navbar](https://github.com/prime-02/linkedin-clone/blob/master/components/layout/Navbar.tsx): layout component · Shared navigation and notification badge surface. · `components/layout/Navbar.tsx`
- **Side rails**: layout components · Persistent sidebar and right-rail content.

### Social Features

Feed, profiles, and network interactions.

- [Feed](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/feed/page.tsx): route · Renders the post lifecycle. · `app/(main)/feed/page.tsx`
- [Post interaction UI](https://github.com/prime-02/linkedin-clone/blob/master/components/feed/PostCard.tsx): feature components · Creation, cards, reactions, comments, and incremental loading. · `components/feed/PostCard.tsx`
- [Member profiles](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/profile/%5Bid%5D/page.tsx): dynamic route · User-ID profile pages. · `app/(main)/profile/[id]/page.tsx`
- [Profile sections](https://github.com/prime-02/linkedin-clone/blob/master/components/profile/ProfileHeader.tsx): feature components · Header, experience, and skills presentation. · `components/profile/ProfileHeader.tsx`
- [Network](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/network/page.tsx): route · Invitations, suggestions, connections, and search. · `app/(main)/network/page.tsx`

### Workspace Features

Messaging, jobs, and notifications.

- [Messaging](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/messaging/page.tsx): route and UI · Conversation selection and optimistic local message insertion. · `app/(main)/messaging/page.tsx`
- [Jobs](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/jobs/page.tsx): route and UI · Local filtering, details, and mock application outcome. · `app/(main)/jobs/page.tsx`
- [Notifications](https://github.com/prime-02/linkedin-clone/blob/master/app/(main)/notifications/page.tsx): route and UI · Grouped notification and read-state display. · `app/(main)/notifications/page.tsx`

### Client Foundation

Shared in-memory state, models, and UI primitives.

- [Auth state](https://github.com/prime-02/linkedin-clone/blob/master/store/useAuthStore.ts): Zustand store · Local authenticated-state boundary. · `store/useAuthStore.ts`
- [Feed state](https://github.com/prime-02/linkedin-clone/blob/master/store/useFeedStore.ts): Zustand store · Mutable posts, reactions, and comments. · `store/useFeedStore.ts`
- [Post seed data](https://github.com/prime-02/linkedin-clone/blob/master/data/posts.ts): mock data · Initial feed state. · `data/posts.ts`
- [User data](https://github.com/prime-02/linkedin-clone/blob/master/data/users.ts): mock data · Shared profile dataset. · `data/users.ts`
- [Network state](https://github.com/prime-02/linkedin-clone/blob/master/store/useNetworkStore.ts): Zustand store · Mutable invitation and connection workflows. · `store/useNetworkStore.ts`
- [Connection data](https://github.com/prime-02/linkedin-clone/blob/master/data/connections.ts): mock data · Initial network relationships. · `data/connections.ts`
- [Message state](https://github.com/prime-02/linkedin-clone/blob/master/store/useMessagesStore.ts): Zustand store · Conversation and thread runtime state. · `store/useMessagesStore.ts`
- [Message data](https://github.com/prime-02/linkedin-clone/blob/master/data/messages.ts): mock data · Initial conversations and threads. · `data/messages.ts`
- [Notification state](https://github.com/prime-02/linkedin-clone/blob/master/store/useNotificationsStore.ts): Zustand store · Mutable read state drives navigation badges. · `store/useNotificationsStore.ts`
- [Shared models](https://github.com/prime-02/linkedin-clone/blob/master/types/index.ts): TypeScript contracts · Common contracts for data, stores, routes, and components. · `types/index.ts`
- [Shared UI primitives](https://github.com/prime-02/linkedin-clone/blob/master/components/shared/Button.tsx): reusable components · Avatar, modal, dropdown, button, and tooltip primitives. · `components/shared/Button.tsx`

## Connections

- Root entry → Login: directs to
- Login → Auth state: updates
- Auth state → Main layout: enables
- Main layout → Navbar: composes
- Main layout → Side rails: composes
- Main layout → Feed: renders
- Main layout → Member profiles: renders
- Main layout → Network: renders
- Main layout → Messaging: renders
- Main layout → Jobs: renders
- Main layout → Notifications: renders
- Feed → Post interaction UI: composes
- Post interaction UI → Feed state: reads and mutates
- Post seed data → Feed state: initializes
- Member profiles → Profile sections: composes
- User data → Member profiles: supplies user by ID
- Network → Network state: reads and mutates
- Connection data → Network state: initializes
- Messaging → Message state: reads and mutates
- Message data → Message state: initializes
- Notifications → Notification state: reads and mutates
- Notification state → Navbar: updates badge count
- Shared models → Feed state: types
- Shared models → Network state: types
- Shared models → Message state: types
- Shared UI primitives → Post interaction UI: standardizes interactions
- Shared UI primitives → Profile sections: standardizes presentation
