How kpirabaharan/e-commerce-admin-dashboard works
Project Type and Purpose
• This is a full-stack, single-page admin dashboard built with Next.js (app router), designed to manage multiple e-commerce stores.
File Structure Analysis
• “src/app”: Next.js app-router routes, broken into route groups:
• (auth): sign-in/sign-up pages and components.
• (root): public landing page.
• api: Next.js serverless API routes mirroring the dashboard paths.
• “src/components”: shared UI components (modals, tables, forms, navigation).
• “src/lib”: infrastructure clients (Prisma DB, AWS S3 client, Stripe, email, utility functions).
• “src/prisma”: database schema and seed scripts.
• “src/hooks” & “src/providers”: React custom hooks and context providers for UI state (modal, theme, toast).
• Configuration files: Dockerfile, next.config.js, tsconfig.json, tailwind.config.js, Prisma schema.
Key Architecture Insights from README
• Next.js handles SSR/SSG and serverless API routes in the same codebase.
• Authentication through Clerk with OAuth2 and email/password.
• PostgreSQL managed via AWS RDS, accessed via Prisma ORM.
• AWS S3 stores image assets.
• Stripe manages payments, and a custom email service sends order confirmations.
• Tailwind and Shadcn UI for styling.
a. Main Components
• Browser/Client (Admin UI)
• Next.js App (Front-end pages & layouts)
• Next.js API Routes (serverless functions under src/app/api)
• Authentication Service (Clerk)
• PostgreSQL Database (AWS RDS via Prisma)
• Object Storage (AWS S3 via aws-client)
• Payment Gateway (Stripe via stripe.ts)
• Email Service (e.g. AWS SES via sendEmail.ts)
b. Interactions
• User → Admin UI (React pages)
• Admin UI ↔ Clerk (auth flows)
• Admin UI → API Routes (CRUD, data-fetching actions)
• API Routes → Prisma Client → PostgreSQL
• API Routes → AWS S3 for image upload/download
• API Routes → Stripe for payment operations
• API Routes → Email Service for order confirmation
c. Architectural Patterns
• Next.js app router with nested route groups for logical separation (Auth vs Dashboard).
• Serverless functions pattern for each resource (billboards, categories, etc.).
• MVC-style separation:
Model → Prisma + schema.prisma
View → React components (pages & shared UI)
Controller → API route handlers (route.ts files + action functions)
• Context providers for theme, modal, toast (React Context pattern).
d. Technologies & Frameworks
• Next.js (React, app router, serverless API)
• Clerk (authentication)
• Prisma + PostgreSQL (data layer)
• AWS S3 (asset storage)
• Stripe (payments)
• Tailwind CSS + Shadcn UI (styling/components)
• Recharts (charts/data visualization)