# aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff- architecture

> Architecture diagram of the GitHub repository aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-04-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-
- Repository: https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-

## Overview

1. **High-level structure**
   - The repo is a two-tier monorepo: `client/` is a React/Vite SPA, and `server/` is a Node.js/Express API.
   - The frontend owns all user interaction and page composition; the backend owns persistence, auth, media uploads, payments, analytics, and domain APIs.

2. **Frontend shell and navigation**
   - `client/src/main.jsx` bootstraps the app, while `App.jsx` likely defines the route map.
   - `Layout.jsx` provides the shared frame for authenticated and public pages, and `ProtectedRoute.jsx` gates role-sensitive routes.

3. **State, language, and UI concerns**
   - `UserContext.jsx` and `ThemeContext.jsx` hold app-wide client state for identity/session and UI theme.
   - `i18n.js` plus `public/locales/en` and `public/locales/ne` show built-in bilingual support with English and Nepali translations.

4. **Content browsing and editing flow**
   - The core content lifecycle is split across `ArticleList.jsx`, `SingleArticle.jsx`, `CreateArticle.jsx`, and `EditArticle.jsx`.
   - Reusable UI pieces like `ArticleCard.jsx` and `CommentSection.jsx` support listing, reading, and discussion around articles.

5. **Role-specific dashboards**
   - Admin and publisher functionality is separated into dedicated pages and components: `AdminDashboard.jsx`, `FullAdminDashboard.jsx`, `AnalyticsDashboard.jsx`, `PublisherAnalytics.jsx`, `UserManagement.jsx`, `MySubscribers.jsx`, and `MySubscriptions.jsx`.
   - This indicates role-based surface area rather than one generic dashboard, which matters for diagramming access boundaries.

6. **Authentication and identity**
   - Public auth entry points include `Login.jsx`, `Register.jsx`, `LoginSuccess.jsx`, and `GoogleLoginButton.jsx`.
   - On the backend, `routes/auth.js` and `middleware/auth.js` indicate JWT-protected APIs and server-side authorization checks.
   - `routes/secure.js` likely exposes authenticated test/utility endpoints for session verification or protected data.

7. **Payments and subscriptions**
   - The client has `PayButton.jsx` and `SubscribeButton.jsx`, and dedicated success/failure screens in `PaymentSuccess.jsx` and `PaymentFailed.jsx`.
   - The server’s `routes/payments.js` and `models/Payment.js` show a persisted payment/subscription workflow, with the README indicating eSewa as the external payment provider.

8. **Notifications and social interactions**
   - `NotificationBell.jsx` on the client pairs with `models/Notification.js` and `routes/notification.js` on the server.
   - The tree suggests notification delivery is modeled through API-backed storage/display rather than a dedicated realtime transport layer in this repo.

9. **Backend domain model**
   - MongoDB-backed entities are organized by concern: `User.js`, `Article.js`, `Comment.js`, `Notification.js`, and `Payment.js`.
   - This is the core data boundary for the whole system: users create articles, articles receive comments, subscriptions/payments are recorded, and notifications are generated from platform events.

10. **Media and file handling**
   - `server/uploads/profilePictures` shows persisted uploaded assets, and the README mentions rich media uploads.
   - The architecture likely uses server-side upload handling for profile images and article assets, with the filesystem acting as the storage boundary.

11. **Analytics and derived insights**
   - `routes/analytics.js` and `components/PublisherAnalytics.jsx` imply backend-generated metrics consumed by role dashboards.
   - `utils/aiSummarizer.js` is a distinct service boundary for generating summaries or enrichment from article content.

12. **Primary request/response flow**
   - A typical flow is: React page -> authenticated API call -> Express route -> MongoDB model and/or upload/payment/analytics integration -> JSON response back to the SPA.
   - External services matter mainly in three places: Google OAuth login, eSewa payments, and any AI-based summarization logic.

13. **What to show in an architecture diagram**
   - Draw separate client and server boxes, with the client split into shell, auth, content, dashboards, payments, and notifications.
   - On the server side, show routes as the entry layer, middleware for auth, models for persistence, uploads for file storage, and utility code for AI enrichment/derived data.

Main entry points: [`client/src/App.jsx`](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/App.jsx) (App shell), [`server/routes/auth.js`](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/routes/auth.js) (API routes), [`client/src/Login.jsx`](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/Login.jsx) (Auth flow), [`client/src/pages/ArticleList.jsx`](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/ArticleList.jsx) (Content flow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_main["Bootstrap<br/>entry<br/>[main.jsx]"]
  node_client_app["App shell<br/>router<br/>[App.jsx]"]
  node_client_layout["Layout<br/>shell<br/>[Layout.jsx]"]
  node_client_gate["Route guard<br/>[ProtectedRoute.jsx]"]
  node_client_state["App state<br/>context"]
  node_client_i18n["Localization<br/>config<br/>[i18n.js]"]
  node_client_auth["Auth flow<br/>ui<br/>[Login.jsx]"]
  node_client_content["Content flow<br/>ui<br/>[ArticleList.jsx]"]
  node_client_admin["Admin area<br/>ui<br/>[AdminDashboard.jsx]"]
  node_client_analytics["Analytics<br/>ui"]
  node_client_subs["Subscriptions<br/>ui<br/>[MySubscribers.jsx]"]
  node_client_payments["Payments<br/>ui<br/>[PayButton.jsx]"]
  node_client_notify["Notifications<br/>ui"]
end

subgraph group_server["Server"]
  node_server_api["API server<br/>entry<br/>[index.js]"]
  node_server_routes["API routes<br/>http<br/>[auth.js]"]
  node_server_auth["Auth middleware<br/>[auth.js]"]
  node_server_models[("Data models<br/>persistence<br/>[User.js]")]
  node_server_uploads[("Uploads<br/>storage")]
  node_server_ai["AI summarizer<br/>[aiSummarizer.js]"]
end

subgraph group_external["External"]
  node_external_oauth(("Google OAuth<br/>external auth"))
  node_external_payments(("eSewa<br/>external payment"))
end

node_client_main -->|"bootstraps"| node_client_app
node_client_app -->|"uses"| node_client_layout
node_client_app -->|"guards"| node_client_gate
node_client_app -->|"reads state"| node_client_state
node_client_app -->|"localizes"| node_client_i18n
node_client_app -->|"routes to"| node_client_auth
node_client_app -->|"routes to"| node_client_content
node_client_app -->|"routes to"| node_client_admin
node_client_app -->|"routes to"| node_client_analytics
node_client_app -->|"routes to"| node_client_subs
node_client_app -->|"routes to"| node_client_payments
node_client_app -->|"renders"| node_client_notify
node_client_auth -.->|"signs in with"| node_external_oauth
node_client_content -->|"calls API"| node_server_routes
node_client_auth -->|"calls API"| node_server_routes
node_client_payments -->|"calls API"| node_server_routes
node_client_notify -->|"calls API"| node_server_routes
node_client_analytics -->|"calls API"| node_server_routes
node_server_api -->|"mounts"| node_server_routes
node_server_routes -->|"protects"| node_server_auth
node_server_routes -->|"persists"| node_server_models
node_server_routes -->|"stores files"| node_server_uploads
node_server_routes -->|"enriches"| node_server_ai
node_server_routes -.->|"charges via"| node_external_payments

click node_client_main "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/main.jsx"
click node_client_app "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/App.jsx"
click node_client_layout "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/Layout.jsx"
click node_client_gate "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/ProtectedRoute.jsx"
click node_client_i18n "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/i18n.js"
click node_client_auth "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/Login.jsx"
click node_client_content "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/ArticleList.jsx"
click node_client_admin "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/AdminDashboard.jsx"
click node_client_analytics "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/AnalyticsDashboard.jsx"
click node_client_subs "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/MySubscribers.jsx"
click node_client_payments "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/PayButton.jsx"
click node_client_notify "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/NotificationBell.jsx"
click node_server_api "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/index.js"
click node_server_routes "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/routes/auth.js"
click node_server_auth "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/middleware/auth.js"
click node_server_models "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/models/User.js"
click node_server_uploads "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/tree/main/server/uploads/profilePictures"
click node_server_ai "https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/utils/aiSummarizer.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_client_main,node_client_app,node_client_layout,node_client_gate,node_client_state,node_client_i18n,node_client_auth,node_client_content,node_client_admin,node_client_analytics,node_client_subs,node_client_payments,node_client_notify toneBlue
class node_server_api,node_server_routes,node_server_auth,node_server_models,node_server_uploads,node_server_ai toneAmber
class node_external_oauth,node_external_payments toneMint
```

## Components

### Client

React/Vite SPA for content, identity, and account flows

- [Bootstrap](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/main.jsx): entry · Starts the React app · `client/src/main.jsx`
- [App shell](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/App.jsx): router · Defines the route map and top-level composition · `client/src/App.jsx`
- [Layout](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/Layout.jsx): shell · Shared frame for public and authenticated pages · `client/src/components/Layout.jsx`
- [Route guard](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/ProtectedRoute.jsx): guard · Restricts role-sensitive screens · `client/src/components/ProtectedRoute.jsx`
- **App state**: context · User/session and theme state
- [Localization](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/i18n.js): config · Bilingual UI strings and locale setup · `client/src/i18n.js`
- [Auth flow](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/Login.jsx): ui · Login, registration, and OAuth entry points · `client/src/Login.jsx`
- [Content flow](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/ArticleList.jsx): ui · Browse, read, create, edit, and discuss articles · `client/src/pages/ArticleList.jsx`
- [Admin area](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/AdminDashboard.jsx): ui · Administrative and user management screens · `client/src/pages/AdminDashboard.jsx`
- [Analytics](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/AnalyticsDashboard.jsx): ui · Platform and publisher metrics views · `client/src/pages/AnalyticsDashboard.jsx`
- [Subscriptions](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/pages/MySubscribers.jsx): ui · Subscriber and subscription views · `client/src/pages/MySubscribers.jsx`
- [Payments](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/PayButton.jsx): ui · Subscription purchase and payment result screens · `client/src/components/PayButton.jsx`
- [Notifications](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/client/src/components/NotificationBell.jsx): ui · In-app notification display · `client/src/components/NotificationBell.jsx`

### Server

Express API for auth, content, payments, notifications, and analytics

- [API server](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/index.js): entry · Express application entry point · `server/index.js`
- [API routes](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/routes/auth.js): http · HTTP endpoints for auth, content, payments, notifications, analytics, and secure access · `server/routes/auth.js`
- [Auth middleware](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/middleware/auth.js): middleware · Protects authenticated APIs · `server/middleware/auth.js`
- [Data models](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/models/User.js): persistence · MongoDB entities for the core domain · `server/models/User.js`
- [Uploads](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/tree/main/server/uploads/profilePictures): storage · Filesystem storage for profile pictures and media · `server/uploads/profilePictures`
- [AI summarizer](https://github.com/aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff-/blob/main/server/utils/aiSummarizer.js): service · Generates article summaries or enrichment · `server/utils/aiSummarizer.js`

### External

Third-party services and file storage

- **Google OAuth**: external auth · Third-party login provider
- **eSewa**: external payment · External payment provider used for subscriptions

## Connections

- Bootstrap → App shell: bootstraps · Mounts the SPA and hands off to routing
- App shell → Layout: uses · Wraps pages in the shared frame
- App shell → Route guard: guards · Restricts protected routes
- App shell → App state: reads state · Consumes user and theme context
- App shell → Localization: localizes · Loads translated UI strings
- App shell → Auth flow: routes to · Exposes login and registration flows
- App shell → Content flow: routes to · Shows article browsing and editing flows
- App shell → Admin area: routes to · Opens admin surfaces
- App shell → Analytics: routes to · Opens analytics views
- App shell → Subscriptions: routes to · Opens subscriber management
- App shell → Payments: routes to · Starts subscription payment flows
- App shell → Notifications: renders · Shows notification state in the UI
- Auth flow → Google OAuth: signs in with · Uses Google login for authentication
- Content flow → API routes: calls API · Fetches and mutates article and comment data
- Auth flow → API routes: calls API · Sends credentials and session requests
- Payments → API routes: calls API · Initiates payment and subscription requests
- Notifications → API routes: calls API · Loads notifications
- Analytics → API routes: calls API · Reads analytics data
- API server → API routes: mounts · Registers route modules
- API routes → Auth middleware: protects · Applies authorization checks
- API routes → Data models: persists · Reads and writes domain records
- API routes → Uploads: stores files · Handles profile pictures and media uploads
- API routes → AI summarizer: enriches · Generates summaries or derived content
- API routes → eSewa: charges via · Uses the payment provider for subscriptions
