# fernandodeoliveira-dev/pizzashop-web architecture

> Architecture diagram of the GitHub repository fernandodeoliveira-dev/pizzashop-web, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fernandodeoliveira-dev/pizzashop-web
- Repository: https://github.com/fernandodeoliveira-dev/pizzashop-web

## Overview

##### Main System Components

a) Frontend Architecture (React Application)
- UI Layer (components directory)
- Page Layer (pages directory)
- API Integration Layer (api directory)
- State Management (lib/react-query.ts)

b) Mock Service Layer (for development/testing)
- API Mocks (src/api/mocks)

c) Authentication System
- Sign In/Sign Up flows
- Profile Management

##### Key Architectural Elements

Frontend Architecture:
**┌─────────────────────────────────────────────┐**
- UI Layer                    │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Shared    │ │  Theme   │ │   Core   │  │
- Components  │ │Components│ │   UI     │  │
- ┘ └──────────┘ └──────────┘  │
- ┤
- Pages Layer                    │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Dashboard  │ │  Orders  │ │   Auth   │  │
- ┘ └──────────┘ └──────────┘  │
- ┤
- API Layer                      │
- ┌─────────────┐ ┌──────────┐ ┌──────────┐  │
- Orders    │ │ Analytics│ │  Auth    │  │
- API       │ │   API    │ │   API    │  │
- ┘ └──────────┘ └──────────┘  │
- ┘

##### Data Flow Indicators

Key interactions:
- User Authentication Flow
- Order Management Flow
- Analytics Data Flow
- Profile Management Flow

##### Technical Stack Indicators

Technologies:
- React (Frontend Framework)
- TypeScript (Programming Language)
- Playwright (Testing Framework)
- Tailwind CSS (Styling)
- Vite (Build Tool)

##### Testing Architecture

A separate section showing:
- E2E Tests structure
- Mock Service Worker integration
- Test environment configuration

##### Detailed Component Relationships

Interactions:
**User Interface**
- ↓
**Layout Components (app.tsx, auth.tsx)**
- ↓
**Feature Components (dashboard, orders)**
- ↓
**API Integration Layer**
- ↓
**Mock/Real API Services**

##### Environment-Specific Configurations

Highlight:
- Development environment
- Testing environment
- Mock data environment

Key points to emphasize:
- The modular component structure
- The separation of concerns between UI, business logic, and data access
- The comprehensive testing strategy
- The mock service architecture for development and testing

This structure reflects a modern React application with a focus on maintainability, testability, and scalability, which are crucial for a restaurant management system.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[UI Layer]
        Pages[Pages Layer]
        API[API Integration Layer]
        State[State Management]
    end

    subgraph UIComponents
        SharedComps[Shared Components]
        ThemeComps[Theme Components]:::theme
        CoreUI[Core UI]:::ui
    end

    subgraph PageComponents
        Dashboard[Dashboard]:::page
        Orders[Orders Management]:::page
        Auth[Authentication Pages]:::page
    end

    subgraph APILayer
        OrdersAPI[Orders API]:::api
        AnalyticsAPI[Analytics API]:::api
        AuthAPI[Authentication API]:::api
        MockService[Mock Service Layer]:::mock
    end

    subgraph Testing
        E2ETests[E2E Tests]:::test
        MSW[Mock Service Worker]:::test
    end

    subgraph Analytics
        RevenueChart[Revenue Chart]:::analytics
        PopularProducts[Popular Products]:::analytics
    end

    UI --> UIComponents
    Pages --> PageComponents
    API --> APILayer
    
    Dashboard --> RevenueChart
    Dashboard --> PopularProducts
    
    OrdersAPI --> MockService
    AnalyticsAPI --> MockService
    AuthAPI --> MockService
    
    MSW --> MockService
    
    State --> API
    Pages --> API
    
    classDef ui fill:#2563eb
    classDef theme fill:#4338ca
    classDef page fill:#16a34a
    classDef api fill:#ea580c
    classDef mock fill:#737373
    classDef test fill:#a21caf
    classDef analytics fill:#0891b2

    click UI "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/components/ui"
    click ThemeComps "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/components/theme"
    click Pages "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/pages"
    click API "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/api"
    click MockService "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/api/mocks"
    click Auth "https://github.com/fernandodeoliveira-dev/pizzashop-web/tree/main/src/pages/auth"
    click Dashboard "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/src/pages/app/dashboard/dashboard.tsx"
    click Orders "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/src/pages/app/orders/orders.tsx"
    click State "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/src/lib/react-query.ts"
    click E2ETests "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/test/*.e2e-spec.ts"
    click MSW "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/public/mockServiceWorker.js"
    click RevenueChart "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/src/pages/app/dashboard/revenue-chart.tsx"
    click PopularProducts "https://github.com/fernandodeoliveira-dev/pizzashop-web/blob/main/src/pages/app/dashboard/popular-products-chart.tsx"

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Theme Components]:::theme
        L3[Pages]:::page
        L4[API Integration]:::api
        L5[Mock Services]:::mock
        L6[Testing]:::test
        L7[Analytics]:::analytics
    end
```
