How muditarya7/pharma-site works
Project Type and Purpose
• This is a single-page application (SPA) front-end project built with React, TypeScript, and Vite.
• There is no dedicated backend service or database; the app is statically hosted (e.g., via Netlify) and may consume static data files or external APIs.
File Structure Analysis
• Top Level
• public/
– index.html, Netlify config, static images
• src/
– App.tsx, main.tsx (entry points)
– assets/ (UI components, hooks, data files)
– pages/ (route components)
– lib/ (utility functions)
– types/ (TypeScript type definitions)
• Build & Tooling
• vite.config.ts (build config, HMR)
• eslint.config.js (lint rules)
• tsconfig*.json (TS compiler options)
Relevant Architectural Patterns
• Component-based architecture: reusable UI components under src/assets/ui, page components under src/pages.
• SPA routing (likely React Router or similar) handled in App.tsx.
• Static hosting with CDN for public assets.
• Build pipeline managed by Vite: TS → JSX/TSX → bundle → dist.
Main Components
a. Developer Environment
– VS Code (or IDE)
– Git (version control)
– ESLint + Prettier (code quality)
– TypeScript compiler
– Vite (dev server + bundler)
b. Build & Deployment
– Vite build → dist folder
– Netlify (or any static host)
– CDN (serving public assets)
c. Runtime (Browser)
– index.html (root)
– React App (App.tsx → component tree)
• pages/ (routes: home, news, projects, etc.)
• assets/ UI components (buttons, cards, sliders)
• lib/utils (shared utilities)
• hooks (e.g., use-toast)
• data files (publications.tsx)
– External Services (optional)
• REST/GraphQL APIs or headless CMS (if integrated later)
Relationships & Data Flow
• Developer edits code → Lint/TS check → Vite dev server hot-reloads in browser.
• On build: Vite bundles JS/CSS/images → deploy to Netlify → CDN edge nodes.
• Browser requests index.html → loads bundled JS → React hydrates app → user navigates pages.
• Components fetch static data or call external APIs → render UI.
Architectural Patterns & Principles
• Single Source of Truth: state/hooks live in React context or custom hooks.
• Separation of Concerns:
• UI components (assets/ui) vs. layout components (assets/Header, Footer) vs. pages.
• Utilities and types isolated in src/lib and src/types.
• Modularization: each feature in its own folder (e.g., data/publications, imageSlider).