How krkavinraj/kavinai-website works
Main Components
• Frontend Pages – Represented by the files in the “src/app” directory. Note the “layout.tsx” files (global layout) and the specific page routes groupings in “(pages)”. Pages include specific routes such as download, pricing, questions, and waitlist.
• API Endpoints – For example, the API route under “src/app/api/waitlist/route.ts” which handles server-side logic (likely for the waitlist functionality).
• UI Components – Located in “src/components” and further organized (e.g., “ui” subfolder for atomic elements like button, card, input). There are additional specialized components like “demo-video”, “hero”, “navbar”, etc.
• Global Providers & Hooks – “src/app/Provider.tsx” hints at a global state or context provider, while custom hooks (in “src/hooks”) manage reusable logic (like toast notifications).
• Utility Libraries – In “src/lib”, containing helpers for database interactions (e.g., “mongodb.ts”) and other utility functions (“utils.ts”).
• Public Assets – The “public” directory contains static assets like demo videos.
Relationships and Interactions
• The Browser (Client) interacts with the Next.js Frontend, rendering pages (from “src/app/(pages)”) which are composed of reusable UI components (from “src/components”).
• The global provider imported in “src/app/Provider.tsx” likely wraps the application, managing state or context for UI components.
• Some pages additionally interact with server-side functionality via API routes (e.g., the waitlist API under “src/app/api/waitlist”), which in turn might use utilities (from “src/lib”) for data persistence or other backend operations.
• Static assets are served to enhance user content (e.g., demo videos in “public”).
Architectural Patterns and Technology Stack
• Next.js App Router & Component-Based Design: The project heavily uses Next.js conventions with segregated “pages” that automatically handle route creation.
• Separation of Concerns: Clear separation between layout/pages, business logic (via API endpoints), and UI components.
• Styling: Use of Tailwind CSS and PostCSS (evidenced by “tailwind.config.ts”, “postcss.config.mjs”, and global CSS files).
• Code Quality & Linting: Presence of ESLint (through “eslint.config.mjs”) ensuring code consistency.
• Advanced Components: The “magicui” and other specialized directories indicate custom component groups bolstering visual features.