Main project folder for the frontend React application.
Contains all installed npm packages and dependencies. Managed automatically by npm/yarn.
kit_2025.jpg: Static assets (images, etc.) served directly. Not processed by Webpack/Vite.
Source code for the React app.
config.jsx: API configuration, base URLs, and utility functions for making HTTP requests.
Reusable UI components, organized by feature:
- cart/: Cart-related UI (CartItem, CartSummary, QuantitySelector)
- common/: Shared UI (Button, Loader, RatingStars)
- filters/: Product filtering UI (Availability, Brand, Category, Price, etc.)
- layout/: Layout components (Footer, Nav, Sidebar)
- product/: Product display (ProductCard, ProductList)
Custom React hooks for business logic:
- cartHook/useCart.js: Cart state and logic
- productHook/: (future product-related hooks)
Top-level pages for routing:
- admin/ProductCreate.jsx: Admin product creation page
- cart/Cart.jsx: Shopping cart page
- general/: About, Contact, Home, PageNotFound
- product/: ProductDetails (single product), ProductPage (listing)
- user/: Settings, Signin, Signup
Products.jsx: General product listing page
App routing logic:
Auth.jsx: Authenticated routesMainroutes.jsx: Main app routesUnauth.jsx: Unauthenticated routes
Redux state management:
- actions/: Redux action creators for cart, product, user
- reducers/: Redux slices for product and user state
store.jsx: Redux store configuration
Root React component. Sets up layout, providers, and main structure.
Global CSS styles for the app.
Entry point. Renders the React app and sets up providers (Redux, Router, etc).
Specifies files/folders to ignore in git version control.
ESLint configuration for code linting and style.
Visual map/diagram of the frontend structure.
Main HTML file loaded by Vite. Contains root div for React.
NPM package management files. List dependencies, scripts, and project metadata.
π frontend/ βββ π node_modules/ βββ π public/ β βββ πΌοΈ kit_2025.jpg βββ π src/ β βββ π api/ β β βββ βοΈ config.jsx β βββ π components/ β β βββ π cart/ β β β βββ βοΈ CartItem.jsx β β β βββ βοΈ CartSummary.jsx β β β βββ βοΈ QuantitySelector.jsx β β βββ π common/ β β β βββ βοΈ Button.jsx | | | |---βοΈ--AutoSlider.jsx β β β βββ βοΈ Loader.jsx β β β βββ βοΈ RatingStars.jsx β β βββ π filters/ β β β βββ βοΈ AvailabilityFilter.jsx β β β βββ βοΈ BrandFilter.jsx β β β βββ βοΈ CategoryFilter.jsx β β β βββ βοΈ FilterSidebar.jsx β β β βββ βοΈ PriceRangeSlider.jsx β β β βββ βοΈ RatingFilter.jsx β β β βββ βοΈ ResetFilters.jsx β β β βββ βοΈ SizeFilter.jsx β β β βββ βοΈ SortByDropdown.jsx β β βββ π layout/ β β β βββ βοΈ Footer.jsx β β β βββ βοΈ Nav.jsx β β β βββ βοΈ Sidebar.jsx β β βββ π product/ β β βββ βοΈ ProductCard.jsx | | |---βοΈ--ProductForm.jsx β β βββ βοΈ ProductList.jsx β βββ π hooks/ β β βββ π cartHook/ β β β βββ useCart.js β β βββ π productHook/ β βββ π pages/ β β βββ π admin/ β β β βββ βοΈ ProductCreate.jsx β β βββ π cart/ β β β βββ βοΈ Cart.jsx β β βββ π general/ β β β βββ βοΈ About.jsx β β β βββ βοΈ Contact.jsx β β β βββ βοΈ Home.jsx β β β βββ βοΈ PageNotFound.jsx β β βββ π product/ β β β |ββ βοΈ ProductDetails.jsx | | | βββ βοΈ ProductPage.jsx β β βββ π user/ β β β βββ βοΈ Settings.jsx β β β βββ βοΈ Signin.jsx β β β βββ βοΈ Signup.jsx β β βββ βοΈ Products.jsx β βββ π routes/ β β βββ βοΈ Auth.jsx β β βββ βοΈ Mainroutes.jsx β β βββ βοΈ Unauth.jsx β βββ π store/ β β βββ π actions/ β β β βββ βοΈ cartAction.jsx β β β βββ βοΈ productAction.jsx β β β βββ βοΈ userActions.jsx β β βββ π reducers/ β β β βββ βοΈ productSlice.jsx β β β βββ βοΈ userSlice.jsx β β βββ βοΈ store.jsx β βββ βοΈ App.jsx β βββ π index.css β βββ βοΈ main.jsx βββ π .gitignore βββ π eslint.config.js βββ π frontend_map.pdf βββ π index.html βββ π package-lock.json βββ π package.json βββ π README.md βββ π vite.config.js
and this is backend starcture
Folder Structure---
backend/ βββ src/ β βββ config/ β β βββ db.js # MongoDB connection logic (connects using MONGO_URI) β β βββ cloudinary.js # Cloudinary config for image uploads (optional) β β β βββ controllers/ # Handle requests & responses (business logic layer) β β βββ auth.controller.js # User login, register, refresh tokens β β βββ product.controller.js # CRUD operations for products β β βββ user.controller.js # Fetch/update/delete user details β β βββ order.controller.js # Order placement, status updates β β βββ payment.controller.js # Payment gateway integrations (e.g. Stripe/Razorpay) β β β βββ middleware/ # Middlewares run before reaching controllers β β βββ auth.middleware.js # JWT authentication & role-based access β β βββ error.middleware.js # Global error handler (try/catch wrapper) β β βββ validate.middleware.js# Request validation (Joi/Yup/Zod) (optional) β β β βββ models/ # MongoDB schemas (Mongoose) β β βββ user.model.js # User schema (name, email, password, roles) β β βββ product.model.js # Product schema (title, price, stock, etc.) β β βββ order.model.js # Order schema (items, total, status, user ref) β β βββ category.model.js # Categories schema (electronics, clothing, etc.) β β βββ cart.model.js # Cart schema (items, user ref, total) β β β βββ routes/ # API routes (connects URLs to controllers) β β βββ auth.routes.js # /api/auth β login, register, refresh, logout β β βββ user.routes.js # /api/users β profile, update, delete β β βββ product.routes.js # /api/products β CRUD endpoints β β βββ order.routes.js # /api/orders β create, update, fetch orders β β βββ upload.routes.js # /api/upload β file/image uploads β β β βββ scripts/ β β βββ seedAdmin.js # Script to insert a default admin user in DB β β β βββ services/ # Service layer (logic reusable across controllers) β β βββ auth.service.js # Auth helper functions (hash password, verify) β β βββ product.service.js # Product-related reusable functions β β βββ payment.service.js # Payment gateway utilities β β β βββ utils/ # Helper functions/utilities β β βββ generateToken.js # Generates JWT tokens β β βββ sendEmail.js # Nodemailer/SMTP for emails β β βββ slugify.js # Converts product titles β URL-friendly slugs β β β βββ app.js # Express app config β middleware, routes β βββ server.js # Main entry β connect DB + start server β βββ uploads/ # Local uploads folder (if not using cloudinary) βββ tests/ # Jest/Mocha test cases (unit/integration) βββ Dockerfile # Docker setup (optional) βββ .env # Environment variables (MONGO_URI, JWT_SECRET, etc.) βββ .gitignore # Ignore node_modules, .env, etc. βββ package.json # Project metadata, dependencies, scripts βββ README.md # Project documentation
- The app is built with React (Vite) and uses Redux for state management and React Router for navigation.
- Components are organized by feature for scalability and maintainability.
- Pages are mapped to routes for navigation.
- Redux manages global state (cart, user, products, etc.).
- API calls are abstracted in the
api/folder. - Custom hooks encapsulate business logic.
- store/store.jsx: Configures the Redux store and applies middleware (e.g., thunk for async actions).
- actions/: Contains action creators for cart, product, and user. These dispatch actions to update the Redux state.
- reducers/: Contains slices (using Redux Toolkit or plain reducers) for product and user state. Each slice manages a part of the global state.
- Usage: Components use
useSelectorto read state anduseDispatchto trigger actions. Example:useSelector(state => state.cart).
- routes/Mainroutes.jsx: Defines the main application routes using React Router v6+ (
<Routes>,<Route>). - routes/Auth.jsx: Handles routes that require authentication (e.g., user dashboard, settings).
- routes/Unauth.jsx: Handles routes for unauthenticated users (e.g., login, signup).
- pages/: Each page component is mapped to a route. Example:
/cartrenderspages/cart/Cart.jsx. - Navigation: The
Nav.jsxcomponent provides navigation links using<NavLink>.
- components/: Contains all reusable UI components, grouped by feature (cart, filters, layout, etc.).
- pages/: Contains top-level pages for each route.
- hooks/: Contains custom React hooks for encapsulating logic (e.g., cart logic, product fetching).
- api/config.jsx: Centralizes API endpoints and HTTP logic (e.g., using axios or fetch). All network requests are made through this layer for consistency.
- index.css: Global styles. Components may use Tailwind CSS or other utility classes for styling.
- Run
npm installto install dependencies. - Use
npm run devto start the development server. - Lint code with
npm run lint. - Follow the folder structure and naming conventions for new components/pages.
- Redux is used for global state management (cart, user, products, etc.).
- Actions are dispatched to update state; reducers handle the logic.
- Use
useSelectorto access state anduseDispatchto trigger actions in components.
- React Router is used for client-side navigation.
- Define routes in
routes/and map them to page components. - Use
<NavLink>for navigation links.
- Add new UI components in
components/. - Add new pages in
pages/and map them inroutes/. - Add new Redux state by creating a new slice in
store/reducers/and updatingstore.jsx.
- Use functions from
api/config.jsxfor all HTTP requests. - Keep API logic out of components for maintainability.
- Place reusable logic in
hooks/(e.g.,useCart).
For any questions, see the code comments or contact the project maintainer.