How hasibur14/dinedorm-client works
1. Overall shape
- This is a single-page React frontend built with Vite and styled with Tailwind CSS.
- The repository is primarily the client for “Dine Dorm”; the README indicates it talks to a separate Node/MongoDB backend for meals, reviews, users, JWT auth, and Stripe payments.
2. App entry and shell
- The runtime starts from index.html → src/main.jsx.
- Global styling lives in src/index.css.
- The app shell is split into two main presentation boundaries:
- src/Layout/Main.jsx for the public-facing site
- src/Layout/DashboardLayout.jsx for authenticated dashboard screens
3. Routing and access control
- Route composition is centralized in src/Routes/Routes.jsx.
- Protected navigation is enforced with:
- src/Routes/PrivetRoute.jsx for authenticated routes
- src/Routes/AdminRoute.jsx for admin-only routes
- This creates the main boundary between public pages, user dashboard pages, and admin dashboard pages.
4. Authentication and identity
- Firebase is the client-side auth integration point via src/firebase/firebase.config.js.
- src/Provider/AuthProvider.jsx likely exposes auth state and session actions to the rest of the app.
- src/hooks/useAuth.jsx and src/components/SocialLogin/SocialLogin.jsx suggest multiple auth entry points, including social sign-in.
- The app uses JWT for secured backend requests, separate from Firebase’s auth session.
5. API/data access layer
- Server communication is abstracted behind custom hooks in src/hooks/.
- useAxiosPublic.jsx and useAxiosSecure.jsx are the key transport boundaries:
- public requests for unauthenticated data
- secure requests that attach JWT and handle protected endpoints
- Domain hooks such as useMeal.jsx, useReview.jsx, useUser.jsx, useUpcomingMeal.jsx, and useRequestMeal.jsx isolate page components from raw API details.
6. Public site pages
- The public experience is organized under src/pages/Home/ plus standalone pages like About, Contact, AllMeals, MealDetails, UpcomingMeal, and JoinUs.
- Home is composed of modular sections: banner, meal categories, membership, testimonials, and “why choose us”.
- public/whyChooseUs.json is a static content source used by the marketing/landing experience.
7. Meal discovery and content browsing
- The meal-centric flow is a major domain area:
- AllMeals/Meals.jsx for browsing and filtering
- MealDetails/MealDetails.jsx for a meal’s full record and reviews
- Home/MealCategory/* for category-based discovery
- UpcomingMeal/UpcomingMeal.jsx for teaser content tied to subscription upsell
- The README’s search/filter feature is reflected in this area, where pages likely consume meal hooks and render category/price/keyword-driven views.
8. Payments and premium flow
- The premium subscription path is handled in src/pages/Home/Checkout/.
- Checkout.jsx and CheckoutForm.jsx indicate a dedicated payment boundary, with Stripe mentioned in the README.
- This flow likely connects the UI to a backend payment intent endpoint, then updates user membership status after successful payment.
9. User dashboard subsystem
- User-specific state and actions live under src/pages/Dashboard/User/.
- Main features:
- MyProfile for account info
- MyReviews and ReviewEdit for review management
- RequestedMeals for meal requests
- PaymentHistory for subscriptions/payments
- These screens are protected by the auth/JWT layer and use secure API hooks.
10. Admin dashboard subsystem
- Admin functions are grouped under src/pages/Dashboard/Admin/.
- This area covers:
- meal creation and updates
- meal publication/serving workflow
- review moderation
- user management
- upcoming meal scheduling
- admin profile
- AdminRoute.jsx is the boundary that keeps this area separate from normal users.
11. Shared UI and cross-cutting components
- Reusable visual elements live in src/components/:
- titles, containers, loading state, notifications, review modal, social login
- Shared navigation and chrome live in src/pages/Shared/:
- Navbar, Sidebar, Footer, and dropdown menus
- These components form the common UI layer used across both public pages and dashboard views.
12. Stateful interaction patterns
- NotificationDropDown and ReviewModal indicate modal/dropdown-driven interactions layered on top of page data.
- LoadingSpinner.jsx represents async fetching states across the app.
- The app likely follows a pattern of: page component → custom hook → axios client → backend → render/update UI state.
13. Deployment and infrastructure
- firebase.json, .firebaserc, and the .firebase/ directory show the frontend is deployed on Firebase Hosting.
- The live site is hosted at the Firebase URL in the README.
- Build tooling is standard Vite with Tailwind/PostCSS and ESLint, so the repo is focused on client delivery rather than backend runtime concerns.
14. What to show in an architecture diagram
- Draw the frontend as a React SPA with three major zones:
- public marketing/meals browsing
- authenticated user dashboard
- admin dashboard
- Put AuthProvider/Firebase auth and JWT-secured axios clients as shared infrastructure services across all protected flows.
- Treat the backend as an external system providing meals, reviews, users, requests, payments, and admin mutations; Firebase Hosting is the deployment target for the client.
Main entry points: useAxiosSecure.jsx Secure API · useMeal.jsx Meal Hooks · Routes.jsx Routes · AddMeals.jsx Admin Dashboard
Components 27
App shell
React SPA bootstrap and routing
- index.html · Vite entry document
index.html - main.jsx · Bootstraps the SPA
src/main.jsx - Routes · Central route composition
src/Routes/Routes.jsx - Main Shell · Public-facing app shell
src/Layout/Main.jsx - Dash Shell · Authenticated dashboard shell
src/Layout/DashboardLayout.jsx - Private Route · Authenticated route boundary
src/Routes/PrivetRoute.jsx - Admin Route · Admin-only route boundary
src/Routes/AdminRoute.jsx
Public experience
Marketing, discovery, and checkout flows
- Home · Homepage composition
src/pages/Home/Home/Home.jsx - All Meals · Meal listing and filtering
src/pages/AllMeals/Meals.jsx - Meal Details · Single meal and reviews view
src/pages/MealDetails/MealDetails.jsx - Checkout · Stripe-backed premium purchase
src/pages/Home/Checkout/Checkout.jsx
Dashboard
Protected user and admin screens
- User Dashboard · Protected member screens
src/pages/Dashboard/User/MyProfile/MyProfile.jsx - Admin Dashboard · Protected admin management screens
src/pages/Dashboard/Admin/AddMeals/AddMeals.jsx
Shared UI
Reusable UI and chrome components
Data layer
Auth, API, and domain hooks
- AuthProvider · Exposes auth state and actions
src/Provider/AuthProvider.jsx - Public API · Unauthenticated backend requests
src/hooks/useAxiosPublic.jsx - Secure API · JWT-protected backend requests
src/hooks/useAxiosSecure.jsx - Meal Hooks · Meal discovery and details data
src/hooks/useMeal.jsx - Review Hooks · Review fetch and mutation access
src/hooks/useReview.jsx - User Hooks · User and role lookup
src/hooks/useUser.jsx - Request Hooks · Requested meal workflows
src/hooks/useRequestMeal.jsx - Upcoming Hooks · Upcoming meal data access
src/hooks/useUpcomingMeal.jsx
Infrastructure
Firebase and deployment configuration
- Firebase Auth · Client auth integration
src/firebase/firebase.config.js - Firebase Hosting · Frontend deployment and hosting
firebase.json
Other components
- Backend API · Meals, reviews, users, auth, and payments
Connections 36
- index.html → main.jsx: loads · Document loads the React entry
- main.jsx → Routes: mounts · App bootstrap renders route tree
- Routes → Main Shell: public shell · Public routes render in main layout
- Routes → Dash Shell: dashboard shell · Protected routes render in dashboard layout
- Routes → Private Route: protects · Authenticated pages are gated
- Routes → Admin Route: protects · Admin pages are gated
- AuthProvider → Firebase Auth: auth state · Session is backed by Firebase auth
- Private Route → AuthProvider: checks · Uses auth context for access control
- Admin Route → AuthProvider: checks · Uses auth context and role state
- Secure API → AuthProvider: token · Attaches authenticated session token
- Secure API → Backend API: requests · Protected API calls hit backend
- Public API → Backend API: requests · Public API calls hit backend
- Meal Hooks → Public API: reads · Meal browsing uses public transport
- Meal Hooks → Secure API: mutates · Some meal actions require secure transport
- Review Hooks → Secure API: reads/writes · Review operations are authenticated
- User Hooks → Secure API: reads · User and role queries are secured
- Request Hooks → Secure API: reads/writes · Requested meal workflow is secured
- Upcoming Hooks → Public API: reads · Upcoming meals can be shown publicly
- Shared UI → Home: decorates · Shared components are used across pages
- Navbar → Home: navigates · Primary public navigation
- Sidebar → User Dashboard: navigates · User dashboard navigation
- Sidebar → Admin Dashboard: navigates · Admin dashboard navigation
- Home → Meal Hooks: consumes · Homepage sections render meal data
- Home → Upcoming Hooks: consumes · Upsell sections show upcoming meals
- All Meals → Meal Hooks: consumes · Listing page fetches browsable meals
- Meal Details → Meal Hooks: consumes · Details page loads one meal and reviews
- Meal Details → Review Hooks: consumes · Review interactions live here
- Checkout → Secure API: charges · Payment flow calls secure backend endpoints
- User Dashboard → Request Hooks: consumes · User dashboard manages requests
- User Dashboard → Review Hooks: consumes · User dashboard manages reviews
- Admin Dashboard → Meal Hooks: consumes · Admin screens manage meals
- Admin Dashboard → User Hooks: consumes · Admin screens manage users and roles
- Admin Dashboard → Review Hooks: consumes · Admin screens moderate reviews
- Firebase Hosting → main.jsx: serves · Firebase Hosting delivers the SPA
- Shared UI → Sidebar: supports · Shared UI underpins chrome components
- Shared UI → Navbar: supports · Shared UI underpins navigation