# varun122646/green-poly-source-webfront architecture

> Architecture diagram of the GitHub repository varun122646/green-poly-source-webfront, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/varun122646/green-poly-source-webfront
- Repository: https://github.com/varun122646/green-poly-source-webfront

## Overview

#### Purpose and Runtime

This is a Next.js TypeScript site with a small marketing/informational surface and a contact-email backend. It uses both the App Router for rendered pages and the legacy Pages API route mechanism for form submission. Node.js hosts server-side API/email execution; browser code renders the UI.

Key entry points:
- `app/layout.tsx`
- `app/page.tsx`
- `pages/api/contact.ts`

#### Application Shell and Route Composition

The App Router provides the site’s global document/layout boundary and route-level pages. The root page is the main landing experience, while About and Contact are independently routed pages.

- `app/layout.tsx`
- `app/page.tsx`
- `app/about/page.tsx`
- `app/contact/page.tsx`

Global styling is applied through the App Router stylesheet, with an additional legacy/global styles location present.

- `app/globals.css`
- `styles/globals.css`

#### Shared Site Navigation and Theme Boundary

Shared navigation and footer components define persistent site chrome, likely composed by the root layout or individual pages. Theme state/provider is a client-side presentation boundary around the application, supporting consistent visual mode behavior.

- `components/navigation.tsx`
- `components/footer.tsx`
- `components/theme-provider.tsx`

#### Contact Submission Flow

The contact page is the browser-side input boundary. Submissions are sent to the server API endpoint, which is the primary trust boundary: it receives request data, validates/handles it, and delegates outbound email delivery to the Nodemailer integration.

Flow: `app/contact/page.tsx` → `pages/api/contact.ts` → `lib/nodemailer.ts` → configured SMTP/email service.

- `app/contact/page.tsx`
- `pages/api/contact.ts`
- `lib/nodemailer.ts`

The email provider/SMTP server is external infrastructure; credentials and transport settings are expected to be supplied through server runtime configuration/environment rather than exposed to the client.

#### UI Component System

The UI layer is built from a local reusable component library, consistent with shadcn/Radix-style primitives. Pages and shared shell components consume these primitives rather than embedding all controls directly. This separates product page composition from accessible interaction implementations.

Representative central primitives:
- `components/ui/button.tsx`
- `components/ui/form.tsx`
- `components/ui/input.tsx`
- `components/ui/toaster.tsx`

Supporting responsive behavior and toast state are implemented as reusable hooks.

- `hooks/use-mobile.tsx`
- `hooks/use-toast.ts`
- `components/ui/use-toast.ts`

#### Styling and Design Infrastructure

Tailwind is the main styling/build-time design system, configured alongside PostCSS. Component-generation conventions are captured in the component configuration file. Utility-class composition is centralized in `lib/utils.ts`.

- `tailwind.config.js`
- `postcss.config.mjs`
- `components.json`
- `lib/utils.ts`

#### Architectural Constraints

The repository mixes Next.js routing models intentionally or historically: UI routes live under `app/`, while the only backend endpoint lives under `pages/api/`. Changes to contact handling should preserve this client/server separation and keep SMTP logic in `lib/nodemailer.ts`, not page components. There is no evidence of a database, authentication system, queue, or separate service deployment; email delivery is the material external dependency.

Main entry points: [`app/layout.tsx`](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/layout.tsx) (Root layout), [`app/contact/page.tsx`](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/contact/page.tsx) (Contact page), [`components/ui/form.tsx`](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/form.tsx) (UI primitives), [`pages/api/contact.ts`](https://github.com/varun122646/green-poly-source-webfront/blob/main/pages/api/contact.ts) (Contact API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Browser UI"]
  node_root_layout["Root layout<br/>App Router layout<br/>[layout.tsx]"]
  node_landing_page["Landing page<br/>App Router page<br/>[page.tsx]"]
  node_about_page["About page<br/>App Router page<br/>[page.tsx]"]
  node_contact_page["Contact page<br/>App Router page<br/>[page.tsx]"]
  node_navigation["Navigation<br/>shared component<br/>[navigation.tsx]"]
  node_footer["Footer<br/>shared component<br/>[footer.tsx]"]
  node_theme_provider["Theme provider<br/>client presentation provider<br/>[theme-provider.tsx]"]
end

subgraph group_server["Server Email Flow"]
  node_contact_api{{"Contact API<br/>Pages API route<br/>[contact.ts]"}}
  node_mailer["Nodemailer integration<br/>email adapter<br/>[nodemailer.ts]"]
end

subgraph group_design["Design Infrastructure"]
  node_ui_primitives["UI primitives<br/>component library<br/>[form.tsx]"]
  node_button["Button primitive<br/>UI primitive<br/>[button.tsx]"]
  node_input["Input primitive<br/>UI primitive<br/>[input.tsx]"]
  node_toast["Toast system<br/>UI feedback<br/>[toaster.tsx]"]
  node_toast_hook["Toast state hook<br/>client hook<br/>[use-toast.ts]"]
  node_styles["Global styles<br/>stylesheet<br/>[globals.css]"]
  node_tailwind["Tailwind design system<br/>build-time styling<br/>[tailwind.config.js]"]
  node_class_utils["Class utilities<br/>styling utility<br/>[utils.ts]"]
end

node_smtp(("SMTP/email service<br/>external infrastructure"))

node_root_layout -->|"renders"| node_navigation
node_root_layout -->|"renders"| node_footer
node_root_layout -->|"wraps"| node_theme_provider
node_root_layout -->|"loads"| node_styles
node_root_layout -->|"composes route"| node_landing_page
node_root_layout -->|"composes route"| node_about_page
node_root_layout -->|"composes route"| node_contact_page
node_contact_page -->|"submits form"| node_contact_api
node_contact_api -->|"delegates delivery"| node_mailer
node_mailer -->|"sends email"| node_smtp
node_contact_page -->|"uses form controls"| node_ui_primitives
node_ui_primitives -->|"includes"| node_button
node_ui_primitives -->|"includes"| node_input
node_contact_page -->|"shows submission feedback"| node_toast
node_toast -->|"uses state"| node_toast_hook
node_ui_primitives -->|"composes classes"| node_class_utils
node_tailwind -.->|"generates utility styling"| node_styles

click node_root_layout "https://github.com/varun122646/green-poly-source-webfront/blob/main/app/layout.tsx"
click node_landing_page "https://github.com/varun122646/green-poly-source-webfront/blob/main/app/page.tsx"
click node_about_page "https://github.com/varun122646/green-poly-source-webfront/blob/main/app/about/page.tsx"
click node_contact_page "https://github.com/varun122646/green-poly-source-webfront/blob/main/app/contact/page.tsx"
click node_navigation "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/navigation.tsx"
click node_footer "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/footer.tsx"
click node_theme_provider "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/theme-provider.tsx"
click node_contact_api "https://github.com/varun122646/green-poly-source-webfront/blob/main/pages/api/contact.ts"
click node_mailer "https://github.com/varun122646/green-poly-source-webfront/blob/main/lib/nodemailer.ts"
click node_ui_primitives "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/form.tsx"
click node_button "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/button.tsx"
click node_input "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/input.tsx"
click node_toast "https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/toaster.tsx"
click node_toast_hook "https://github.com/varun122646/green-poly-source-webfront/blob/main/hooks/use-toast.ts"
click node_styles "https://github.com/varun122646/green-poly-source-webfront/blob/main/app/globals.css"
click node_tailwind "https://github.com/varun122646/green-poly-source-webfront/blob/main/tailwind.config.js"
click node_class_utils "https://github.com/varun122646/green-poly-source-webfront/blob/main/lib/utils.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root_layout,node_landing_page,node_about_page,node_contact_page,node_navigation,node_footer,node_theme_provider toneBlue
class node_contact_api,node_mailer toneAmber
class node_ui_primitives,node_button,node_input,node_toast,node_toast_hook,node_styles,node_tailwind,node_class_utils toneMint
class node_smtp toneNeutral
```

## Components

### Browser UI

App Router pages and shared client presentation.

- [Root layout](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/layout.tsx): App Router layout · `app/layout.tsx`
- [Landing page](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/page.tsx): App Router page · `app/page.tsx`
- [About page](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/about/page.tsx): App Router page · `app/about/page.tsx`
- [Contact page](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/contact/page.tsx): App Router page · Browser-side contact input boundary. · `app/contact/page.tsx`
- [Navigation](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/navigation.tsx): shared component · `components/navigation.tsx`
- [Footer](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/footer.tsx): shared component · `components/footer.tsx`
- [Theme provider](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/theme-provider.tsx): client presentation provider · `components/theme-provider.tsx`

### Server Email Flow

Node.js API handling and outbound delivery.

- [Contact API](https://github.com/varun122646/green-poly-source-webfront/blob/main/pages/api/contact.ts): Pages API route · Server-side validation and request handling trust boundary. · `pages/api/contact.ts`
- [Nodemailer integration](https://github.com/varun122646/green-poly-source-webfront/blob/main/lib/nodemailer.ts): email adapter · Builds the configured server-side SMTP transport. · `lib/nodemailer.ts`

### Design Infrastructure

Reusable UI primitives and styling conventions.

- [UI primitives](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/form.tsx): component library · Reusable accessible controls and form infrastructure. · `components/ui/form.tsx`
- [Button primitive](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/button.tsx): UI primitive · `components/ui/button.tsx`
- [Input primitive](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/input.tsx): UI primitive · `components/ui/input.tsx`
- [Toast system](https://github.com/varun122646/green-poly-source-webfront/blob/main/components/ui/toaster.tsx): UI feedback · `components/ui/toaster.tsx`
- [Toast state hook](https://github.com/varun122646/green-poly-source-webfront/blob/main/hooks/use-toast.ts): client hook · `hooks/use-toast.ts`
- [Global styles](https://github.com/varun122646/green-poly-source-webfront/blob/main/app/globals.css): stylesheet · `app/globals.css`
- [Tailwind design system](https://github.com/varun122646/green-poly-source-webfront/blob/main/tailwind.config.js): build-time styling · `tailwind.config.js`
- [Class utilities](https://github.com/varun122646/green-poly-source-webfront/blob/main/lib/utils.ts): styling utility · `lib/utils.ts`

### Other components

- **SMTP/email service**: external infrastructure · Credentials and transport settings remain server-side.

## Connections

- Root layout → Navigation: renders
- Root layout → Footer: renders
- Root layout → Theme provider: wraps
- Root layout → Global styles: loads
- Root layout → Landing page: composes route
- Root layout → About page: composes route
- Root layout → Contact page: composes route
- Contact page → Contact API: submits form
- Contact API → Nodemailer integration: delegates delivery
- Nodemailer integration → SMTP/email service: sends email
- Contact page → UI primitives: uses form controls
- UI primitives → Button primitive: includes
- UI primitives → Input primitive: includes
- Contact page → Toast system: shows submission feedback
- Toast system → Toast state hook: uses state
- UI primitives → Class utilities: composes classes
- Tailwind design system → Global styles: generates utility styling
