# mohaiminul375/next-form-pilot architecture

> Architecture diagram of the GitHub repository mohaiminul375/next-form-pilot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mohaiminul375/next-form-pilot
- Repository: https://github.com/mohaiminul375/next-form-pilot

## Overview

##### Main Components
- Frontend UI: Represented by the Next.js pages (e.g., src/app/all-validation, src/app/validate-form) along with shared UI components (e.g., Navbar, Footer, button, input, label, progress indicators) found in src/components and src/components/ui.
- API Endpoints: API routes in the project (e.g., src/app/all-validation/api/route.ts and src/app/validate-form/api/rote.ts) handle form submission, data validation and communication with the backend services.
- Utility & Library Functions: Utility functions (e.g., src/lib/utils.ts) and shared business logic that support operations across the app.
- External Services and Data Store: Although not visible as a local directory, the README indicates that form data is submitted via an API call (using tanstack query and axios) to save data in a database. Represent this external data store as a separate component.
- Third-party Libraries/Frameworks: Note the integration of libraries such as React, Typescript, Zod (for validation), React Hook Form (for form management), Tanstack Query (for state management/data fetching), axios (for API calls), Tailwind CSS and Shadcn UI (for styling and UI components) – these should be called out as supporting technologies.

##### Relationships and Data Flow
- From the “Next.js Frontend” to the “API Endpoints” to denote data submission.
- From the “API Endpoints” to the “Database/External Services” for persistent storage.

##### Architectural Patterns/Design Principles
- Frontend UI, API layer, and Data Storage are distinctly separated.
- “serverless” API endpoints (Next.js Route Handlers) if applicable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Next.js Frontend Subgraph
    subgraph "Next.js Frontend"
        %% Pages Subgraph
        subgraph "Pages"
            AllValidationPage["Multi-Step Form (All Validation)"]:::frontend
            ValidateFormPage["Multi-Step Form (Validate Form)"]:::frontend
            SummaryPage["Summary/Review Page"]:::frontend
        end
        %% Shared Layout Subgraph
        subgraph "Shared Layout"
            GlobalsCSS["globals.css"]:::frontend
            Layout["layout.tsx"]:::frontend
            Loading["loading.tsx"]:::frontend
            NotFound["not-found.tsx"]:::frontend
        end
        %% UI Components Subgraph
        subgraph "UI Components"
            subgraph "Shared Components"
                Navbar["Navbar"]:::ui
                Footer["Footer"]:::ui
            end
            subgraph "UI Elements"
                Button["Button"]:::ui
                Input["Input"]:::ui
                Label["Label"]:::ui
                Progress["Progress"]:::ui
            end
        end
    end

    %% API Endpoints Subgraph
    subgraph "API Endpoints"
        AllValidationAPI["API (All-Validation)"]:::api
        ValidateFormAPI["API (Validate-Form)"]:::api
    end

    %% Utility Functions Subgraph
    subgraph "Utility Functions"
        Utils["Utility Functions"]:::util
    end

    %% External Services / Data Store
    ExternalDB["Database / External Services"]:::external

    %% Third-Party Technologies
    ThirdParty["Third-Party Technologies: React, TS, Zod, ReactHookForm, TanstackQuery, axios, TailwindCSS, ShadcnUI"]:::tech

    %% Relationships and Data Flow
    AllValidationPage -->|"FormSubmission"| AllValidationAPI
    ValidateFormPage -->|"FormSubmission"| ValidateFormAPI

    AllValidationAPI -->|"axios/TanstackQuery"| ExternalDB
    ValidateFormAPI -->|"axios/TanstackQuery"| ExternalDB

    Navbar -->|"UsesSharedLogic"| Utils
    Footer -->|"UsesSharedLogic"| Utils
    Button -->|"UsesSharedLogic"| Utils
    Input -->|"UsesSharedLogic"| Utils
    Label -->|"UsesSharedLogic"| Utils
    Progress -->|"UsesSharedLogic"| Utils

    ThirdParty -->|"PoweredBy"| AllValidationPage

    %% Styles for Diagram Components
    classDef frontend fill:#a0d8f1,stroke:#333,stroke-width:2px;
    classDef ui fill:#fadbd8,stroke:#333,stroke-width:2px;
    classDef api fill:#f9e79f,stroke:#333,stroke-width:2px;
    classDef external fill:#f5b7b1,stroke:#333,stroke-width:2px;
    classDef util fill:#d5f5e3,stroke:#333,stroke-width:2px;
    classDef tech fill:#e8daef,stroke:#333,stroke-width:2px;

    %% Click Events for Component Mapping
    click AllValidationPage "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/all-validation/page.tsx"
    click ValidateFormPage "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/validate-form/page.tsx"
    click SummaryPage "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/page.tsx"
    click GlobalsCSS "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/globals.css"
    click Layout "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/layout.tsx"
    click Loading "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/loading.tsx"
    click NotFound "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/not-found.tsx"
    click Navbar "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/Shared/Navbar.tsx"
    click Footer "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/Shared/Footer.tsx"
    click Button "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/ui/button.tsx"
    click Input "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/ui/input.tsx"
    click Label "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/ui/label.tsx"
    click Progress "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/components/ui/progress.tsx"
    click AllValidationAPI "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/all-validation/api/route.ts"
    click ValidateFormAPI "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/app/validate-form/api/rote.ts"
    click Utils "https://github.com/mohaiminul375/next-form-pilot/blob/main/src/lib/utils.ts"
```
