# mohamedv0/angular-ecommerce architecture

> Architecture diagram of the GitHub repository mohamedv0/angular-ecommerce, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohamedv0/angular-ecommerce
- Repository: https://github.com/mohamedv0/angular-ecommerce

## Overview

##### Project type and purpose
- FreshCart is a full-stack e-commerce application, but the repository itself contains only the Angular frontend. It delivers a production-ready shopping experience—product catalog, cart, checkout, wishlist, user profile, theming, and i18n—all wired against a provided REST API (`https://ecommerce.routemisr.com/api/v1`).
- Key indicators: Angular 20 framework, PrimeNG UI library, Tailwind CSS styling, signal-based state management, ngx-translate for i18n, feature-based folder structure.

##### File structure
- Top-level:
- angular.json, tsconfig*.json, tailwind.config.js — build and tooling config
- public/i18n — runtime translation files
- src/app:
– core: constants, guards, interceptors, layout, models, services
– features: feature folders (auth, home, products, cart, checkout, wishlist, categories, brands, profile) each with routes.ts, services, models, components
– shared: reusable components, pipes, validators, utils
– theme: PrimeNG preset definitions
- src/environments — environment configs
- src/main.ts, app.ts, app.routes.ts — bootstrap and root routing

##### README for additional insights
- The README explicitly calls out:
- Feature-based architecture
- Lazy-loaded routes
- Signal-based state stores (@ngrx/signals)
- Comprehensive i18n (English & Arabic)
- Runtime theming with presets and dark/light mode
- External REST API as backend, no embedded server code

##### Final advice
- Don’t overcomplicate: capture modules, services, stores, data‐flow, and third-party integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Bootstrap & Root Routing
    Main["main.ts"]:::boot
    AppTS["app.ts"]:::boot
    Routes["app.routes.ts"]:::boot
    Main --> AppTS --> Routes --> AppModule

    AppModule["App Module"]:::module

    %% Core Module
    subgraph "Core Module"
        Constants["Constants"]:::core
        Guards["Guards"]:::core
        Interceptors["Interceptors"]:::core
        Layout["Layout"]:::core
        Models["Models"]:::core
        CoreServices["Services"]:::core
    end

    %% Shared Module
    subgraph "Shared Module"
        SharedComponents["Components"]:::shared
        SharedPipes["Pipes"]:::shared
        SharedValidators["Validators"]:::shared
        SharedUtils["Utils"]:::shared
    end

    %% Theme Module
    ThemeModule["Theme Module"]:::theme

    %% Feature Modules
    subgraph "Feature Modules"
        AuthModule["Auth Module"]:::feature
        HomeModule["Home Module"]:::feature
        ProductsModule["Products Module"]:::feature
        CartModule["Cart & Checkout"]:::feature
        WishlistModule["Wishlist Module"]:::feature
        CategoriesModule["Categories Module"]:::feature
        BrandsModule["Brands Module"]:::feature
        ProfileModule["Profile Module"]:::feature
    end

    %% Services & Stores
    CartSvc["Cart Service"]:::svc
    CheckoutSvc["Checkout Service"]:::svc
    WishlistSvc["Wishlist Service"]:::svc

    CartStore["Cart Store"]:::store
    WishlistStore["Wishlist Store"]:::store

    APIService["API Service"]:::svc
    I18nSvc["I18n Service"]:::svc
    StorageSvc["Storage Service"]:::svc
    ThemeSvc["Theme Service"]:::svc

    HTTPClient["HTTP Client"]:::infra
    LocalStorage["LocalStorage"]:::storage
    I18nFiles["I18n JSON"]:::storage
    RESTAPI["REST API"]:::external
    Stripe["Stripe Payment"]:::external

    %% Connections
    AppModule --> Constants
    AppModule --> Guards
    AppModule --> Interceptors
    AppModule --> Layout
    AppModule --> Models
    AppModule --> CoreServices

    AppModule --> SharedComponents
    AppModule --> SharedPipes
    AppModule --> SharedValidators
    AppModule --> SharedUtils

    AppModule --> ThemeModule

    AppModule -.-> AuthModule
    AppModule -.-> HomeModule
    AppModule -.-> ProductsModule
    AppModule -.-> CartModule
    AppModule -.-> WishlistModule
    AppModule -.-> CategoriesModule
    AppModule -.-> BrandsModule
    AppModule -.-> ProfileModule

    CartModule --> CartSvc
    CartModule --> CheckoutSvc
    WishlistModule --> WishlistSvc

    CartModule --> CartStore
    WishlistModule --> WishlistStore

    CartStore <--> LocalStorage
    WishlistStore <--> LocalStorage

    CoreServices --> APIService
    CoreServices --> I18nSvc
    CoreServices --> StorageSvc
    CoreServices --> ThemeSvc

    AuthModule --> APIService
    HomeModule --> APIService
    ProductsModule --> APIService
    CartSvc --> APIService
    WishlistSvc --> APIService
    CheckoutSvc --> APIService

    APIService --> HTTPClient
    HTTPClient --> RESTAPI

    CheckoutSvc --> Stripe

    StorageSvc --> LocalStorage
    ThemeSvc --> LocalStorage
    I18nSvc --> I18nFiles

    CartModule --> CartStore
    WishlistModule --> WishlistStore
    CartStore --> CartModule
    WishlistStore --> WishlistModule

    %% Click Events
    click Main "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/main.ts"
    click AppTS "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/app.ts"
    click Routes "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/app.routes.ts"
    click Constants "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/core/constants"
    click Guards "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/core/guards"
    click Interceptors "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/core/interceptors"
    click Layout "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/core/layout"
    click Models "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/core/models"
    click CoreServices "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/core/services/api.ts"
    click SharedComponents "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/shared/components"
    click SharedPipes "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/shared/pipes"
    click SharedValidators "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/shared/validators"
    click SharedUtils "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/shared/utils"
    click ThemeModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/theme"
    click AuthModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/auth"
    click HomeModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/home"
    click ProductsModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/products"
    click CartModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/cart"
    click WishlistModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/wishlist"
    click CategoriesModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/categories"
    click BrandsModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/brands"
    click ProfileModule "https://github.com/mohamedv0/angular-ecommerce/tree/main/src/app/features/profile"
    click CartSvc "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/features/cart/services/cart.service.ts"
    click CheckoutSvc "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/features/cart/services/checkout.service.ts"
    click WishlistSvc "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/features/wishlist/services/wishlist.ts"
    click CartStore "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/features/cart/store/cart.store.ts"
    click WishlistStore "https://github.com/mohamedv0/angular-ecommerce/blob/main/src/app/features/wishlist/store/wishlist.store.ts"
    click I18nFiles "https://github.com/mohamedv0/angular-ecommerce/tree/main/public/i18n"

    %% Styles
    classDef boot fill:#E3F2FD,stroke:#2196F3,color:#0D47A1;
    classDef module fill:#BBDEFB,stroke:#1976D2,color:#0D47A1;
    classDef core fill:#C8E6C9,stroke:#388E3C,color:#1B5E20;
    classDef shared fill:#FFF9C4,stroke:#FBC02D,color:#F57F17;
    classDef theme fill:#D1C4E9,stroke:#7B1FA2,color:#4A148C;
    classDef feature fill:#FFE0B2,stroke:#F57C00,color:#E65100;
    classDef svc fill:#B3E5FC,stroke:#0288D1,color:#01579B;
    classDef store fill:#FFCCBC,stroke:#E64A19,color:#BF360C;
    classDef infra fill:#CFD8DC,stroke:#607D8B,color:#37474F;
    classDef storage fill:#DCEDC8,stroke:#689F38,color:#33691E;
    classDef external fill:#F8BBD0,stroke:#C2185B,color:#880E4F;
```
