How varun122646/green-poly-source-webfront works
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: layout.tsx Root layout · page.tsx Contact page · form.tsx UI primitives · contact.ts Contact API
Components 18
Browser UI
App Router pages and shared client presentation.
- Root layout
app/layout.tsx - Landing page
app/page.tsx - About page
app/about/page.tsx - Contact page · Browser-side contact input boundary.
app/contact/page.tsx - Navigation
components/navigation.tsx - Footer
components/footer.tsx - Theme provider
components/theme-provider.tsx
Server Email Flow
Node.js API handling and outbound delivery.
- Contact API · Server-side validation and request handling trust boundary.
pages/api/contact.ts - Nodemailer integration · Builds the configured server-side SMTP transport.
lib/nodemailer.ts
Design Infrastructure
Reusable UI primitives and styling conventions.
- UI primitives · Reusable accessible controls and form infrastructure.
components/ui/form.tsx - Button primitive
components/ui/button.tsx - Input primitive
components/ui/input.tsx - Toast system
components/ui/toaster.tsx - Toast state hook
hooks/use-toast.ts - Global styles
app/globals.css - Tailwind design system
tailwind.config.js - Class utilities
lib/utils.ts
Other components
- SMTP/email service · Credentials and transport settings remain server-side.
Connections 17
- 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