Một ứng dụng web bán hàng demo được xây dựng với React, TypeScript và Vite, sử dụng kiến trúc feature-based.
- 🛍️ Trang chủ với sản phẩm nổi bật
- 📱 Danh sách sản phẩm với filter theo danh mục
- 🔍 Chi tiết sản phẩm với hình ảnh và thông tin đầy đủ
- 🛒 Giỏ hàng với quản lý số lượng
- 💳 Trang thanh toán với form thông tin giao hàng
- 🔐 Đăng nhập/Đăng ký (demo)
- 📱 Responsive design
- ⚡ Fast loading với lazy loading
- 🎨 UI hiện đại với Tailwind CSS
src/
├── app/ # App layer - Core application setup
│ ├── layouts/ # Application layouts (RootLayout, AuthLayout)
│ ├── providers/ # App providers (Auth, Query, etc.)
│ └── router/ # Router configuration with lazy loading
├── features/ # Feature modules
│ └── shop/ # Shop feature
│ └── pages/ # Shop pages (Home, Products, Cart, etc.)
├── shared/ # Shared utilities and components
│ ├── components/ # Reusable UI components
│ ├── constants/ # App constants
│ ├── hooks/ # Custom hooks
│ ├── services/ # API services
│ ├── types/ # TypeScript type definitions
│ └── utils/ # Utility functions
├── components/ # Base UI components
│ ├── base/ # Base components (Loading, etc.)
│ └── ui/ # UI components
├── pages/ # Auth pages
│ └── auth/ # Login, Register pages
├── hooks/ # Application-specific hooks
└── lib/ # Library utilities
- Frontend Framework: React 18 + TypeScript
- Build Tool: Vite
- Styling: Tailwind CSS
- State Management: React Context + useState
- Data Fetching: React Query (TanStack Query)
- Routing: React Router DOM v6
- Form Handling: Native HTML forms
- Icons: Lucide React
- Code Quality: ESLint + Prettier
- Node.js 18+
- npm hoặc yarn hoặc pnpm
- Clone repository:
git clone <repository-url>
cd techstore-demo- Cài đặt dependencies:
npm install
# hoặc
yarn install
# hoặc
pnpm install- Tạo file .env (tùy chọn):
VITE_API_URL=https://fakestoreapi.com- Chạy development server:
npm run dev
# hoặc
yarn dev
# hoặc
pnpm devpnpm add -D @commitlint/config-conventional
- Mở trình duyệt: http://localhost:5173
npm run dev- Chạy development servernpm run build- Build cho productionnpm run preview- Preview production buildnpm run lint- Chạy ESLintnpm run lint:fix- Tự động fix ESLint errors
- Hero section với call-to-action
- Hiển thị sản phẩm nổi bật
- Navigation menu
- Danh sách tất cả sản phẩm
- Filter theo danh mục (Điện thoại, Laptop, Tablet, Phụ kiện)
- Responsive grid layout
- Hình ảnh sản phẩm với thumbnail
- Thông tin chi tiết và tính năng
- Chọn số lượng và thêm vào giỏ hàng
- Đánh giá và reviews
- Hiển thị sản phẩm đã chọn
- Tăng/giảm số lượng
- Tính tổng tiền tự động
- Miễn phí ship cho đơn hàng trên 50M
- Form thông tin giao hàng
- Chọn phương thức thanh toán
- Tóm tắt đơn hàng
- Protected route (cần đăng nhập)
- Đăng nhập demo (admin@test.com / password)
- Đăng ký tài khoản mới
- Simple localStorage-based auth
- Mỗi feature được tổ chức trong thư mục riêng
- Shared components và utilities được tái sử dụng
- Clear separation of concerns
- Providers: Quản lý global state và context
- Router: Cấu hình routing với lazy loading
- Layouts: Layout components cho các loại trang khác nhau
- Components: UI components có thể tái sử dụng
- Services: API clients và business logic
- Types: TypeScript type definitions
- Utils: Helper functions và utilities
- Design System: Consistent color scheme và typography
- Responsive: Mobile-first approach
- Loading States: Skeleton loading và spinners
- Error Handling: User-friendly error messages
- Accessibility: Semantic HTML và keyboard navigation
- Cập nhật mock data trong các page components
- Hoặc tích hợp với API thực tế
- Cập nhật Tailwind config
- Sửa CSS variables trong index.css
- Tạo feature module mới trong
src/features/ - Thêm routes trong
src/app/router/routes.tsx - Cập nhật navigation
- Mobile: < 768px
- Tablet: 768px - 1024px
- Desktop: > 1024px
npm run build
npm run previewBuild output sẽ được tạo trong thư mục dist/
- Fork repository
- Tạo feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Tạo Pull Request
Dự án này được phân phối dưới MIT License. Xem file LICENSE để biết thêm chi tiết.