How programmerpakistaniorg/soltronicsenergy works
Purpose and Runtime
A Next.js App Router site for Soltronic’s solar/product catalogue, corporate content, and customer-facing product discovery. It runs as a TypeScript React application, uses Tailwind/PostCSS styling, and is configured for Vercel deployment. Primary shell and landing entry points are src/app/layout.tsx, src/app/page.tsx, and next.config.ts.
Route Layer and Content Surfaces
The src/app directory defines server-rendered route entry points for catalogue, brands, news, services, PV/EPC, downloads, promotions, and marketing pages. Dynamic routes provide entity detail views:
• Product list/detail: src/app/products/page.tsx, src/app/products/[slug]/page.tsx
• Brand list/detail: src/app/brands/page.tsx, src/app/brands/[brand]/page.tsx
• News list/detail: src/app/news/page.tsx, src/app/news/[slug]/page.tsx
SEO crawl boundaries are explicitly generated in src/app/sitemap.ts and src/app/robots.ts.
Product Catalogue Pipeline
Products are represented by local application data and backed by static public assets. Catalogue routes pass interactive filtering/display responsibility to client components, while detail pages use a dedicated client renderer:
• src/data/products.ts
• src/app/products/ProductsClient.tsx
• src/app/products/[slug]/ProductDetailClient.tsx
Product specifications are structured using src/data/specificationSchemas.ts and rendered through src/components/ProductSpecificationDisplay.tsx. Datasheets and product images are served directly from public/Products Datasheets and public/Products-images, making static files an important delivery boundary.
Shared UI Composition
Routes compose reusable site-navigation and marketing/product components rather than each implementing their own shell. The global layout and styles establish the shared visual boundary; navigation/footer are centralized:
• src/app/layout.tsx
• src/app/globals.css
• src/components/Navbar.tsx
• src/components/Footer.tsx
• src/components/HeroSlider.tsx
Structured-data output is isolated in src/components/SchemaMarkup.tsx, allowing route content to provide SEO metadata without coupling to page layout.
Authentication and Supabase Boundary
Supabase is the external backend/authentication boundary, with separate browser, server, and middleware client factories:
• src/utils/supabase/client.ts
• src/utils/supabase/server.ts
• src/utils/supabase/middleware.ts
Authentication state is distributed through src/context/AuthContext.tsx; OAuth/session completion enters via src/app/auth/callback/route.ts. Sign-in and sign-up pages are route-level consumers at src/app/signin/page.tsx and src/app/signup/page.tsx.
Client-Side Favourites
Favourite products are managed as cross-page client state, distinct from catalogue data and authentication. The context owns state/control flow, while drawer, toast, and per-product controls are presentation consumers:
• src/context/FavouriteContext.tsx
• src/components/FavouriteButton.tsx
• src/components/FavouriteDrawer.tsx
• src/app/favourite/page.tsx
Content Import and Asset Preparation
A set of Node.js and Python scripts supports an offline ingestion/normalization workflow from Excel and product media into the application’s static catalogue assets/data. Key pipeline entry points are import_products.js, process_products.js, scripts/seed_products_from_excel.js, and fix_backgrounds.py. Source spreadsheets under public/ and generated product images/datasheets are deployment-time content, not runtime API dependencies.
Main entry points: ProductDetailClient.tsx Product detail renderer · products.ts Product data · import_products.js Catalogue ingestion scripts · ProductsClient.tsx Product browser
Components 19
Next.js application
App Router routes, shell, and shared UI.
- Global layout · Establishes the shared site visual boundary.
src/app/layout.tsx - Content routes · Catalogue, brands, news, services, PV/EPC, downloads, promotions, and marketing pages.
src/app/page.tsx - Shared navigation and marketing UI · Includes Navbar, Footer, and HeroSlider.
src/components/Navbar.tsx - SEO output · Structured data plus sitemap and robots boundaries.
src/components/SchemaMarkup.tsx
Product catalogue
Local catalogue data, interactive views, and static product assets.
- Product routes
src/app/products/page.tsx - Product data
src/data/products.ts - Product browser · Provides interactive catalogue filtering and display.
src/app/products/ProductsClient.tsx - Product detail renderer
src/app/products/[slug]/ProductDetailClient.tsx - Specification schemas
src/data/specificationSchemas.ts - Specification display
src/components/ProductSpecificationDisplay.tsx - Product static assets · Delivered directly as public deployment assets.
public/Products-images - Favourites context
src/context/FavouriteContext.tsx - Favourites UI
src/components/FavouriteButton.tsx
Authentication
Supabase-backed session and OAuth boundary.
- Auth routes · OAuth/session completion enters through the callback route.
src/app/auth/callback/route.ts - Auth context
src/context/AuthContext.tsx - Supabase client factories · Separates Supabase access by Next.js runtime boundary.
src/utils/supabase/client.ts - Supabase
Content preparation
Offline spreadsheet and media ingestion workflow.
- Catalogue ingestion scripts · Imports and normalizes spreadsheet and product media inputs.
import_products.js - Source spreadsheets
Connections 21
- Global layout → Shared navigation and marketing UI: composes
- Global layout → Favourites context: provides state
- Content routes → Shared navigation and marketing UI: composes
- Content routes → SEO output: provides content
- Product routes → Product browser: renders list
- Product routes → Product detail renderer: renders detail
- Product browser → Product data: reads
- Product detail renderer → Product data: reads
- Product detail renderer → Specification schemas: uses
- Product detail renderer → Specification display: renders through
- Product browser → Product static assets: references
- Product detail renderer → Product static assets: serves images and datasheets
- Favourites UI → Favourites context: consumes
- Favourites context → Product data: tracks products from
- Auth routes → Auth context: updates session
- Auth context → Supabase client factories: uses
- Auth routes → Supabase client factories: uses
- Supabase client factories → Supabase: connects to
- Catalogue ingestion scripts → Source spreadsheets: imports from
- Catalogue ingestion scripts → Product data: generates or normalizes
- Catalogue ingestion scripts → Product static assets: prepares