# uroobayaseen/step3 architecture

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

- Interactive diagram: https://gitdiagram.com/uroobayaseen/step3
- Repository: https://github.com/uroobayaseen/step3

## Overview

##### Project type and purpose
- This is a full‐stack, server‐rendered React application built with Next.js (using the new App Router).
- It’s a Rent-A-Car platform that lets customers browse cars (data from Sanity CMS), sign in (MongoDB), place orders (Stripe payments), and view an admin dashboard.

##### File structure
- Top-level “app” folder holds all front-end pages (app/page.tsx, app/Products, app/Car, etc.) plus API routes under app/api.
- “app/api” subfolders each represent a serverless endpoint (users/signin, users/checkout, getorder, forgetpassword, contactus).
- “app/models” and “app/lb” define data schemas and email‐templating logic (NodeMailer).
- “mycomponents” and “components” hold reusable UI pieces built with Tailwind CSS, ShadCN, and Sonner.
- “sanity” folder contains headless‐CMS configuration and schema types.
- Root includes next.config.mjs, Tailwind, PostCSS, TypeScript config.

##### Key insights from README
- Front end: Next.js + Tailwind + ShadCN + Sonner.
- Data & CMS: Sanity for car data and order records.
- Auth & user data: MongoDB.
- Payments: Stripe.
- Email notifications via custom NodeMailer templates.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Frontend Layer
    subgraph "Frontend (Next.js App Router)" 
        direction TB
        Client["Web Browser / Mobile"]:::external
        Products["Product Listing & Details"]:::frontend
        AddToCart["Shopping Cart & Checkout UI"]:::frontend
        AuthPages["Auth & Profile Pages"]:::frontend
        AdminDash["Admin Dashboard"]:::frontend
    end

    %% API Layer
    subgraph "Next.js API Layer (Serverless Functions)"
        direction TB
        SignIn["POST /api/users/signin"]:::backend
        SignInId["GET /api/users/signin/[id]"]:::backend
        Checkout["POST /api/users/checkout"]:::backend
        GetOrder["GET /api/getorder"]:::backend
        DltOrder["DELETE /api/getorder/[dlt]"]:::backend
        ForgetPass["POST /api/forgetpassward"]:::backend
        ContactUs["POST /api/users/contactus"]:::backend
        EnvVars[".env / Config"]:::backend
    end

    %% Datastores
    subgraph "Datastores"
        direction TB
        MongoDB["MongoDB (Users & Sessions)"]:::datastore
        Sanity["Sanity CMS (Cars & Orders)"]:::datastore
    end

    %% Email & Payment Services
    subgraph "External Services"
        direction TB
        Stripe["Stripe Payment Gateway"]:::external
        EmailService["SMTP / NodeMailer"]:::external
    end

    %% Configuration & Models
    subgraph "Config & Models"
        direction TB
        MongoModels["MongoDB Models"]:::backend
        SanityConfig["Sanity Config & Schemas"]:::backend
        EmailTemplates["Email Templates & Logic"]:::backend
        Utils["Utils & Hooks"]:::backend
        GlobalConfig["Global Styles & Next.js Config"]:::backend
    end

    %% Frontend details with click events
    Client -->|uses| Products
    Client -->|uses| AddToCart
    Client -->|uses| AuthPages
    Client -->|uses| AdminDash

    Products -->|"fetch() car data"| SignInId
    AddToCart -->|"POST /api/users/checkout"| Checkout
    AuthPages -->|"POST /api/users/signin"| SignIn
    AuthPages -->|"POST /api/forgetpassword"| ForgetPass
    AdminDash -->|"GET /api/getorder"| GetOrder

    %% API to Datastores
    SignIn -->|"query/write"| MongoDB
    SignInId -->|"query user"| MongoDB
    Checkout -->|"write order"| Sanity
    GetOrder -->|"read orders"| Sanity
    DltOrder -->|"delete order"| Sanity
    ForgetPass -->|"update"| MongoDB
    ContactUs -->|"n/a"| EmailService

    %% API to External
    Checkout -->|"Stripe charge"| Stripe
    Checkout -->|"send email"| EmailService

    %% Config & Models connections
    SignIn -->|uses| MongoModels
    SignInId -->|uses| MongoModels
    Checkout -->|uses| Utils
    Checkout -->|uses| EmailTemplates
    ForgetPass -->|uses| EmailTemplates
    ContactUs -->|uses| EmailTemplates
    SignIn -->|env| EnvVars
    Checkout -->|env| EnvVars
    GetOrder -->|env| EnvVars

    %% Config mappings
    MongoModels -->|file| MongoDB
    SanityConfig -->|cfg| Sanity
    EmailTemplates -->|logic| EmailService
    GlobalConfig -->|styles| Products

    %% Click events - Frontend
    click Products "https://github.com/uroobayaseen/step3/blob/main/app/Products/page.tsx"
    click AddToCart "https://github.com/uroobayaseen/step3/blob/main/app/Addtocart/page.tsx"
    click SignIn "https://github.com/uroobayaseen/step3/blob/main/app/signin/page.tsx"
    click AuthPages "https://github.com/uroobayaseen/step3/blob/main/app/forgetpassword/page.tsx"
    click AdminDash "https://github.com/uroobayaseen/step3/blob/main/app/adimdashboard/page.tsx"

    %% Click events - API
    click SignIn "https://github.com/uroobayaseen/step3/blob/main/app/api/users/signin/route.ts"
    click SignInId "https://github.com/uroobayaseen/step3/blob/main/app/api/users/signin/[id]/route.ts"
    click Checkout "https://github.com/uroobayaseen/step3/blob/main/app/api/users/checkout/route.ts"
    click GetOrder "https://github.com/uroobayaseen/step3/blob/main/app/api/getorder/route.ts"
    click DltOrder "https://github.com/uroobayaseen/step3/blob/main/app/api/getorder/[dlt]/route.ts"
    click ForgetPass "https://github.com/uroobayaseen/step3/blob/main/app/api/forgetpassward/route.ts"
    click ContactUs "https://github.com/uroobayaseen/step3/blob/main/app/api/users/contactus/route.ts"

    %% Click events - Models & Config
    click MongoModels "https://github.com/uroobayaseen/step3/blob/main/app/models/connectionstring.ts"
    click MongoModels "https://github.com/uroobayaseen/step3/blob/main/app/models/mongomethod.ts"
    click MongoModels "https://github.com/uroobayaseen/step3/blob/main/app/models/usersignin.ts"
    click SanityConfig "https://github.com/uroobayaseen/step3/blob/main/sanity.config.ts"
    click SanityConfig "https://github.com/uroobayaseen/step3/blob/main/sanity/lib/client.ts"
    click SanityConfig "https://github.com/uroobayaseen/step3/blob/main/sanity/schemaTypes/index.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/lb/ForgetEmale.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/lb/contactnodemiler.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/lb/contactnodehtml.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/models/sendEmail.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/models/generatenodelmailer.ts"
    click EmailTemplates "https://github.com/uroobayaseen/step3/blob/main/app/models/contactusEmail.ts"
    click GlobalConfig "https://github.com/uroobayaseen/step3/blob/main/app/globals.css"
    click GlobalConfig "https://github.com/uroobayaseen/step3/blob/main/tailwind.config.ts"
    click GlobalConfig "https://github.com/uroobayaseen/step3/blob/main/postcss.config.mjs"
    click GlobalConfig "https://github.com/uroobayaseen/step3/blob/main/next.config.mjs"
    click GlobalConfig "https://github.com/uroobayaseen/step3/blob/main/tsconfig.json"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef backend fill:#d4edda,stroke:#333,stroke-width:1px
    classDef datastore fill:#fff3cd,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px
```
