# georgezq/fb-clone architecture

> Architecture diagram of the GitHub repository georgezq/fb-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/georgezq/fb-clone
- Repository: https://github.com/georgezq/fb-clone

## Overview

- Frontend (Angular Application)
- Components: List every major UI module:
- Auth Module (login, register, forgot password)
- Home, Navbar, Profile Sidebar
- Social Features: Chat, Historias (stories), Publicaciones (posts)
- Core: Directives, pipes, guards, and other utility functions.
- Shared/Reusable Services and Models: Auth Service, Chat Service, Histories Service, Publication Service, Storage Service, User Service, and associated models.
- External Services:
- Firebase: Authentication, Firestore (for real-time data storage), and Storage (for images and media).
- Supporting Libraries/Styling:
- Tailwind CSS, Flowbite, and HeroIcons to denote UI styling and component libraries.

##### Relationships and interactions between components
- UI Components interact with Angular services to exchange data and actions.
- Authentication and Guards ensure that access to protected routes is enforced.
- Core functionalities (like form validators, custom directives, and pipes) underlie many of the components, so indicate these as shared utilities used by several modules.

##### Architectural patterns and design principles
- MVC/MVVM Approach: Clearly separate the view (components), business logic (services), and model (interfaces and classes).
- Modularity: Each feature (chat, historias, publicaciones) is encapsulated in its own submodule with corresponding components.
- Dependency Injection: Angular services are injected into components to maintain separation of concerns.
- External Integration: Firebase acts as an external dependency that the services connect to.

##### Relevant technologies, frameworks, and integrations
- Angular 16 as the main framework.
- Firebase for its backend as a service.
- Tailwind CSS and Flowbite for the styling; annotate that these provide the visual design system.
- TypeScript for all scripting, as evident in the tsconfig files.
- That angular.json, firebase.json, and tailwind.config.js define build and deployment settings.

- Clearly separate the frontend (all Angular components, services, and modules) from the external backend (Firebase).
- How data flows from user interactions in UI components (login forms, chat windows, story creators) into Angular services and eventually to Firebase.
- Dependencies between components (e.g., the Navigation bar may depend on user data provided by the User Service).
- How core utilities (directives, guards, pipes) feed into various parts of the application.

##### Detail-oriented assembly
- Branch out into “Feature Modules” (Auth, Chat, Historias, Publicaciones) with their subcomponents.
- “Services” layer to each feature module to indicate dependency injection.
- “Styling and UI Libraries” as a side note to show that Tailwind, Flowbite, and HeroIcons distinctly influence UI development, though they may not interact directly with the backend data flow.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Angular Frontend Application
    subgraph "Angular Frontend Application"
        direction TB
        AngularApp["Angular Application"]
        %% UI Components
        subgraph "UI Components"
            direction TB
            AuthModule["Auth Module"]
            Home["Home Component"]
            Navbar["Navigation Bar"]
            ProfileSidebar["Profile Sidebar"]
            Chat["Chat Module"]
            Historias["Historias Module"]
            Publicaciones["Publicaciones Module"]
        end
        %% Core Utilities
        subgraph "Core Utilities"
            direction TB
            Core["Core Utilities (Directives, Pipes, Guards, Validators)"]
        end
        %% Shared Services and Models
        subgraph "Shared Services & Models"
            direction TB
            Services["Shared Services"]
            Models["Data Models"]
        end
        %% Auth Module Details
        subgraph "Auth Module Details"
            direction TB
            Login["Login Component"]
            Register["Register Component"]
            ForgotPassword["Forgot Password Component"]
        end
    end

    %% External Services
    subgraph "External Services"
        direction TB
        Firebase["Firebase (Auth, Firestore, Storage)"]
    end

    %% Styling & UI Libraries
    subgraph "Styling & UI Libraries"
        direction TB
        Tailwind["Tailwind CSS"]
        Flowbite["Flowbite"]
        HeroIcons["HeroIcons"]
    end

    %% Connections between Angular layers
    AngularApp -->|"contains"| AuthModule
    AngularApp -->|"contains"| Home
    AngularApp -->|"contains"| Navbar
    AngularApp -->|"contains"| ProfileSidebar
    AngularApp -->|"contains"| Chat
    AngularApp -->|"contains"| Historias
    AngularApp -->|"contains"| Publicaciones
    AngularApp -->|"includes"| Core
    AngularApp -->|"includes"| Services
    AngularApp -->|"includes"| Models

    %% Auth Module composition
    AuthModule ---|"composed of"| Login
    AuthModule ---|"composed of"| Register
    AuthModule ---|"composed of"| ForgotPassword

    %% UI Component interactions with Shared Services
    AuthModule -->|"uses"| Services
    Home -->|"uses"| Services
    Navbar -->|"uses"| Services
    ProfileSidebar -->|"uses"| Services
    Chat -->|"uses"| Services
    Historias -->|"uses"| Services
    Publicaciones -->|"uses"| Services

    %% Core utilities providing functionality
    Core -->|"supports"| AuthModule
    Core -->|"supports"| Home
    Core -->|"supports"| Chat
    Core -->|"supports"| Historias
    Core -->|"supports"| Publicaciones

    %% Shared Services connecting to Firebase
    Services -->|"callsAPI"| Firebase

    %% UI Components using Styling & UI Libraries
    AuthModule --- Tailwind
    Home --- Tailwind
    Navbar --- Tailwind
    ProfileSidebar --- Tailwind
    Chat --- Tailwind
    Historias --- Tailwind
    Publicaciones --- Tailwind

    Tailwind --> Flowbite
    Tailwind --> HeroIcons

    %% Click Events for Component Mapping
    click AngularApp "https://github.com/georgezq/fb-clone/tree/master/src/app"
    click Login "https://github.com/georgezq/fb-clone/tree/master/src/app/auth/login-component"
    click Register "https://github.com/georgezq/fb-clone/tree/master/src/app/auth/register-component"
    click ForgotPassword "https://github.com/georgezq/fb-clone/tree/master/src/app/auth/forgot-passwd"
    click Home "https://github.com/georgezq/fb-clone/tree/master/src/app/components/home"
    click Navbar "https://github.com/georgezq/fb-clone/tree/master/src/app/components/navbar"
    click ProfileSidebar "https://github.com/georgezq/fb-clone/tree/master/src/app/components/profile-sidebar/sidebar"
    click Chat "https://github.com/georgezq/fb-clone/tree/master/src/app/components/chat"
    click Historias "https://github.com/georgezq/fb-clone/tree/master/src/app/components/historias"
    click Publicaciones "https://github.com/georgezq/fb-clone/tree/master/src/app/components/publicaciones"
    click Core "https://github.com/georgezq/fb-clone/tree/master/src/app/core"
    click Services "https://github.com/georgezq/fb-clone/tree/master/src/app/services"
    click Models "https://github.com/georgezq/fb-clone/tree/master/src/app/models"
    click Firebase "https://github.com/georgezq/fb-clone/blob/master/firebase.json"
    click Tailwind "https://github.com/georgezq/fb-clone/blob/master/tailwind.config.js"
    click Flowbite "https://github.com/georgezq/fb-clone/tree/master/src/assets/icons/nav-icons"
    click HeroIcons "https://github.com/georgezq/fb-clone/tree/master/src/assets/icons/profile-icons"

    %% Styling definitions for better visual clarity
    classDef uiComponents fill:#bbdefb,stroke:#0d47a1,stroke-width:2px,color:#0d47a1;
    classDef coreUtilities fill:#c8e6c9,stroke:#2e7d32,stroke-width:2px,color:#2e7d32;
    classDef services fill:#ffe082,stroke:#ff6f00,stroke-width:2px,color:#ff6f00;
    classDef external fill:#f8bbd0,stroke:#c2185b,stroke-width:2px,color:#c2185b;
    classDef styling fill:#d1c4e9,stroke:#512da8,stroke-width:2px,color:#512da8;

    class Home,Navbar,ProfileSidebar,Chat,Historias,Publicaciones,AuthModule,Login,Register,ForgotPassword uiComponents;
    class Core coreUtilities;
    class Services,Models services;
    class Firebase external;
    class Tailwind,Flowbite,HeroIcons styling;
```
