# mryenagandula/dailycoding-app architecture

> Architecture diagram of the GitHub repository mryenagandula/dailycoding-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mryenagandula/dailycoding-app
- Repository: https://github.com/mryenagandula/dailycoding-app

## Overview

##### Project type and purpose
- Project type: Single-Page Application (SPA) built with Angular 9, served via a lightweight Node.js/Express server (server.js).
- Purpose: A public-facing, content-driven site (blogs, products, user profiles, audits) with authentication, authorization (guards/directives), and RESTful integrations.

##### File structure
- Top level:
– package.json, Angular CLI configs (angular.json, tsconfig.json), server.js (Express host)
– e2e/ (Protractor end-to-end tests)
– src/ (application source)
- src/app:
– app.module.ts & routing module: root module & route definitions
– auth/ (AuthModule, authentication service, guards)
– components/ (all UI features grouped by domain: blogs, audits, users, shared header/footer, etc.)
– services/ (RESTful service wrappers: blogService, usersService, auditsService…)
– interceptors/ (HTTP interceptor for error handling & token injection)
– directives/ (role-based view control)
– guard/ (route guards: auth guard, admin guard)
– resources.ts (constants, API URLs)
- src/environments: environment.ts & environment.prod.ts for API endpoints & build-time variables.

##### README for architecture hints
- Confirms Angular CLI usage, dev server (ng serve), build artifacts (dist/).

##### Main architectural components
a. Client Side (Browser)
– Angular SPA (AppModule)
– Feature Modules (AuthModule, SharedModules if any)
– Components (UI blocks: blogs, audits, header, profile, etc.)
– Services (HTTP clients to external API)
– Interceptors (attach JWT, handle errors)
– Guards & Directives (route protection, admin UX control)
b. Server Side
– Node.js/Express (server.js)
– Serves static files from /dist (production) or proxies API calls in dev
c. External Services
– RESTful back-end API (authentication, blog data, user management, audits)
– Third-party services (e.g., analytics, CDN, auth provider) if applicable
d. Data Store (outside project scope)
– Likely a database behind the external API (MySQL, MongoDB, etc.)

##### Relationships & data flow
- Browser → HTTP requests → Node.js server (static asset fetch)
- Browser (Angular app) → HTTP calls via HttpClient → External REST API
- HttpInterceptor: intercept outbound requests to insert JWT → inbound responses to centralize error handling
- Router & Guards: intercept navigation events → allow/deny based on auth state
- Components ↔ Services: components consume observables returned by services → bind to UI

##### Architectural patterns
- Component-Based Architecture (separation of UI into reusable components)
- Module Separation (AppModule vs. AuthModule vs. Feature Components)
- MVVM-style data binding (Angular’s two-way binding)
- Layered architecture: UI layer (components), service layer (business logic & API calls), infrastructure layer (interceptors, environment)
- Routing Module (declarative navigation, lazy loading if added)
- Dependency Injection (services & interceptors injected into components)

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Browser"
        subgraph "Angular SPA"
            AppModule["AppModule"]:::frontend
            AppComponent["AppComponent"]:::frontend
            AppRouting["AppRoutingModule"]:::frontend
            subgraph "Authentication"
                AuthModule["AuthModule"]:::frontend
                AuthService["AuthenticationService"]:::service
            end
            subgraph "Components"
                Header["HeaderComponent"]:::frontend
                Home["HomeComponent"]:::frontend
                Blogs["BlogsComponent"]:::frontend
                BlogList["BlogListComponent"]:::frontend
                BlogDetails["BlogDetailsComponent"]:::frontend
                Audits["AuditsComponent"]:::frontend
                Users["UsersComponent"]:::frontend
                Profile["ProfileComponent"]:::frontend
                ContactUs["ContactUsComponent"]:::frontend
                AboutUs["AboutUsComponent"]:::frontend
            end
            subgraph "Services"
                BlogService["BlogService"]:::service
                UsersService["UsersService"]:::service
                AuditsService["AuditsService"]:::service
                ProfileService["ProfileService"]:::service
                CategoriesTagsService["CategoriesAndTagsService"]:::service
            end
            subgraph "Interceptors"
                TokenInterceptor["HttpInterceptor"]:::service
                ErrorInterceptor["ErrorInterceptor"]:::service
            end
            subgraph "Guards & Directives"
                AuthGuard["AuthGuard"]:::service
                AdminGuard["AdminGuard"]:::service
                AdminDirective["AdminDirective"]:::service
            end
            Resources["Resources (API URLs)"]:::service
            MainTS["main.ts"]:::frontend
            IndexHTML["index.html"]:::frontend
        end
    end

    NodeServer["Node.js/Express (server.js)"]:::server
    API["External REST API"]:::external

    %% Data Flow
    AppComponent -->|bootstrap| AppModule
    AppModule --> AppRouting
    AppRouting -->|navigates| AuthGuard
    AppRouting -->|navigates| AdminGuard
    AuthGuard -.-> Components
    AdminGuard -.-> Components
    Components -->|uses| Services
    Services -->|HTTP calls| API
    Services -->|intercepted by| TokenInterceptor
    Services -->|errors handled by| ErrorInterceptor
    AppModule --> AuthModule
    AuthModule --> AuthService
    AppComponent -->|loads| Header
    AppComponent -->|loads| Home
    AppComponent -->|loads| FooterComponent[FooterComponent]:::frontend

    Browser -->|serves static files| NodeServer
    Browser -->|API requests| API

    %% Click Events
    click AppModule "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/app.module.ts"
    click AppComponent "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/app.component.ts"
    click AppRouting "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/app-routing.module.ts"
    click AuthModule "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/auth/auth/auth.module.ts"
    click AuthService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/auth/authentication.service.ts"
    click Blogs "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/blogs/blogs.component.ts"
    click BlogList "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/blog-list/blog-list.component.ts"
    click BlogDetails "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/blog-details/blog-details.component.ts"
    click Audits "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/audits/audits.component.ts"
    click Users "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/users/users.component.ts"
    click Header "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/header/header.component.ts"
    click Home "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/home/home.component.ts"
    click ContactUs "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/contactus/contactus.component.ts"
    click AboutUs "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/aboutus/aboutus.component.ts"
    click Profile "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/components/profile/profile.component.ts"
    click BlogService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/services/blog.service.ts"
    click UsersService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/services/users.service.ts"
    click AuditsService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/services/audits.service.ts"
    click ProfileService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/services/profile.service.ts"
    click CategoriesTagsService "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/services/categories-and-tags.service.ts"
    click TokenInterceptor "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/interceptors/httpinterceptor.interceptor.ts"
    click ErrorInterceptor "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/interceptors/error.interceptor.ts"
    click AuthGuard "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/guard/auth/authguard.guard.ts"
    click AdminGuard "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/guard/admin/admin.guard.ts"
    click AdminDirective "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/directives/admin-directive.directive.ts"
    click Resources "https://github.com/mryenagandula/dailycoding-app/blob/main/src/app/resources/resources.ts"
    click MainTS "https://github.com/mryenagandula/dailycoding-app/blob/main/src/main.ts"
    click IndexHTML "https://github.com/mryenagandula/dailycoding-app/blob/main/src/index.html"
    click NodeServer "https://github.com/mryenagandula/dailycoding-app/blob/main/server.js"

    classDef frontend fill:#D0E6FF,stroke:#0366d6
    classDef service fill:#DFFFE0,stroke:#2d8f2d
    classDef server fill:#FFE0B2,stroke:#e65100
    classDef external fill:#E0E0E0,stroke:#616161
```
