How aryalmuskan17/universal-content-sharing-and-community-platform--guffsuff- works
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: App.jsx App shell · auth.js API routes · Login.jsx Auth flow · ArticleList.jsx Content flow
Components 21
Client
React/Vite SPA for content, identity, and account flows
- Bootstrap · Starts the React app
client/src/main.jsx - App shell · Defines the route map and top-level composition
client/src/App.jsx - Layout · Shared frame for public and authenticated pages
client/src/components/Layout.jsx - Route guard · Restricts role-sensitive screens
client/src/components/ProtectedRoute.jsx - App state · User/session and theme state
- Localization · Bilingual UI strings and locale setup
client/src/i18n.js - Auth flow · Login, registration, and OAuth entry points
client/src/Login.jsx - Content flow · Browse, read, create, edit, and discuss articles
client/src/pages/ArticleList.jsx - Admin area · Administrative and user management screens
client/src/pages/AdminDashboard.jsx - Analytics · Platform and publisher metrics views
client/src/pages/AnalyticsDashboard.jsx - Subscriptions · Subscriber and subscription views
client/src/pages/MySubscribers.jsx - Payments · Subscription purchase and payment result screens
client/src/components/PayButton.jsx - Notifications · In-app notification display
client/src/components/NotificationBell.jsx
Server
Express API for auth, content, payments, notifications, and analytics
- API server · Express application entry point
server/index.js - API routes · HTTP endpoints for auth, content, payments, notifications, analytics, and secure access
server/routes/auth.js - Auth middleware · Protects authenticated APIs
server/middleware/auth.js - Data models · MongoDB entities for the core domain
server/models/User.js - Uploads · Filesystem storage for profile pictures and media
server/uploads/profilePictures - AI summarizer · Generates article summaries or enrichment
server/utils/aiSummarizer.js
External
Third-party services and file storage
- Google OAuth · Third-party login provider
- eSewa · External payment provider used for subscriptions
Connections 24
- 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