# ashar766/social-app architecture

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

- Interactive diagram: https://gitdiagram.com/ashar766/social-app
- Repository: https://github.com/ashar766/social-app

## Overview

This is a Next.js social app for account creation and login, sharing and browsing posts, and connecting with other users. The main workflow is authenticate, browse a filtered post feed, then create or interact with posts; profiles, follow requests, and user search provide separate social features. Prisma is the database-access layer, and the custom server also initializes Socket.IO. Several action and client modules were not sampled, so their edges are limited to relationships supported by the tree, module names, or sampled source.

Main entry points: [`lib/prisma.ts`](https://github.com/ashar766/social-app/blob/master/lib/prisma.ts) (PostgreSQL), [`app/(app)/posts/page.tsx`](https://github.com/ashar766/social-app/blob/master/app/(app)/posts/page.tsx) (Post feed), [`lib/auth.ts`](https://github.com/ashar766/social-app/blob/master/lib/auth.ts) (Auth service), [`app/api/posts/route.ts`](https://github.com/ashar766/social-app/blob/master/app/api/posts/route.ts) (Feed API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_login["Login<br/>[page.tsx]"]
  node_signup["Signup form<br/>[page.tsx]"]
  node_signup_action["Signup action<br/>[action.ts]"]
  node_auth["Auth service<br/>[auth.ts]"]
  node_auth_route["Auth routes<br/>[route.ts]"]
end

subgraph group_content["Posts"]
  node_feed_page["Post feed<br/>[page.tsx]"]
  node_feed_api["Feed API<br/>[route.ts]"]
  node_infinite_posts["Infinite posts<br/>[InfinitePosts.tsx]"]
  node_create_post["Create post<br/>[action.ts]"]
  node_post_detail["Post detail<br/>[page.tsx]"]
  node_post_actions["Post actions<br/>[post-action.ts]"]
  node_edit_post["Edit post<br/>[edit-action.ts]"]
end

subgraph group_social["Social graph"]
  node_profile["Profile<br/>[page.tsx]"]
  node_follow_actions["Follow actions<br/>[action.ts]"]
  node_request_actions["Request actions<br/>[request-action.ts]"]
  node_user_search["User search<br/>[page.tsx]"]
  node_search_form["Search form<br/>[UserSearchForm.tsx]"]
end

subgraph group_runtime["App runtime"]
  node_home["Home<br/>[page.tsx]"]
  node_db[("PostgreSQL<br/>[prisma.ts]")]
  node_app_layout["App layout<br/>[layout.tsx]"]
  node_socket_provider["Socket provider<br/>[SocketProvider.tsx]"]
  node_server["Socket server<br/>[server.ts]"]
  node_socket_lib["Socket registry<br/>[socket.ts]"]
end

node_user(("User"))

node_user -->|"opens"| node_home
node_home -->|"links to"| node_login
node_home -->|"links to"| node_signup
node_user -->|"submits credentials"| node_login
node_login -->|"signs in"| node_auth
node_user -->|"submits details"| node_signup
node_signup -->|"submits to"| node_signup_action
node_signup_action -->|"writes account"| node_db
node_auth_route -->|"exports handlers"| node_auth
node_auth -->|"looks up user"| node_db
node_user -->|"browses"| node_feed_page
node_feed_page -->|"reads posts"| node_db
node_feed_page -->|"reads follows"| node_db
node_feed_page -->|"renders"| node_infinite_posts
node_infinite_posts -->|"loads pages"| node_feed_api
node_feed_api -->|"checks session"| node_auth
node_feed_api -->|"reads feed"| node_db
node_user -->|"creates post"| node_create_post
node_user -->|"opens post"| node_post_detail
node_user -->|"interacts with"| node_post_actions
node_user -->|"edits post"| node_edit_post
node_user -->|"views profile"| node_profile
node_profile -->|"reads profile"| node_db
node_user -->|"follows user"| node_follow_actions
node_user -->|"handles requests"| node_request_actions
node_user -->|"searches users"| node_search_form
node_search_form -->|"navigates to"| node_user_search
node_app_layout -->|"wraps app"| node_socket_provider
node_server -->|"registers socket server"| node_socket_lib
node_socket_provider -.->|"connects"| node_server

click node_home "https://github.com/ashar766/social-app/blob/master/app/page.tsx"
click node_login "https://github.com/ashar766/social-app/blob/master/app/(auth)/login/page.tsx"
click node_signup "https://github.com/ashar766/social-app/blob/master/app/(auth)/signup/page.tsx"
click node_signup_action "https://github.com/ashar766/social-app/blob/master/app/(auth)/signup/action.ts"
click node_auth "https://github.com/ashar766/social-app/blob/master/lib/auth.ts"
click node_auth_route "https://github.com/ashar766/social-app/blob/master/app/api/auth/%5B...nextauth%5D/route.ts"
click node_db "https://github.com/ashar766/social-app/blob/master/lib/prisma.ts"
click node_app_layout "https://github.com/ashar766/social-app/blob/master/app/(app)/layout.tsx"
click node_feed_page "https://github.com/ashar766/social-app/blob/master/app/(app)/posts/page.tsx"
click node_feed_api "https://github.com/ashar766/social-app/blob/master/app/api/posts/route.ts"
click node_infinite_posts "https://github.com/ashar766/social-app/blob/master/app/(app)/components/InfinitePosts.tsx"
click node_create_post "https://github.com/ashar766/social-app/blob/master/app/(app)/create-post/action.ts"
click node_post_detail "https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/page.tsx"
click node_post_actions "https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/post-action.ts"
click node_edit_post "https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/edit-action.ts"
click node_profile "https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/page.tsx"
click node_follow_actions "https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/action.ts"
click node_request_actions "https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/request-action.ts"
click node_user_search "https://github.com/ashar766/social-app/blob/master/app/(app)/search/users/page.tsx"
click node_search_form "https://github.com/ashar766/social-app/blob/master/app/(app)/components/UserSearchForm.tsx"
click node_socket_provider "https://github.com/ashar766/social-app/blob/master/app/(app)/components/SocketProvider.tsx"
click node_server "https://github.com/ashar766/social-app/blob/master/server.ts"
click node_socket_lib "https://github.com/ashar766/social-app/blob/master/lib/socket.ts"

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_login,node_signup,node_signup_action,node_auth,node_auth_route,node_user toneBlue
class node_feed_page,node_feed_api,node_infinite_posts,node_create_post,node_post_detail,node_post_actions,node_edit_post toneAmber
class node_profile,node_follow_actions,node_request_actions,node_user_search,node_search_form toneMint
class node_home,node_db,node_app_layout,node_socket_provider,node_server,node_socket_lib toneRose
```

## Components

### Identity

- [Login](https://github.com/ashar766/social-app/blob/master/app/(auth)/login/page.tsx): `app/(auth)/login/page.tsx`
- [Signup form](https://github.com/ashar766/social-app/blob/master/app/(auth)/signup/page.tsx): `app/(auth)/signup/page.tsx`
- [Signup action](https://github.com/ashar766/social-app/blob/master/app/(auth)/signup/action.ts): `app/(auth)/signup/action.ts`
- [Auth service](https://github.com/ashar766/social-app/blob/master/lib/auth.ts): `lib/auth.ts`
- [Auth routes](https://github.com/ashar766/social-app/blob/master/app/api/auth/%5B...nextauth%5D/route.ts): `app/api/auth/[...nextauth]/route.ts`

### Posts

- [Post feed](https://github.com/ashar766/social-app/blob/master/app/(app)/posts/page.tsx): `app/(app)/posts/page.tsx`
- [Feed API](https://github.com/ashar766/social-app/blob/master/app/api/posts/route.ts): `app/api/posts/route.ts`
- [Infinite posts](https://github.com/ashar766/social-app/blob/master/app/(app)/components/InfinitePosts.tsx): `app/(app)/components/InfinitePosts.tsx`
- [Create post](https://github.com/ashar766/social-app/blob/master/app/(app)/create-post/action.ts): `app/(app)/create-post/action.ts`
- [Post detail](https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/page.tsx): `app/(app)/post/[id]/page.tsx`
- [Post actions](https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/post-action.ts): `app/(app)/post/[id]/post-action.ts`
- [Edit post](https://github.com/ashar766/social-app/blob/master/app/(app)/post/%5Bid%5D/edit-action.ts): `app/(app)/post/[id]/edit-action.ts`

### Social graph

- [Profile](https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/page.tsx): `app/(app)/profile/[user]/page.tsx`
- [Follow actions](https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/action.ts): `app/(app)/profile/[user]/action.ts`
- [Request actions](https://github.com/ashar766/social-app/blob/master/app/(app)/profile/%5Buser%5D/request-action.ts): `app/(app)/profile/[user]/request-action.ts`
- [User search](https://github.com/ashar766/social-app/blob/master/app/(app)/search/users/page.tsx): `app/(app)/search/users/page.tsx`
- [Search form](https://github.com/ashar766/social-app/blob/master/app/(app)/components/UserSearchForm.tsx): `app/(app)/components/UserSearchForm.tsx`

### App runtime

- [Home](https://github.com/ashar766/social-app/blob/master/app/page.tsx): `app/page.tsx`
- [PostgreSQL](https://github.com/ashar766/social-app/blob/master/lib/prisma.ts): `lib/prisma.ts`
- [App layout](https://github.com/ashar766/social-app/blob/master/app/(app)/layout.tsx): `app/(app)/layout.tsx`
- [Socket provider](https://github.com/ashar766/social-app/blob/master/app/(app)/components/SocketProvider.tsx): `app/(app)/components/SocketProvider.tsx`
- [Socket server](https://github.com/ashar766/social-app/blob/master/server.ts): `server.ts`
- [Socket registry](https://github.com/ashar766/social-app/blob/master/lib/socket.ts): `lib/socket.ts`

### Other components

- **User**

## Connections

- User → Home: opens
- Home → Login: links to
- Home → Signup form: links to
- User → Login: submits credentials
- Login → Auth service: signs in
- User → Signup form: submits details
- Signup form → Signup action: submits to
- Signup action → PostgreSQL: writes account
- Auth routes → Auth service: exports handlers
- Auth service → PostgreSQL: looks up user
- User → Post feed: browses
- Post feed → PostgreSQL: reads posts
- Post feed → PostgreSQL: reads follows
- Post feed → Infinite posts: renders
- Infinite posts → Feed API: loads pages
- Feed API → Auth service: checks session
- Feed API → PostgreSQL: reads feed
- User → Create post: creates post
- User → Post detail: opens post
- User → Post actions: interacts with
- User → Edit post: edits post
- User → Profile: views profile
- Profile → PostgreSQL: reads profile
- User → Follow actions: follows user
- User → Request actions: handles requests
- User → Search form: searches users
- Search form → User search: navigates to
- App layout → Socket provider: wraps app
- Socket server → Socket registry: registers socket server
- Socket provider → Socket server: connects
