How mohithjk/flashdrop works
FlashDrop is a limited-inventory product storefront with OTP-confirmed checkout and an admin area for drops, orders, sales, and users. The main customer flow loads products, filters and opens a product, then initiates and confirms an order through API routes that persist state in a JSON-backed database. The graph includes the documented-by-source-index admin and authentication branches; unsampled implementations are represented at their exact tree paths, with relationships included only where the excerpts or source index show them.
Main entry points: db.ts JSON database access · page.tsx Home page · StorefrontClient.tsx Product storefront · CheckoutButton.tsx OTP checkout
Components 30
Storefront
- Home page
src/app/page.tsx - Hero spotlight
src/components/HeroSpotlight.tsx - Product storefront
src/components/StorefrontClient.tsx - Category filter
src/components/CategoryFilter.tsx - Product card
src/components/ProductCard.tsx - Product details
src/app/product/[id]/page.tsx - Product detail modal
src/components/ProductFullScreen.tsx - Products API
src/app/api/products/route.ts - Drops API
src/app/api/drops/route.ts
Checkout and orders
- OTP checkout
src/components/CheckoutButton.tsx - Order initiation API
src/app/api/orders/initiate/route.ts - Order confirmation API
src/app/api/orders/confirm/route.ts
Admin operations
- Admin layout
src/app/admin/layout.tsx - Admin dashboard
src/app/admin/page.tsx - Admin order table
src/components/AdminOrderTable.tsx - Sales chart
src/components/SalesChart.tsx - Create-drop page
src/app/admin/create/page.tsx - Drop form
src/components/CreateDropForm.tsx - Admin users page
src/app/admin/users/page.tsx - Users table
src/components/UsersTable.tsx
Authentication and layout
- Authentication guard
src/components/AuthGuard.tsx - Login screen
src/components/LoginScreen.tsx - Admin guard
src/components/AdminGuard.tsx - Registration API
src/app/api/auth/register/route.ts - Layout wrapper
src/components/LayoutWrapper.tsx - Navigation bar
src/components/Navbar.tsx - Splash screen
src/components/SplashScreen.tsx - Announcement ticker
src/components/AnnouncementTicker.tsx
Data storage
- JSON database access
src/lib/db.ts
Other components
- Shopper
Connections 27
- Shopper → Home page: visits
src/app/page.tsx - Home page → JSON database access: reads products
src/app/page.tsx - Home page → Hero spotlight: renders
src/app/page.tsx - Home page → Product storefront: renders products
src/app/page.tsx - Product storefront → Category filter: renders
src/components/StorefrontClient.tsx - Product storefront → Product card: renders
src/components/StorefrontClient.tsx - Product storefront → Product detail modal: opens selected
src/components/StorefrontClient.tsx - Product details → JSON database access: reads product
src/app/product/[id]/page.tsx - Product details → OTP checkout: renders checkout
src/app/product/[id]/page.tsx - Product detail modal → OTP checkout: renders checkout
src/components/ProductFullScreen.tsx - OTP checkout → Order initiation API: requests OTP
src/components/CheckoutButton.tsx - OTP checkout → Order confirmation API: submits OTP
src/components/CheckoutButton.tsx - Order initiation API → JSON database access: reads and writes order
src/app/api/orders/initiate/route.ts - Order confirmation API → JSON database access: confirms and updates
src/app/api/orders/confirm/route.ts - Products API → JSON database access: reads and writes products
src/app/api/products/route.ts - Admin layout → Admin guard: guards admin
src/app/admin/layout.tsx - Admin dashboard → JSON database access: reads orders and products
src/app/admin/page.tsx - Admin dashboard → Admin order table: renders orders
src/app/admin/page.tsx - Admin dashboard → Sales chart: renders chart
src/app/admin/page.tsx - Create-drop page → Drop form: renders
src/app/admin/create/page.tsx - Admin users page → JSON database access: reads users
src/app/admin/users/page.tsx - Admin users page → Users table: renders users
src/app/admin/users/page.tsx - Registration API → JSON database access: persists registration
src/app/api/auth/register/route.ts - Authentication guard → Login screen: shows login
src/components/AuthGuard.tsx - Layout wrapper → Splash screen: renders
src/components/LayoutWrapper.tsx - Layout wrapper → Navigation bar: renders
src/components/LayoutWrapper.tsx - Layout wrapper → Announcement ticker: renders
src/components/LayoutWrapper.tsx