# nttung2k3k/pregnancy-growth-tracking-system-react-typescript architecture

> Architecture diagram of the GitHub repository nttung2k3k/pregnancy-growth-tracking-system-react-typescript, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript
- Repository: https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript

## Overview

##### Main Components
- Frontend Client: Represents the React (TypeScript) application. Highlight key subcomponents such as:
- UI components (in “src/components” and “src/components/ui”), which include reusable UI elements (buttons, dialogs, table components, etc.).
- Containers (in “src/containers”), which represent larger business features (Blog, Appointment, Children, Growth Charts, etc.).
- Layouts (in “src/layouts”), which provide structure for the Main and Dashboard interfaces.
- Redux & Modules: Illustrate state management (Redux store, reducers, sagas under “src/redux” and “src/modules/Auth”) that coordinate application state and side effects.
- Utilities & Libs: “src/lib” and hooks used across the app.

- Backend Services:
- .NET API Server: Although not present in the file tree, include it as it is key according to the README. Represent endpoints for handling business logic, authentication, membership management, appointment scheduling, etc.
- API Gateway Layer: If applicable, it can serve as the intermediary between the frontend and backend.

- Database:
- MS SQL Database: Mention that all persistent data (user profiles, growth metrics, appointments, payments, membership packages) reside here.

- Authentication & Payment Integrations:
- Authentication Service: Represent how JWT and OAuth are used for authenticating users.
- Payment Service: Represent VNPAY integration for processing membership and subscription fees.

- Hosting & External Platforms:
- Frontend Hosting: Vercel is used to deploy the React app.
- Backend & Additional Services: Firebase may be used for hosting or additional backend capabilities.

##### Relationships and Interactions
- Communication between Redux (in the frontend) and the API layer (using actions and sagas).
- How the Payment component in the frontend communicates with the VNPAY integration (ex: an API call to the payment service).
- That the backend communicates with the MS SQL database for persistent storage.

##### Architectural Patterns and Design Principles
- Component-Based Structure: Emphasize that the frontend is built using modular React components and containers.
- Separation of Concerns: Distinguish clearly between UI components, business logic (handled mainly via Redux and API calls), and layout management.
- API Driven Development: Show that the frontend likely consumes RESTful API endpoints from the backend.
- Scalability: Highlight the use of dashboard modules and the separation into different containers for core features (appointments, blogs, growth tracking, etc.) which suggests a modular scalable design.

##### Relevant Technologies/Frameworks
- For the Frontend: React, TypeScript, Vite, Redux, and possibly Tailwind CSS (as indicated by tailwind.config.js).
- For the Backend: .NET (Web API), JWT & OAuth libraries and possibly MS SQL client libraries.
- For Integrations: VNPAY for payment processing and Firebase for hosting/notifications.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Client Subgraph
    subgraph "Frontend Client"
        Frontend["React Frontend"]:::frontend
        subgraph "UI Layer"
            Components["Components"]:::ui
            UIElements["UI Elements"]:::ui
            AuthForm["Auth Form"]:::ui
            LoginForm["Login Form"]:::ui
        end
        subgraph "Containers"
            Containers["Containers"]:::container
            PaymentCtr["Membership Payment"]:::container
        end
        subgraph "Layouts"
            MainLayout["Main Layout"]:::layout
            DashboardLayout["Dashboard Layout"]:::layout
        end
        subgraph "State Management"
            Redux["Redux Store"]:::state
            AuthModule["Auth Module"]:::state
        end
        subgraph "Utilities"
            Libs["Libs"]:::utility
            Hooks["Hooks"]:::utility
        end
        subgraph "API Layer"
            APIServices["API Services"]:::api
        end
    end

    %% Backend Services Subgraph
    subgraph "Backend Services"
        DotNet[".NET API Server"]:::backend
        AuthService["Authentication Service"]:::backend
        PaymentGateway["Payment Gateway (VNPAY)"]:::backend
        Database["MS SQL Database"]:::database
    end

    %% Hosting & External Platforms Subgraph
    subgraph "Hosting & External Platforms"
        Vercel["Vercel"]:::external
        Firebase["Firebase"]:::external
    end

    %% Connections within Frontend
    Frontend -->|"API_Call"| APIServices
    Redux -->|"State_Update"| APIServices

    %% Frontend to Backend Interactions
    APIServices -->|"API_Call"| DotNet
    AuthForm -->|"Auth_Request"| AuthService
    LoginForm -->|"Auth_Request"| AuthService
    AuthModule -->|"Auth_Process"| AuthService
    PaymentCtr -->|"Payment_Process"| PaymentGateway

    %% Backend to Database
    DotNet -->|"DB_Access"| Database

    %% External Hosting Connections
    Vercel ---|"Hosted_on"| Frontend
    DotNet ---|"Integrates_with"| Firebase

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef ui fill:#E0FFFF,stroke:#000,stroke-width:1px;
    classDef container fill:#FFDAB9,stroke:#000,stroke-width:1px;
    classDef layout fill:#FFE4E1,stroke:#000,stroke-width:1px;
    classDef state fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef utility fill:#FFFACD,stroke:#000,stroke-width:1px;
    classDef api fill:#D3D3D3,stroke:#000,stroke-width:1px;
    classDef backend fill:#F08080,stroke:#000,stroke-width:1px;
    classDef database fill:#FAFAD2,stroke:#000,stroke-width:1px;
    classDef external fill:#D8BFD8,stroke:#000,stroke-width:1px;

    %% Click Events
    click Frontend "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src"
    click Components "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/components"
    click UIElements "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/components/ui"
    click Containers "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/containers"
    click MainLayout "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/blob/main/src/layouts/Main/index.tsx"
    click DashboardLayout "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/blob/main/src/layouts/Dashboard/index.tsx"
    click Redux "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/redux"
    click AuthModule "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/modules/Auth"
    click Libs "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/lib"
    click Hooks "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/hooks"
    click PaymentCtr "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/containers/Membership"
    click APIServices "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/tree/main/src/routes/api/services"
    click AuthForm "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/blob/main/src/components/AuthForm.tsx"
    click LoginForm "https://github.com/nttung2k3k/pregnancy-growth-tracking-system-react-typescript/blob/main/src/components/LoginForm.tsx"
```
