How rksahu2601/e-commerce_code_with_antonio works
Main Components
• Admin Panel:
• Contains its own Next.js “app” directory with dedicated subfolders for authentication ((auth)), the dashboard ((dashboard)), root pages, and API endpoints.
• Includes actions (logic to fetch data like revenue, orders, stocks) and API routes organized by store ID (supporting multi-store capabilities).
• Provides UI components, modals, navigation, and various dashboard-specific utilities.
• Storefront:
• Has its own directory with the “app” folder featuring routes for the customer such as product, category, and cart pages.
• Includes a set of UI components that create a seamless customer experience.
• Back-end / Data Layer:
• Uses Prisma with a schema defined in admin/prisma/schema.prisma, connected to a MySQL database hosted on PlanetScale.
• External Services & Integrations:
• Clerk for authentication.
• Stripe integration for handling payments.
Relationships and Interactions
• The Admin Panel communicates with the back end through Next.js API routes to manage store data. It retrieves data using the actions in the “admin/actions” directory.
• The storefront retrieves product, category, and cart information through client-side API calls, likely calling similar API endpoints.
• Both applications rely on common libraries and providers (like modal and toast providers) to manage state and notifications in React.
• The admin dashboard has its own authentication flows (evidenced by the (auth) routing) which leverage Clerk.
• Payment processing integrations (via Stripe) are used on the admin side for checkout operations.
Architectural Patterns & Design Principles
• Modular Design: The clear separation between the “admin” and “store” directories shows adherence to modular architecture.
• Folder-Based Routing: The Next.js app directory structure naturally documents how routes are built and used.
• Component Reusability: The shared UI components (found in both admin/components/ui and store/components/ui) denote a component-driven architecture.
• API-First Approach: The explicit organization of API endpoints under the “app/api” directories indicates a focus on exposing server functions to the client.
Including Relevant Technologies
• Next.js 13 (App Router) used for routing and server/client components.
• React for rendering user interfaces.
• Tailwind CSS for styling.
• Prisma for connecting to a MySQL database.
• Clerk for user authentication.
• Stripe for payment processing.
• PlanetScale for the database hosting.