How ghost-vedant/gurukul works
Main Components
• Next.js Frontend: Represent the pages and UI components found in the "src/app" directory. This includes pages for routes like about, addnewcourse, courses, categories, profile, and error handling.
• API Endpoints: Mark the API routes under "src/app/api". Highlight the endpoints such as authentication ([...nextauth]), classroom, comments, course creation, course purchase (which include dynamic segments like [courseId]), order processing, registration, and testimonials. These endpoints represent the backend services that handle data requests.
• Business Logic/Actions: Identify the "src/actions" folder where key functions (e.g., assessment, auth, aws, purchase, user progress) reside. They encapsulate the application's core business logic that coordinate with the API endpoints.
• Database Integration: Display the "prisma" directory with its Prisma schema. This is the ORM layer used for interacting with the database, and you may also indicate how API endpoints use this layer via utilities in "src/lib/prisma.ts".
• State Management: Illustrate the "src/recoil" directory which includes Recoil atoms managing user sessions, popups, and login status.
• Custom Hooks and Utility Libraries: Indicate the “src/Custom_hooks” and utility scripts in "src/lib" (such as awsUtil, token management, bcrypt, zod, etc.) which serve to provide common functionality throughout the project.
• UI Components & Design: Highlight organized UI component directories ("src/components/ui", "src/components/cards", "src/components/navbar", "src/components/popups") which are essential for building the interactive interface.
• Middleware & Configurations: Show global middleware (middleware.ts files both at root and under src), configuration files (next.config.mjs, tailwind.config.ts, tsconfig.json, postcss.config.mjs), and environment settings (like auth.ts for next-auth integration).
Relationships and Interactions
• That the API endpoints call the business logic in "src/actions" and interact with the database through Prisma (from the "prisma" folder and "src/lib/prisma.ts").
• Custom hooks and utility functions to both the frontend components and API logic to underline shared functionality.
Architectural Patterns and Design Principles
• File-based Routing: Explain the Next.js routing mechanism, with pages and API routes defined based on the file system structure under "src/app".
• Separation of Concerns: Emphasize how the project cleanly separates API logic, UI components, business logic (actions), state management (Recoil), and utility layers.
• Modular Architecture: The granularity in the "src" folder (actions, components, lib, and recoil) indicates a design that favors reusability and modularity.
• Integration with External Services: Note components that handle authentication (using NextAuth, visible in auth.ts and API route [...nextauth]), payment (Razorpay), and external file storage or computational operations (AWS).