# ani1818/connect architecture

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

- Interactive diagram: https://gitdiagram.com/ani1818/connect
- Repository: https://github.com/ani1818/connect

## Overview

CONNECT is a self-hostable social network and real-time communication platform. Users authenticate, enter the application shell, and use social, messaging, community, creator, and governance features through API requests and live sockets. The server routes requests to domain endpoints, with shared authentication/security and database or media-storage support. The README documents additional capabilities such as reels, stories, live rooms, calls, and backup/restore; some corresponding route implementations are not sampled, so those links are documented rather than inferred from unseen code.

Main entry points: [`src/lib/api.ts`](https://github.com/ani1818/connect/blob/main/src/lib/api.ts) (HTTP API client), [`server.ts`](https://github.com/ani1818/connect/blob/main/server.ts) (HTTP server), [`server/db.ts`](https://github.com/ani1818/connect/blob/main/server/db.ts) (Prisma database), [`src/App.tsx`](https://github.com/ani1818/connect/blob/main/src/App.tsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client experience"]
  node_app["Application shell<br/>[App.tsx]"]
  node_auth_ui["Sign-in and setup<br/>[AuthPages.tsx]"]
  node_auth_state["Authentication state<br/>[AuthContext.tsx]"]
  node_router["Client routing<br/>[RouterContext.tsx]"]
  node_api["HTTP API client<br/>[api.ts]"]
end

subgraph group_social["Social features"]
  node_feed["Feed and posts<br/>[HomeFeed.tsx]"]
  node_post_card["Post interactions<br/>[PostCard.tsx]"]
  node_composer["Post composer<br/>[PostComposer.tsx]"]
  node_stories["Stories<br/>[StoriesBar.tsx]"]
  node_explore["Explore discovery<br/>[ExploreView.tsx]"]
  node_profile["Profiles<br/>[ProfileView.tsx]"]
  node_reels["Short-form reels<br/>[ReelsView.tsx]"]
  node_communities_ui["Communities and events"]
  node_creator_ui["Creator analytics"]
end

subgraph group_communication["Communication"]
  node_messenger["Messaging client<br/>[MessengerView.tsx]"]
  node_reply_bubble["Swipe reply"]
  node_socket_client["Realtime client<br/>[SocketContext.tsx]"]
  node_calls["WebRTC call UI<br/>[CallOverlay.tsx]"]
  node_live_ui["Live streams"]
  node_notifications_ui["Notifications"]
end

subgraph group_server["Server services"]
  node_server_entry["HTTP server<br/>[server.ts]"]
  node_auth_routes["Authentication routes<br/>[auth.ts]"]
  node_post_routes["Posts and feed routes<br/>[posts.ts]"]
  node_message_routes["Messaging routes<br/>[messages.ts]"]
  node_community_routes["Community routes<br/>[communities.ts]"]
  node_admin_routes["Admin and governance<br/>[admin.ts]"]
  node_feature_routes["Other feature routes"]
  node_realtime_server["Socket.IO server<br/>[realtime.ts]"]
end

subgraph group_platform["Platform services"]
  node_middleware["Request middleware<br/>[middleware.ts]"]
  node_security["Security utilities<br/>[security.ts]"]
  node_bootstrap["Admin bootstrap<br/>[bootstrap-admin.ts]"]
  node_database[("Prisma database<br/>[db.ts]")]
  node_media_storage[("Media and backups<br/>[storage.ts]")]
end

node_person(("Platform user"))

node_person -->|"uses"| node_app
node_app -->|"renders"| node_auth_ui
node_app -->|"renders"| node_feed
node_app -->|"renders"| node_messenger
node_app -->|"uses"| node_router
node_auth_ui -->|"uses"| node_auth_state
node_auth_state -->|"requests"| node_api
node_feed -->|"renders"| node_post_card
node_feed -.->|"renders"| node_composer
node_feed -.->|"renders"| node_stories
node_feed -.->|"requests"| node_api
node_post_card -->|"requests"| node_api
node_stories -->|"requests"| node_api
node_explore -->|"requests"| node_api
node_profile -->|"requests"| node_api
node_reels -->|"requests"| node_api
node_communities_ui -->|"requests"| node_api
node_creator_ui -->|"requests"| node_api
node_messenger -->|"requests"| node_api
node_messenger -->|"renders"| node_reply_bubble
node_messenger -->|"uses"| node_socket_client
node_calls -->|"uses"| node_socket_client
node_live_ui -.->|"uses"| node_socket_client
node_notifications_ui -->|"requests"| node_api
node_api -->|"HTTP requests"| node_server_entry
node_server_entry -->|"routes"| node_auth_routes
node_server_entry -->|"routes"| node_post_routes
node_server_entry -->|"routes"| node_message_routes
node_server_entry -->|"routes"| node_community_routes
node_server_entry -->|"routes"| node_admin_routes
node_server_entry -->|"routes"| node_feature_routes
node_server_entry -->|"initializes"| node_realtime_server
node_server_entry -->|"configures"| node_middleware
node_auth_routes -->|"queries"| node_database
node_auth_routes -->|"invokes"| node_bootstrap
node_auth_routes -->|"uses"| node_security
node_post_routes -->|"queries"| node_database
node_post_routes -->|"stores media"| node_media_storage
node_message_routes -->|"queries"| node_database
node_message_routes -->|"dispatches events"| node_realtime_server
node_message_routes -->|"stores attachments"| node_media_storage
node_community_routes -->|"queries"| node_database
node_community_routes -->|"dispatches events"| node_realtime_server
node_admin_routes -->|"queries"| node_database
node_admin_routes -->|"manages backups"| node_media_storage
node_admin_routes -->|"uses"| node_security
node_middleware -->|"checks sessions"| node_database
node_middleware -->|"validates tokens"| node_security

click node_app "https://github.com/ani1818/connect/blob/main/src/App.tsx"
click node_auth_ui "https://github.com/ani1818/connect/blob/main/src/components/auth/AuthPages.tsx"
click node_auth_state "https://github.com/ani1818/connect/blob/main/src/context/AuthContext.tsx"
click node_router "https://github.com/ani1818/connect/blob/main/src/context/RouterContext.tsx"
click node_api "https://github.com/ani1818/connect/blob/main/src/lib/api.ts"
click node_feed "https://github.com/ani1818/connect/blob/main/src/components/feed/HomeFeed.tsx"
click node_post_card "https://github.com/ani1818/connect/blob/main/src/components/feed/PostCard.tsx"
click node_composer "https://github.com/ani1818/connect/blob/main/src/components/feed/PostComposer.tsx"
click node_stories "https://github.com/ani1818/connect/blob/main/src/components/feed/StoriesBar.tsx"
click node_explore "https://github.com/ani1818/connect/blob/main/src/components/explore/ExploreView.tsx"
click node_profile "https://github.com/ani1818/connect/blob/main/src/components/profile/ProfileView.tsx"
click node_reels "https://github.com/ani1818/connect/blob/main/src/components/reels/ReelsView.tsx"
click node_communities_ui "https://github.com/ani1818/connect/blob/main/src/components/communities/CommunitiesView.tsx"
click node_creator_ui "https://github.com/ani1818/connect/blob/main/src/components/creator/CreatorStudioView.tsx"
click node_messenger "https://github.com/ani1818/connect/blob/main/src/components/messages/MessengerView.tsx"
click node_reply_bubble "https://github.com/ani1818/connect/blob/main/src/components/messages/SwipeReplyBubble.tsx"
click node_socket_client "https://github.com/ani1818/connect/blob/main/src/context/SocketContext.tsx"
click node_calls "https://github.com/ani1818/connect/blob/main/src/components/calls/CallOverlay.tsx"
click node_live_ui "https://github.com/ani1818/connect/blob/main/src/components/live/LiveStreamsView.tsx"
click node_notifications_ui "https://github.com/ani1818/connect/blob/main/src/components/notifications/NotificationsView.tsx"
click node_server_entry "https://github.com/ani1818/connect/blob/main/server.ts"
click node_auth_routes "https://github.com/ani1818/connect/blob/main/server/routes/auth.ts"
click node_post_routes "https://github.com/ani1818/connect/blob/main/server/routes/posts.ts"
click node_message_routes "https://github.com/ani1818/connect/blob/main/server/routes/messages.ts"
click node_community_routes "https://github.com/ani1818/connect/blob/main/server/routes/communities.ts"
click node_admin_routes "https://github.com/ani1818/connect/blob/main/server/routes/admin.ts"
click node_feature_routes "https://github.com/ani1818/connect/tree/main/server/routes"
click node_realtime_server "https://github.com/ani1818/connect/blob/main/server/realtime.ts"
click node_middleware "https://github.com/ani1818/connect/blob/main/server/middleware.ts"
click node_security "https://github.com/ani1818/connect/blob/main/server/security.ts"
click node_bootstrap "https://github.com/ani1818/connect/blob/main/server/bootstrap-admin.ts"
click node_database "https://github.com/ani1818/connect/blob/main/server/db.ts"
click node_media_storage "https://github.com/ani1818/connect/blob/main/server/storage.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_app,node_auth_ui,node_auth_state,node_router,node_api,node_person toneBlue
class node_feed,node_post_card,node_composer,node_stories,node_explore,node_profile,node_reels,node_communities_ui,node_creator_ui toneAmber
class node_messenger,node_reply_bubble,node_socket_client,node_calls,node_live_ui,node_notifications_ui toneMint
class node_server_entry,node_auth_routes,node_post_routes,node_message_routes,node_community_routes,node_admin_routes,node_feature_routes,node_realtime_server toneRose
class node_middleware,node_security,node_bootstrap,node_database,node_media_storage toneIndigo
```

## Components

### Client experience

- [Application shell](https://github.com/ani1818/connect/blob/main/src/App.tsx): `src/App.tsx`
- [Sign-in and setup](https://github.com/ani1818/connect/blob/main/src/components/auth/AuthPages.tsx): `src/components/auth/AuthPages.tsx`
- [Authentication state](https://github.com/ani1818/connect/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Client routing](https://github.com/ani1818/connect/blob/main/src/context/RouterContext.tsx): `src/context/RouterContext.tsx`
- [HTTP API client](https://github.com/ani1818/connect/blob/main/src/lib/api.ts): `src/lib/api.ts`

### Social features

- [Feed and posts](https://github.com/ani1818/connect/blob/main/src/components/feed/HomeFeed.tsx): `src/components/feed/HomeFeed.tsx`
- [Post interactions](https://github.com/ani1818/connect/blob/main/src/components/feed/PostCard.tsx): `src/components/feed/PostCard.tsx`
- [Post composer](https://github.com/ani1818/connect/blob/main/src/components/feed/PostComposer.tsx): `src/components/feed/PostComposer.tsx`
- [Stories](https://github.com/ani1818/connect/blob/main/src/components/feed/StoriesBar.tsx): `src/components/feed/StoriesBar.tsx`
- [Explore discovery](https://github.com/ani1818/connect/blob/main/src/components/explore/ExploreView.tsx): `src/components/explore/ExploreView.tsx`
- [Profiles](https://github.com/ani1818/connect/blob/main/src/components/profile/ProfileView.tsx): `src/components/profile/ProfileView.tsx`
- [Short-form reels](https://github.com/ani1818/connect/blob/main/src/components/reels/ReelsView.tsx): `src/components/reels/ReelsView.tsx`
- [Communities and events](https://github.com/ani1818/connect/blob/main/src/components/communities/CommunitiesView.tsx): `src/components/communities/CommunitiesView.tsx`
- [Creator analytics](https://github.com/ani1818/connect/blob/main/src/components/creator/CreatorStudioView.tsx): `src/components/creator/CreatorStudioView.tsx`

### Communication

- [Messaging client](https://github.com/ani1818/connect/blob/main/src/components/messages/MessengerView.tsx): `src/components/messages/MessengerView.tsx`
- [Swipe reply](https://github.com/ani1818/connect/blob/main/src/components/messages/SwipeReplyBubble.tsx): `src/components/messages/SwipeReplyBubble.tsx`
- [Realtime client](https://github.com/ani1818/connect/blob/main/src/context/SocketContext.tsx): `src/context/SocketContext.tsx`
- [WebRTC call UI](https://github.com/ani1818/connect/blob/main/src/components/calls/CallOverlay.tsx): `src/components/calls/CallOverlay.tsx`
- [Live streams](https://github.com/ani1818/connect/blob/main/src/components/live/LiveStreamsView.tsx): `src/components/live/LiveStreamsView.tsx`
- [Notifications](https://github.com/ani1818/connect/blob/main/src/components/notifications/NotificationsView.tsx): `src/components/notifications/NotificationsView.tsx`

### Server services

- [HTTP server](https://github.com/ani1818/connect/blob/main/server.ts): `server.ts`
- [Authentication routes](https://github.com/ani1818/connect/blob/main/server/routes/auth.ts): `server/routes/auth.ts`
- [Posts and feed routes](https://github.com/ani1818/connect/blob/main/server/routes/posts.ts): `server/routes/posts.ts`
- [Messaging routes](https://github.com/ani1818/connect/blob/main/server/routes/messages.ts): `server/routes/messages.ts`
- [Community routes](https://github.com/ani1818/connect/blob/main/server/routes/communities.ts): `server/routes/communities.ts`
- [Admin and governance](https://github.com/ani1818/connect/blob/main/server/routes/admin.ts): `server/routes/admin.ts`
- [Other feature routes](https://github.com/ani1818/connect/tree/main/server/routes): `server/routes`
- [Socket.IO server](https://github.com/ani1818/connect/blob/main/server/realtime.ts): `server/realtime.ts`

### Platform services

- [Request middleware](https://github.com/ani1818/connect/blob/main/server/middleware.ts): `server/middleware.ts`
- [Security utilities](https://github.com/ani1818/connect/blob/main/server/security.ts): `server/security.ts`
- [Admin bootstrap](https://github.com/ani1818/connect/blob/main/server/bootstrap-admin.ts): `server/bootstrap-admin.ts`
- [Prisma database](https://github.com/ani1818/connect/blob/main/server/db.ts): `server/db.ts`
- [Media and backups](https://github.com/ani1818/connect/blob/main/server/storage.ts): `server/storage.ts`

### Other components

- **Platform user**

## Connections

- Platform user → Application shell: uses (evidence: `README.md`)
- Application shell → Sign-in and setup: renders (evidence: `src/App.tsx`)
- Application shell → Feed and posts: renders (evidence: `src/App.tsx`)
- Application shell → Messaging client: renders (evidence: `src/App.tsx`)
- Application shell → Client routing: uses (evidence: `src/App.tsx`)
- Sign-in and setup → Authentication state: uses (evidence: `src/components/auth/AuthPages.tsx`)
- Authentication state → HTTP API client: requests (evidence: `src/context/AuthContext.tsx`)
- Feed and posts → Post interactions: renders
- Feed and posts → Post composer: renders
- Feed and posts → Stories: renders
- Feed and posts → HTTP API client: requests
- Post interactions → HTTP API client: requests (evidence: `src/components/feed/PostCard.tsx`)
- Stories → HTTP API client: requests (evidence: `src/components/feed/StoriesBar.tsx`)
- Explore discovery → HTTP API client: requests (evidence: `src/components/explore/ExploreView.tsx`)
- Profiles → HTTP API client: requests (evidence: `src/components/profile/ProfileView.tsx`)
- Short-form reels → HTTP API client: requests (evidence: `src/components/reels/ReelsView.tsx`)
- Communities and events → HTTP API client: requests (evidence: `src/components/communities/CommunitiesView.tsx`)
- Creator analytics → HTTP API client: requests (evidence: `src/components/creator/CreatorStudioView.tsx`)
- Messaging client → HTTP API client: requests (evidence: `src/components/messages/MessengerView.tsx`)
- Messaging client → Swipe reply: renders (evidence: `src/components/messages/MessengerView.tsx`)
- Messaging client → Realtime client: uses (evidence: `src/components/messages/MessengerView.tsx`)
- WebRTC call UI → Realtime client: uses (evidence: `src/components/calls/CallOverlay.tsx`)
- Live streams → Realtime client: uses
- Notifications → HTTP API client: requests (evidence: `src/components/notifications/NotificationsView.tsx`)
- HTTP API client → HTTP server: HTTP requests (evidence: `README.md`)
- HTTP server → Authentication routes: routes (evidence: `server.ts`)
- HTTP server → Posts and feed routes: routes (evidence: `server.ts`)
- HTTP server → Messaging routes: routes (evidence: `server.ts`)
- HTTP server → Community routes: routes (evidence: `server.ts`)
- HTTP server → Admin and governance: routes (evidence: `server.ts`)
- HTTP server → Other feature routes: routes (evidence: `server.ts`)
- HTTP server → Socket.IO server: initializes (evidence: `server.ts`)
- HTTP server → Request middleware: configures (evidence: `server.ts`)
- Authentication routes → Prisma database: queries (evidence: `server/routes/auth.ts`)
- Authentication routes → Admin bootstrap: invokes (evidence: `server/routes/auth.ts`)
- Authentication routes → Security utilities: uses (evidence: `server/routes/auth.ts`)
- Posts and feed routes → Prisma database: queries (evidence: `server/routes/posts.ts`)
- Posts and feed routes → Media and backups: stores media (evidence: `server/routes/posts.ts`)
- Messaging routes → Prisma database: queries (evidence: `server/routes/messages.ts`)
- Messaging routes → Socket.IO server: dispatches events (evidence: `server/routes/messages.ts`)
- Messaging routes → Media and backups: stores attachments (evidence: `server/routes/messages.ts`)
- Community routes → Prisma database: queries (evidence: `server/routes/communities.ts`)
- Community routes → Socket.IO server: dispatches events (evidence: `server/routes/communities.ts`)
- Admin and governance → Prisma database: queries (evidence: `server/routes/admin.ts`)
- Admin and governance → Media and backups: manages backups (evidence: `server/routes/admin.ts`)
- Admin and governance → Security utilities: uses (evidence: `server/routes/admin.ts`)
- Request middleware → Prisma database: checks sessions (evidence: `server/middleware.ts`)
- Request middleware → Security utilities: validates tokens (evidence: `server/middleware.ts`)
