How abdullahalnoman003/food-khazana-client works
Project Type and Purpose
• This is a full-stack, single-page React application (“Food Khazana”) for recipe management.
• Users authenticate (email/password + Google) via Firebase, then perform CRUD on recipes through a custom Node/Express REST API, which persists data in MongoDB Atlas.
Core Components
a. Frontend (React SPA)
• UI Components:
• Nav+Footer (Navbar, Footer, ThemeToggle)
• Home (Hero, HomeSlider, HomeRecipes, Ratings, WhyUs)
• FoodSection (AllRecipes, AddRecipes, MyRecipes, FoodDetails, UpdateRecipe)
• Auth (Login, Register, ForgotPassword, PrivateRoute, PublicRoute)
• Errorpage (NotFound)
• State & Routing:
• AuthContext/AuthProvider – manages user session and Firebase calls
• React Router (router.jsx) – defines PublicRoute vs PrivateRoute for protected pages
b. Authentication Service
• Firebase Authentication (email/password + Google)
c. Backend API
• Node.js + Express.js REST API
• Endpoints for recipes: GET /recipes, GET /recipes/:id, POST /recipes, PUT /recipes/:id, DELETE /recipes/:id
• CORS, dotenv for config
d. Database
• MongoDB Atlas – stores user-linked recipe documents
e. Deployment & Hosting
• Frontend: Vercel (static hosting + CDN)
• Backend: your choice (could be Vercel Serverless Functions, Heroku, AWS, etc.)
Relationships & Data Flows
• User Browser ↔ React SPA (UI interactions, route changes)
• React SPA ↔ Firebase Auth (login, signup, token management)
• React SPA ↔ Node/Express API (authenticated CRUD calls carrying Firebase JWT)
• Node/Express API ↔ MongoDB Atlas (data persistence)
Architectural Patterns & Design Principles
• SPA (client-centric rendering, client-side routing)
• Client-Server REST pattern (React ↔ Express)
• Context API for global auth state
• Protected Routes (PublicRoute vs PrivateRoute)
• Modular component hierarchy (Auth, FoodSection, Home, Layout)
• Separation of concerns (presentation vs service vs data layers)
Final Recommendations
• Data flow with arrowheads and label: “POST /recipes”, “GET /recipes/:id”, “PUT /recipes/:id”.
• Keep it at two abstraction levels:
• High-level: Frontend, Auth Service, API, Database
• Mid-level (optional zoom): component groups inside Frontend and endpoint list inside API