How agrawal-harsh/sevasrot works
Main Components
• Frontend Pages: The “app” directory shows all the page-level components – for example, the homepage (app/page.tsx), donation page (app/donate/page.tsx), awareness page, volunteer (become-sevak) page, transparency page, and an impact page.
• Layout and Shared UI: The “app/layout.tsx” sets up the overall layout (which includes header, footer, and common styles from “globals.css”). The components folder contains reusable UI elements such as header, footer, language and theme providers/ toggles, cookie consent, and various feature components like donation forms, donation certificates, sliders, counters, testimonials, and more.
• Component Library: The project makes extensive use of shadcn/ui components (and even extends these inside components/ui) to create a consistent UI. These components incorporate interactive elements (accordions, alerts, dialogs, carousels, etc.) that are used throughout the site.
• Utility and Hooks: The “hooks” and “lib” directories provide custom hooks (e.g., use-mobile, use-toast) and general-purpose utilities.
• Styling & Configuration: Tailwind CSS (customized via tailwind.config.ts) and Next.js configuration (next.config.mjs) indicate modern styling and build setups.
Relationships and Interactions
• Routing: In a Next.js App Router structure, each folder under “app” represents a distinct route. The main pages interact with multiple shared components, for example:
• The header and footer (common across pages) interact with global contexts (language and theme providers).
• The donation page utilizes the DonationForm, DonationCertificate, DonationCounter, and DonationImpactSlider components.
• The volunteer page (become-sevak) integrates with the SevakRegistrationForm and possibly additional volunteer-related displays (like SevakShowcase).
• Data Flow: While the project currently simulates data (using mock data), the README hints at future backend integration. This means that form submissions (DonationForm and SevakRegistrationForm) are handled client-side (using React Hook Form with Zod validation), but are conceptually designed to send data to some API endpoint.
Architectural Patterns and Design Principles
• Component-Based Architecture: The project emphasizes reusability by splitting elements into small, focused components.
• Separation of Concerns: Page-level routing, layout management, and individual UI functionality (like theming, internationalization, and forms) are separated into different modules/directories.
• Client/Server Component Strategy: Employing Next.js, the application leverages server-side rendering for static content while using client components for interactive elements (e.g., form handling, theme toggles) for improved performance.
• Next.js’s routing and page components in the next layer.