Skip to content

Latest commit

Β 

History

History
287 lines (258 loc) Β· 10.7 KB

FILE_STRUCTURE.md

File metadata and controls

287 lines (258 loc) Β· 10.7 KB

πŸ“ Complete File Structure - Classic Watch Pro v2.0

Root Directory

classic-watch-upgraded/
β”œβ”€β”€ πŸ“„ package.json              # Dependencies & scripts
β”œβ”€β”€ πŸ“„ tsconfig.json             # TypeScript configuration
β”œβ”€β”€ πŸ“„ vite.config.ts            # Vite build config
β”œβ”€β”€ πŸ“„ .eslintrc.cjs             # ESLint rules
β”œβ”€β”€ πŸ“„ .prettierrc               # Code formatting rules
β”œβ”€β”€ πŸ“„ .gitignore                # Git ignore patterns
β”œβ”€β”€ πŸ“„ .env.example              # Environment template
β”œβ”€β”€ πŸ“„ README.md                 # Main documentation
β”œβ”€β”€ πŸ“„ UPGRADE_SUMMARY.md        # Detailed upgrade report
β”œβ”€β”€ πŸ“„ QUICK_START.md            # Quick setup guide
β”œβ”€β”€ πŸ“„ index.html                # HTML entry point
β”‚
└── πŸ“ src/                      # Source code
    β”œβ”€β”€ πŸ“„ main.tsx              # React entry point
    β”œβ”€β”€ πŸ“„ App.tsx               # Main App component
    β”œβ”€β”€ πŸ“„ vite-env.d.ts         # Vite type definitions
    β”‚
    β”œβ”€β”€ πŸ“ api/                  # API layer (React Query)
    β”‚   β”œβ”€β”€ πŸ“„ products.api.ts   # Product queries & mutations
    β”‚   β”œβ”€β”€ πŸ“„ orders.api.ts     # Order queries & mutations
    β”‚   β”œβ”€β”€ πŸ“„ reviews.api.ts    # Review queries & mutations
    β”‚   └── πŸ“„ users.api.ts      # User queries & mutations
    β”‚
    β”œβ”€β”€ πŸ“ components/           # Reusable components
    β”‚   β”œβ”€β”€ πŸ“ common/          # Shared components
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProtectedRoute.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ AdminRoute.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ LoadingScreen.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ ErrorFallback.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ SkeletonLoader.tsx
    β”‚   β”‚   └── πŸ“„ EmptyState.tsx
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ layout/          # Layout components
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ MainLayout.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ DashboardLayout.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ Header.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“„ Footer.tsx
    β”‚   β”‚   └── πŸ“„ Sidebar.tsx
    β”‚   β”‚
    β”‚   └── πŸ“ ui/              # Base UI components
    β”‚       β”œβ”€β”€ πŸ“„ Button.tsx
    β”‚       β”œβ”€β”€ πŸ“„ Card.tsx
    β”‚       β”œβ”€β”€ πŸ“„ Modal.tsx
    β”‚       β”œβ”€β”€ πŸ“„ Badge.tsx
    β”‚       └── πŸ“„ Tooltip.tsx
    β”‚
    β”œβ”€β”€ πŸ“ features/            # Feature modules
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ auth/           # Authentication
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ LoginPage.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ RegisterPage.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ ProfilePage.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“ components/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ LoginForm.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ RegisterForm.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ SocialLogin.tsx
    β”‚   β”‚   └── πŸ“ hooks/
    β”‚   β”‚       └── πŸ“„ useAuthForm.ts
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ products/       # Products
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductsPage.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductDetailPage.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ WishlistPage.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“ components/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductCard.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductGrid.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductFilters.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductSort.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ProductDetail.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ ProductGallery.tsx
    β”‚   β”‚   └── πŸ“ hooks/
    β”‚   β”‚       └── πŸ“„ useProductFilters.ts
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ cart/           # Shopping Cart
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CartPage.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ CheckoutPage.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“ components/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CartItem.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CartSummary.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ CheckoutForm.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ PaymentForm.tsx
    β”‚   β”‚   └── πŸ“ hooks/
    β”‚   β”‚       └── πŸ“„ useCheckout.ts
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ orders/         # Orders
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ MyOrdersPage.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ OrderDetailPage.tsx
    β”‚   β”‚   β”œβ”€β”€ πŸ“ components/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ OrderCard.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ OrderTimeline.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ OrderStatusBadge.tsx
    β”‚   β”‚   └── πŸ“ hooks/
    β”‚   β”‚       └── πŸ“„ useOrderTracking.ts
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ reviews/        # Product Reviews
    β”‚   β”‚   β”œβ”€β”€ πŸ“ components/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ReviewCard.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ReviewForm.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ReviewList.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ RatingStars.tsx
    β”‚   β”‚   └── πŸ“ hooks/
    β”‚   β”‚       └── πŸ“„ useReviewForm.ts
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ dashboard/      # User Dashboard
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   └── πŸ“„ DashboardPage.tsx
    β”‚   β”‚   └── πŸ“ components/
    β”‚   β”‚       β”œβ”€β”€ πŸ“„ DashboardStats.tsx
    β”‚   β”‚       └── πŸ“„ RecentOrders.tsx
    β”‚   β”‚
    β”‚   β”œβ”€β”€ πŸ“ admin/          # Admin Panel
    β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ AdminDashboardPage.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ManageProductsPage.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ManageOrdersPage.tsx
    β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“„ ManageUsersPage.tsx
    β”‚   β”‚   β”‚   └── πŸ“„ AddProductPage.tsx
    β”‚   β”‚   └── πŸ“ components/
    β”‚   β”‚       β”œβ”€β”€ πŸ“„ AdminStats.tsx
    β”‚   β”‚       β”œβ”€β”€ πŸ“„ ProductTable.tsx
    β”‚   β”‚       β”œβ”€β”€ πŸ“„ OrderTable.tsx
    β”‚   β”‚       β”œβ”€β”€ πŸ“„ UserTable.tsx
    β”‚   β”‚       └── πŸ“„ ProductForm.tsx
    β”‚   β”‚
    β”‚   └── πŸ“ home/           # Home Page
    β”‚       β”œβ”€β”€ πŸ“ pages/
    β”‚       β”‚   └── πŸ“„ HomePage.tsx
    β”‚       └── πŸ“ components/
    β”‚           β”œβ”€β”€ πŸ“„ Hero.tsx
    β”‚           β”œβ”€β”€ πŸ“„ FeaturedProducts.tsx
    β”‚           β”œβ”€β”€ πŸ“„ LatestProducts.tsx
    β”‚           β”œβ”€β”€ πŸ“„ Categories.tsx
    β”‚           └── πŸ“„ Testimonials.tsx
    β”‚
    β”œβ”€β”€ πŸ“ store/              # Global State (Zustand)
    β”‚   β”œβ”€β”€ πŸ“„ auth.store.ts   # Authentication state
    β”‚   β”œβ”€β”€ πŸ“„ cart.store.ts   # Shopping cart state
    β”‚   β”œβ”€β”€ πŸ“„ wishlist.store.ts  # Wishlist state
    β”‚   └── πŸ“„ theme.store.ts  # Theme/Dark mode state
    β”‚
    β”œβ”€β”€ πŸ“ hooks/              # Custom React Hooks
    β”‚   β”œβ”€β”€ πŸ“„ useDebounce.ts
    β”‚   β”œβ”€β”€ πŸ“„ useLocalStorage.ts
    β”‚   β”œβ”€β”€ πŸ“„ useMediaQuery.ts
    β”‚   β”œβ”€β”€ πŸ“„ useOnClickOutside.ts
    β”‚   └── πŸ“„ useIntersectionObserver.ts
    β”‚
    β”œβ”€β”€ πŸ“ lib/                # Third-party integrations
    β”‚   β”œβ”€β”€ πŸ“„ firebase.ts     # Firebase setup
    β”‚   β”œβ”€β”€ πŸ“„ axios.ts        # Axios instance & interceptors
    β”‚   └── πŸ“„ queryClient.ts  # React Query client
    β”‚
    β”œβ”€β”€ πŸ“ types/              # TypeScript Types
    β”‚   β”œβ”€β”€ πŸ“„ index.ts        # Global types
    β”‚   β”œβ”€β”€ πŸ“„ api.types.ts    # API response types
    β”‚   └── πŸ“„ form.types.ts   # Form types
    β”‚
    β”œβ”€β”€ πŸ“ utils/              # Utility Functions
    β”‚   β”œβ”€β”€ πŸ“„ helpers.ts      # General helpers
    β”‚   β”œβ”€β”€ πŸ“„ validators.ts   # Validation functions
    β”‚   β”œβ”€β”€ πŸ“„ formatters.ts   # Data formatters
    β”‚   └── πŸ“„ constants.ts    # App constants
    β”‚
    β”œβ”€β”€ πŸ“ styles/             # Styles
    β”‚   β”œβ”€β”€ πŸ“„ global.css      # Global CSS
    β”‚   └── πŸ“„ theme.ts        # MUI theme configuration
    β”‚
    β”œβ”€β”€ πŸ“ config/             # Configuration
    β”‚   └── πŸ“„ index.ts        # App config
    β”‚
    └── πŸ“ assets/             # Static Assets
        β”œβ”€β”€ πŸ“ images/         # Images
        β”œβ”€β”€ πŸ“ icons/          # Icons
        └── πŸ“ fonts/          # Custom fonts

πŸ“ File Naming Conventions

Components

  • PascalCase: ProductCard.tsx, UserProfile.tsx
  • Suffix with type: LoginPage.tsx, CartItem.tsx

Hooks

  • camelCase with 'use' prefix: useAuth.ts, useProducts.ts

Utilities

  • camelCase: helpers.ts, validators.ts

Types

  • PascalCase: User, Product, Order
  • Suffix interfaces with 'Props': ButtonProps, CardProps

Constants

  • UPPER_SNAKE_CASE: API_BASE_URL, MAX_FILE_SIZE

🎯 Import Patterns

With Path Aliases

// βœ… Good (using @/ alias)
import { useAuthStore } from '@/store/auth.store';
import { ProductCard } from '@/components/products/ProductCard';
import { formatCurrency } from '@/utils/helpers';

// ❌ Avoid (relative paths)
import { useAuthStore } from '../../../store/auth.store';

Barrel Exports

// components/ui/index.ts
export { Button } from './Button';
export { Card } from './Card';
export { Modal } from './Modal';

// Usage
import { Button, Card, Modal } from '@/components/ui';

πŸ“¦ Key Dependencies by Directory

/api - React Query

import { useQuery, useMutation } from '@tanstack/react-query';

/store - Zustand

import { create } from 'zustand';
import { persist } from 'zustand/middleware';

/components - MUI + Framer Motion

import { Box, Button } from '@mui/material';
import { motion } from 'framer-motion';

/lib - Firebase + Axios

import { getAuth } from 'firebase/auth';
import axios from 'axios';

πŸ” Finding Code

Need to add authentication?

β†’ src/features/auth/ or src/store/auth.store.ts

Need to modify product display?

β†’ src/features/products/components/

Need to change API calls?

β†’ src/api/

Need to update global state?

β†’ src/store/

Need to add utilities?

β†’ src/utils/

Need to update types?

β†’ src/types/


πŸ“š Documentation Files

File Purpose
README.md Complete project documentation
UPGRADE_SUMMARY.md Detailed upgrade report
QUICK_START.md Quick setup guide
FILE_STRUCTURE.md This file - structure guide

🎯 Key Principle: Everything has its place, and there's a place for everything!