# devmalu15/connectspherefrontend architecture

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

- Interactive diagram: https://gitdiagram.com/devmalu15/connectspherefrontend
- Repository: https://github.com/devmalu15/connectspherefrontend

## Overview

1. **Repository scope**
   - This repo is the **Angular 17 frontend SPA** for ConnectSphere.
   - It is a client-only presentation layer that talks to backend APIs over HTTP, primarily through an **Ocelot API Gateway** (`apiUrl`), with a separate **admin API** base URL available when needed.

2. **Application composition**
   - The app is organized as a **standalone-component Angular app** rather than a traditional NgModule-based app.
   - The main composition points are `main.ts`, `app.config.ts`, `app.routes.ts`, and `app.component.ts`.
   - Routing is the primary application boundary, with feature screens loaded as separate route targets.

3. **Core cross-cutting layer**
   - `src/app/core/guards` contains route protection for **auth**, **guest**, and **admin** access.
   - `src/app/core/interceptors/auth.interceptor.ts` is the HTTP boundary for attaching authentication tokens and handling unauthorized responses.
   - `src/app/core/services` holds app-wide services for **authentication**, **theme persistence**, and API access.

4. **Feature-based UI architecture**
   - The app is split into feature folders for the major user journeys:
     - `auth` for login/register
     - `feed` for the home timeline
     - `explore` for search/browse
     - `notifications` for the notification center
     - `post` for post detail and comment threads
     - `profile` for profile viewing, redirecting, and settings
     - `landing` for the entry page
     - `admin` for the hidden admin panel
   - This structure maps cleanly to the route tree and makes each page an isolated subsystem.

5. **Route and access model**
   - Public entry goes through landing/auth routes, then protected user routes like `/feed`, `/explore`, `/notifications`, `/profile/:id`, `/post/:id`, and `/settings`.
   - Admin functionality is intentionally segregated under the hidden `/secretadmin` path and protected by admin-specific guards.
   - This creates a clear separation between normal user flows and privileged operations.

6. **UI shell and shared components**
   - `src/app/shared/components` contains reusable shell and content primitives:
     - `topnav` and `sidenav` provide global navigation
     - `post-card` is the shared post rendering unit
     - `create-post-modal` is the shared post composer entry point
   - These components are reused across feed, explore, profile, and post detail screens, so they act as the common visual language of the app.

7. **Data and type boundary**
   - `src/app/shared/models/models.ts` centralizes TypeScript interfaces and DTO shapes.
   - This file is the contract boundary between UI components and backend payloads, helping keep feature screens consistent and reducing duplicated type definitions.

8. **API interaction pattern**
   - The frontend appears to route all backend communication through a centralized API service layer in `src/app/core/services/api.services.ts`.
   - Feature components should consume this service layer rather than calling `HttpClient` directly, which keeps API concerns out of the page components.
   - The environment file defines the runtime backend endpoints, so the same SPA can target local or deployed backends without code changes.

9. **Authentication and session flow**
   - The auth subsystem likely handles login, registration, token storage, and session restoration through `auth.service.ts`.
   - The interceptor and auth guard form the main security boundary on the client:
     - interceptor injects credentials into outgoing requests
     - guards prevent unauthorized route activation
   - The result is a route-level and request-level enforcement model.

10. **Theme and responsive shell**
   - `theme.service.ts` manages persistent dark/light mode state.
   - Styling is SCSS-based, with the README indicating CSS custom properties for theming and a responsive mobile layout.
   - The UI includes mobile-oriented navigation patterns such as bottom navigation, which affects the overall shell layout rather than just individual pages.

11. **Admin panel as a separate subsystem**
   - The admin area is not just another screen; it is a distinct operational subsystem with analytics, user management, broadcast messaging, and audit-log views.
   - Its hidden route and separate login page suggest stronger access control and a distinct UI workflow from the main social experience.

12. **End-to-end frontend data flow**
   - User action starts in a feature component.
   - The component calls a core service.
   - The service sends HTTP requests to the backend gateway or admin API.
   - The interceptor adds auth context.
   - Returned DTOs are rendered through shared components and feature-specific views.
   - This keeps rendering, state, and transport concerns separated.

13. **Deployment/runtime signal**
   - `vercel.json` indicates the SPA is likely deployed as a static frontend on Vercel.
   - That means the runtime architecture is: browser SPA + remote API backend, not server-rendered Angular.

Main entry points: [`src/app/app.routes.ts`](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.routes.ts) (routes), [`src/app/app.config.ts`](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.config.ts) (app.config), [`src/app/features/admin/admin.component.ts`](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin.component.ts) (admin panel), [`src/app/shared/models/models.ts`](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/models/models.ts) (models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bootstrap["App bootstrap"]
  node_main["main.ts<br/>bootstrap<br/>[main.ts]"]
  node_appconfig["app.config<br/>bootstrap config<br/>[app.config.ts]"]
  node_approutes["routes<br/>routing<br/>[app.routes.ts]"]
  node_appcomponent["app shell<br/>root component<br/>[app.component.ts]"]
end

subgraph group_platform["Core platform"]
  node_guards["route guards<br/>security guards<br/>[guards.ts]"]
  node_interceptor["auth interceptor<br/>http boundary"]
  node_api["API service<br/>backend client<br/>[api.services.ts]"]
  node_authsvc["auth service<br/>session service<br/>[auth.service.ts]"]
  node_themesvc["theme service<br/>ui state<br/>[theme.service.ts]"]
  node_env["environment<br/>runtime config<br/>[environment.ts]"]
end

subgraph group_user["User experience"]
  node_landing["landing<br/>public entry"]
  node_auth["auth flow<br/>public auth<br/>[auth.component.ts]"]
  node_feed["feed<br/>timeline screen<br/>[feed.component.ts]"]
  node_explore["explore<br/>discovery screen"]
  node_notifications["notifications<br/>activity screen"]
  node_postdetail["post detail<br/>content thread"]
  node_profile["profile"]
  node_profilesettings["settings"]
  node_proredirect["profile redirect<br/>route helper"]
end

subgraph group_admin["Admin subsystem"]
  node_adminroot["admin panel<br/>privileged shell<br/>[admin.component.ts]"]
  node_adminlogin["admin login<br/>privileged auth"]
  node_adminusers["users<br/>admin management"]
  node_adminposts["posts<br/>admin moderation"]
  node_adminanalytics["analytics<br/>admin reporting"]
  node_adminbroadcast["broadcast<br/>admin messaging"]
  node_adminaudit["audit log<br/>admin audit"]
end

subgraph group_shared["Shared UI"]
  node_topnav["top nav<br/>shared chrome"]
  node_sidenav["side nav<br/>shared chrome"]
  node_postcard["post card<br/>shared content"]
  node_createpost["create post<br/>shared composer"]
  node_models["models<br/>data contracts<br/>[models.ts]"]
end

node_main -->|"loads"| node_appconfig
node_main -->|"mounts"| node_appcomponent
node_appconfig -->|"registers"| node_guards
node_appconfig -->|"registers"| node_interceptor
node_appconfig -->|"provides"| node_api
node_appconfig -->|"provides"| node_authsvc
node_appconfig -->|"provides"| node_themesvc
node_appconfig -->|"reads"| node_env
node_appcomponent -->|"hosts"| node_approutes
node_approutes -->|"public route"| node_landing
node_approutes -->|"public route"| node_auth
node_approutes -->|"protected route"| node_feed
node_approutes -->|"protected route"| node_explore
node_approutes -->|"protected route"| node_notifications
node_approutes -->|"protected route"| node_postdetail
node_approutes -->|"protected route"| node_profile
node_approutes -->|"protected route"| node_profilesettings
node_approutes -->|"secret route"| node_adminroot
node_approutes -->|"protects with"| node_guards
node_auth -->|"uses"| node_authsvc
node_feed -->|"uses"| node_api
node_explore -->|"uses"| node_api
node_notifications -->|"uses"| node_api
node_postdetail -->|"uses"| node_api
node_profile -->|"uses"| node_api
node_profilesettings -->|"uses"| node_authsvc
node_adminroot -->|"contains"| node_adminusers
node_adminroot -->|"contains"| node_adminposts
node_adminroot -->|"contains"| node_adminanalytics
node_adminroot -->|"contains"| node_adminbroadcast
node_adminroot -->|"contains"| node_adminaudit
node_adminlogin -->|"uses"| node_authsvc
node_topnav -->|"pairs with"| node_sidenav
node_feed -->|"renders"| node_postcard
node_explore -->|"renders"| node_postcard
node_profile -->|"renders"| node_postcard
node_postdetail -->|"renders"| node_postcard
node_feed -->|"opens"| node_createpost
node_appcomponent -->|"uses"| node_topnav
node_appcomponent -->|"uses"| node_sidenav
node_feed -->|"shares data"| node_models
node_explore -->|"shares data"| node_models
node_notifications -->|"shares data"| node_models
node_postdetail -->|"shares data"| node_models
node_profile -->|"shares data"| node_models
node_adminusers -->|"shares data"| node_models
node_adminposts -->|"shares data"| node_models

click node_main "https://github.com/devmalu15/connectspherefrontend/blob/main/src/main.ts"
click node_appconfig "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.config.ts"
click node_approutes "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.routes.ts"
click node_appcomponent "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.component.ts"
click node_guards "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/guards/guards.ts"
click node_interceptor "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/interceptors/auth.interceptor.ts"
click node_api "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/api.services.ts"
click node_authsvc "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/auth.service.ts"
click node_themesvc "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/theme.service.ts"
click node_env "https://github.com/devmalu15/connectspherefrontend/blob/main/src/environments/environment.ts"
click node_landing "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/landing/landing.component.ts"
click node_auth "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/auth/auth.component.ts"
click node_feed "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/feed/feed.component.ts"
click node_explore "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/explore/explore.component.ts"
click node_notifications "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/notifications/notifications.component.ts"
click node_postdetail "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/post/post-detail.component.ts"
click node_profile "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/profile.component.ts"
click node_profilesettings "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/settings.component.ts"
click node_proredirect "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/profile-redirect.component.ts"
click node_adminroot "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin.component.ts"
click node_adminlogin "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-login.component.ts"
click node_adminusers "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-users.component.ts"
click node_adminposts "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-posts.component.ts"
click node_adminanalytics "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-analytics.component.ts"
click node_adminbroadcast "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-broadcast.component.ts"
click node_adminaudit "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-audit.component.ts"
click node_topnav "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/topnav.component.ts"
click node_sidenav "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/sidenav.component.ts"
click node_postcard "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/post-card.component.ts"
click node_createpost "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/create-post-modal.component.ts"
click node_models "https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/models/models.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_main,node_appconfig,node_approutes,node_appcomponent toneBlue
class node_guards,node_interceptor,node_api,node_authsvc,node_themesvc,node_env toneAmber
class node_landing,node_auth,node_feed,node_explore,node_notifications,node_postdetail,node_profile,node_profilesettings,node_proredirect toneMint
class node_adminroot,node_adminlogin,node_adminusers,node_adminposts,node_adminanalytics,node_adminbroadcast,node_adminaudit toneRose
class node_topnav,node_sidenav,node_postcard,node_createpost,node_models toneIndigo
```

## Components

### App bootstrap

Angular standalone app composition and route wiring

- [main.ts](https://github.com/devmalu15/connectspherefrontend/blob/main/src/main.ts): bootstrap · Angular entrypoint that bootstraps the standalone SPA · `src/main.ts`
- [app.config](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.config.ts): bootstrap config · Global providers and app-level configuration · `src/app/app.config.ts`
- [routes](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.routes.ts): routing · Primary route tree and feature boundaries · `src/app/app.routes.ts`
- [app shell](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/app.component.ts): root component · Top-level shell component hosting navigation and routed views · `src/app/app.component.ts`

### Core platform

Cross-cutting security, transport, and runtime services

- [route guards](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/guards/guards.ts): security guards · Auth, guest, and admin route protection rules · `src/app/core/guards/guards.ts`
- [auth interceptor](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/interceptors/auth.interceptor.ts): http boundary · Attaches credentials and handles unauthorized HTTP responses · `src/app/core/interceptors/auth.interceptor.ts`
- [API service](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/api.services.ts): backend client · Central HTTP service for gateway and admin API calls · `src/app/core/services/api.services.ts`
- [auth service](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/auth.service.ts): session service · Manages login, registration, token state, and session restoration · `src/app/core/services/auth.service.ts`
- [theme service](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/core/services/theme.service.ts): ui state · Persists light and dark theme preferences · `src/app/core/services/theme.service.ts`
- [environment](https://github.com/devmalu15/connectspherefrontend/blob/main/src/environments/environment.ts): runtime config · Backend endpoint configuration for local and deployed runtimes · `src/environments/environment.ts`

### User experience

Public and authenticated social app feature areas

- [landing](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/landing/landing.component.ts): public entry · Public entry page before authentication · `src/app/features/landing/landing.component.ts`
- [auth flow](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/auth/auth.component.ts): public auth · Login and registration journey · `src/app/features/auth/auth.component.ts`
- [feed](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/feed/feed.component.ts): timeline screen · Home timeline and primary social browsing view · `src/app/features/feed/feed.component.ts`
- [explore](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/explore/explore.component.ts): discovery screen · Search and browse content across the network · `src/app/features/explore/explore.component.ts`
- [notifications](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/notifications/notifications.component.ts): activity screen · Notification center for social activity · `src/app/features/notifications/notifications.component.ts`
- [post detail](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/post/post-detail.component.ts): content thread · Single post view with comments and thread context · `src/app/features/post/post-detail.component.ts`
- [profile](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/profile.component.ts): user profile · Profile viewing and user-specific content · `src/app/features/profile/profile.component.ts`
- [settings](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/settings.component.ts): account settings · Profile and account settings screen · `src/app/features/profile/settings.component.ts`
- [profile redirect](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/profile/profile-redirect.component.ts): route helper · Redirects profile routes to the appropriate profile view · `src/app/features/profile/profile-redirect.component.ts`

### Admin subsystem

Hidden privileged management area

- [admin panel](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin.component.ts): privileged shell · Hidden admin workspace for operational tasks · `src/app/features/admin/admin.component.ts`
- [admin login](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-login.component.ts): privileged auth · Separate authentication entry for the admin area · `src/app/features/admin/admin-login.component.ts`
- [users](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-users.component.ts): admin management · User management and moderation controls · `src/app/features/admin/admin-users.component.ts`
- [posts](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-posts.component.ts): admin moderation · Post oversight and content moderation view · `src/app/features/admin/admin-posts.component.ts`
- [analytics](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-analytics.component.ts): admin reporting · Operational metrics and dashboard insights · `src/app/features/admin/admin-analytics.component.ts`
- [broadcast](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-broadcast.component.ts): admin messaging · System-wide message and announcement tooling · `src/app/features/admin/admin-broadcast.component.ts`
- [audit log](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/features/admin/admin-audit.component.ts): admin audit · Audit trail and access history review · `src/app/features/admin/admin-audit.component.ts`

### Shared UI

Reusable visual primitives and data contracts

- [top nav](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/topnav.component.ts): shared chrome · Global header navigation shared across screens · `src/app/shared/components/topnav.component.ts`
- [side nav](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/sidenav.component.ts): shared chrome · Responsive navigation shell for the main app · `src/app/shared/components/sidenav.component.ts`
- [post card](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/post-card.component.ts): shared content · Reusable post rendering unit across feeds and profiles · `src/app/shared/components/post-card.component.ts`
- [create post](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/components/create-post-modal.component.ts): shared composer · Shared post composer entry point · `src/app/shared/components/create-post-modal.component.ts`
- [models](https://github.com/devmalu15/connectspherefrontend/blob/main/src/app/shared/models/models.ts): data contracts · Shared TypeScript interfaces and DTO shapes · `src/app/shared/models/models.ts`

## Connections

- main.ts → app.config: loads · Bootstrapping uses global providers and configuration
- main.ts → app shell: mounts · App entrypoint mounts the root shell
- app.config → route guards: registers · Provides route protection and app-level dependencies
- app.config → auth interceptor: registers · Adds the HTTP auth boundary to the client
- app.config → API service: provides · Makes the API service available app-wide
- app.config → auth service: provides · Makes auth/session state available app-wide
- app.config → theme service: provides · Makes theme persistence available app-wide
- app.config → environment: reads · Uses runtime endpoint configuration
- app shell → routes: hosts · Root shell renders route targets
- routes → landing: public route · Unauthenticated entry path
- routes → auth flow: public route · Login and registration flow
- routes → feed: protected route · Primary authenticated home view
- routes → explore: protected route · Authenticated discovery view
- routes → notifications: protected route · Authenticated activity center
- routes → post detail: protected route · Post and thread detail route
- routes → profile: protected route · Profile viewing route
- routes → settings: protected route · Settings route for authenticated users
- routes → admin panel: secret route · Hidden privileged admin workspace
- routes → route guards: protects with · Routes are gated by auth, guest, and admin guards
- auth flow → auth service: uses · Authentication screens delegate session work to the auth service
- feed → API service: uses · Timeline data comes through the API service
- explore → API service: uses · Discovery screens query backend content through the API service
- notifications → API service: uses · Notification data is fetched via the API service
- post detail → API service: uses · Post thread data and replies are loaded through the API service
- profile → API service: uses · Profile content and user data come from the API service
- settings → auth service: uses · Account settings rely on session and auth state
- admin panel → users: contains · Admin shell routes to management views
- admin panel → posts: contains · Admin shell routes to moderation views
- admin panel → analytics: contains · Admin shell routes to metrics views
- admin panel → broadcast: contains · Admin shell routes to messaging tools
- admin panel → audit log: contains · Admin shell routes to audit views
- admin login → auth service: uses · Separate admin sign-in likely reuses auth/session logic
- top nav → side nav: pairs with · Shared navigation shell spans desktop and mobile layouts
- feed → post card: renders · Feed uses the shared post unit
- explore → post card: renders · Discovery lists reuse the shared post unit
- profile → post card: renders · Profile views reuse the shared post unit
- post detail → post card: renders · Thread view reuses the shared post unit
- feed → create post: opens · Feed exposes the shared composer entry point
- app shell → top nav: uses · Root shell includes global header navigation
- app shell → side nav: uses · Root shell includes responsive navigation chrome
- feed → models: shares data · Feature views consume common DTO contracts
- explore → models: shares data · Feature views consume common DTO contracts
- notifications → models: shares data · Feature views consume common DTO contracts
- post detail → models: shares data · Feature views consume common DTO contracts
- profile → models: shares data · Feature views consume common DTO contracts
- users → models: shares data · Admin screens consume the shared DTO layer
- posts → models: shares data · Admin screens consume the shared DTO layer
