How ahmedselim1234/khodarak works
Khodarak is an Arabic RTL produce-subscription storefront. Customers browse products, assemble a cart and recurring delivery plan, pay by card, and manage the subscription; scheduled renewals reprice, charge the saved card, and create subsequent orders. Administrators manage the catalog, delivery rules, orders, subscriptions, payments, and settings. The graph includes the principal customer and renewal workflows plus administrative capabilities. Some page and API implementations are unsampled, so those links rely on README documentation; source-level links are limited to indexed excerpts.
Main entry points: renewals/route.ts Renewal scheduler · page.tsx Browse catalog · subscriptions/route.ts Subscription API · moyasarClient.ts Moyasar client
Components 27
Customer shopping
- Browse catalog
app/browse/page.tsx - Product details
app/browse/[id]/page.tsx - Shopping cart
components/cart/CartView.tsx
Subscription lifecycle
- Subscription setup
components/subscription/SubscriptionWizard.tsx - Card payment
components/payment/PaymentSection.tsx - Subscription dashboard
components/dashboard/SubscriptionDashboard.tsx - Renewal scheduler
app/api/cron/renewals/route.ts
Administration
- Product management
app/admin/products/page.tsx - Delivery intervals
app/admin/delivery-intervals/page.tsx - Order management
app/admin/orders/page.tsx - Subscription management
app/admin/subscriptions/page.tsx - Payment monitoring
app/admin/payments/page.tsx - Delivery cities
app/admin/cities/page.tsx - Store settings
app/admin/settings/page.tsx
Application services
- Cart state
lib/cart/useCart.ts - Product queries
lib/products/queryProducts.ts - Pricing engine
lib/pricing/calculate.ts - Subscription API
app/api/subscriptions/route.ts - Payment API
app/api/subscriptions/[id]/pay/route.ts - Moyasar client
lib/payments/moyasarClient.ts - Subscription management
app/api/subscriptions/[id]/route.ts - Renewal repricing
lib/subscription/reprice.ts - Renewal outcome
lib/payments/processRenewalOutcome.ts
Other components
- Customer
- Moyasar
- Administrator
- Supabase
Connections 27
- Customer → Browse catalog: browses
- Browse catalog → Product details: opens products
- Product details → Shopping cart: adds items
- Shopping cart → Cart state: updates cart
lib/cart/useCart.ts - Browse catalog → Product queries: loads products
- Customer → Subscription setup: builds subscription
- Subscription setup → Subscription API: submits plan
- Subscription API → Pricing engine: calculates price
app/api/subscriptions/route.ts - Customer → Card payment: pays by card
- Card payment → Payment API: initiates payment
- Payment API → Moyasar client: creates charge
- Moyasar client → Moyasar: calls payment API
lib/payments/moyasarClient.ts - Customer → Subscription dashboard: manages subscription
- Subscription dashboard → Subscription management: edits plan
- Renewal scheduler → Renewal repricing: reprices renewal
app/api/cron/renewals/route.ts - Renewal scheduler → Moyasar client: charges saved card
app/api/cron/renewals/route.ts - Renewal scheduler → Renewal outcome: processes result
app/api/cron/renewals/route.ts - Administrator → Product management: manages products
- Administrator → Delivery intervals: sets delivery discounts
- Administrator → Order management: tracks orders
- Administrator → Subscription management: tracks subscriptions
- Administrator → Payment monitoring: tracks payments
- Administrator → Delivery cities: manages delivery cities
- Administrator → Store settings: manages pricing
- Subscription API → Supabase: stores subscription
app/api/subscriptions/route.ts - Renewal scheduler → Supabase: reads renewal data
app/api/cron/renewals/route.ts - Cart state → Supabase: loads signed-in cart