How kuldeepyeware/fooder_ecommerce works
Main Components
• Frontend Applications:
• Customer-facing website (apps/web): Includes user authentication flows (login, registration, password reset), product browsing, shopping cart, checkout flows and payment processing.
• Admin dashboard (apps/admin): Provides order management, product management, category handling, customer queries, and potentially reporting/metrics.
• API Layers:
• Both apps expose API endpoints (under /app/api) for authentication, file uploads, and other actions. The APIs handle server-side operations integrating with authentication providers and payment processors.
• Backend and Data Layer:
• Prisma with PostgreSQL (located in packages/db): Manages data models (users, products, orders, tokens) including migrations & seeding.
• Shared Libraries and Configurations:
• UI components (packages/ui): Contains shared React components used for consistent styling and responsive behavior across both web and admin applications.
• Common tools such as ESLint and TypeScript configurations (in packages/eslint-config and packages/typescript-config) ensure code quality and consistency.
• External Services:
• Payment processing via Razorpay.
• Media storage and content delivery using AWS S3 and CloudFront.
• Authentication integrated via NextAuth and Auth0.
Relationships and Interactions
• The user-facing web app communicates with its API endpoints for tasks like authentication, checkout, and product queries. It also directly interfaces with the shared UI library for a consistent look and feel.
• Similarly, the admin dashboard app uses its own set of API endpoints for managing products, orders, categories, and user queries.
• Both applications interact with the common backend (Prisma/PostgreSQL) for data persistence. They might also share code patterns or even interact with the same data layer via packages/db.
• The authentication layer (NextAuth and Auth0) is integrated into the API routes which expose secure endpoints.
• Payment actions are handled through dedicated action modules (e.g., Razorpay integration endpoints) that directly interact with the Razorpay API when checkout events occur.
Architectural Patterns & Design Principles
• Monorepo Architecture: Leveraging Turborepo to manage multiple apps and shared packages helps enforce consistency across projects.
• Separation of Concerns: Clear division between customer and admin functionalities, segregating UI components, API routes, and business logic.
• Server Components & API Routes: Use of Next.js’s app directory encourages thin, dedicated components for views and robust API endpoints for handling server-side logic.
• Reusability: Shared UI components and common configurations ensure DRY principles.
Specific Elements
• Each component should be clearly labeled: for example, "Customer Website", "Admin Dashboard", "API Gateway", "PostgreSQL Database (Prisma)", "Shared UI Components", "AWS S3/CloudFront", "Razorpay", and "Auth (NextAuth/Auth0)".
• Client → API → Database,
• Client → Authentication Service,
• Payment processing flow from Checkout → Razorpay → API.
• Frontend components,
• Backend services,
• Shared libraries,
• External integrations.