Aplikasi frontend e-commerce gadget modern berbasis web yang dibangun dengan React, TypeScript, dan Vite. Menyediakan pengalaman berbelanja yang cepat dan responsif dengan UI yang Minimalis menggunakan Tailwind CSS dan Radix UI.
- Fitur Utama
- Teknologi
- Prasyarat
- Instalasi
- Menjalankan Project
- Build & Deployment
- Struktur Project
- Environment Variables
- Development Guide
- Troubleshooting
- Autentikasi: Login dan registrasi pengguna
- Katalog Produk: Browsing dan pencarian produk dari berbagai brand
- Detail Produk: Informasi lengkap produk dengan gambar dan deskripsi
- Wishlist: Simpan produk favorit
- Pesanan: Riwayat dan manajemen pesanan
- Profil Pengguna: Kelola data akun dan preferensi
- Dark Mode: Tema gelap untuk kenyamanan mata
- Responsive Design: Optimal di semua ukuran layar
- Real-time Updates: Menggunakan React Query untuk data management
Frontend Framework & Build:
- React 19.2.3
- TypeScript
- Vite 5.x
- React Router 7.x
Styling & UI:
- Tailwind CSS 4.x
- Radix UI Components
- Lucide React Icons
- Motion (Animations)
State Management & API:
- React Query (@tanstack/react-query)
- Axios (HTTP Client)
- Interceptors untuk request/response
Tema & Aksesibilitas:
- Next Themes (Dark Mode)
- Radix UI (Accessible Components)
Developer Tools:
- ESLint
- TypeScript Type Checking
Sebelum memulai, pastikan Anda sudah menginstal:
-
Node.js (v16.0.0 atau lebih tinggi)
- Download: https://nodejs.org/
- Verifikasi:
node --versiondannpm --version
-
npm atau yarn (included dengan Node.js)
-
Git (untuk version control)
- Download: https://git-scm.com/
git clone https://github.com/yourusername/KuchiStore-FE.git
cd KuchiStore-FEMenggunakan npm:
npm installAtau menggunakan yarn:
yarn installBuat file .env.local di root project dan tambahkan konfigurasi berikut:
# API Configuration
VITE_API_BASE_URL=http://localhost:3000/api
VITE_API_TIMEOUT=10000
# Application
VITE_APP_NAME=KuchiStoreV2
VITE_APP_VERSION=2.0.0dist/
βββ index.html # HTML entry point
βββ assets/
β βββ index-*.js # JavaScript bundle (minified)
β βββ index-*.css # CSS bundle (minified)
βββ Brands/ # Static assets
## π Struktur Project
src/
βββ main.tsx # Entry point aplikasi
βββ app.css # Global styles
βββ index.css # Base styles
βββ components/
β βββ Common/ # Reusable components
β β βββ Navbar.tsx
β β βββ Sidebar.tsx
β β βββ Accordion.tsx
β β βββ Calendar.tsx
β β βββ Carousel.tsx
β β βββ Combobox.tsx
β β βββ Pagination.tsx
β β βββ Select.tsx
β β βββ Table.tsx
β β βββ Card/
β βββ Layout/ # Layout components
β β βββ Store.tsx
β βββ ui/ # Shadcn/ui components
βββ frontend/ # Page components
β βββ 404.tsx
β βββ Loading.tsx
β βββ LoginPage.tsx
β βββ RegisterPage.tsx
β βββ Home/
β βββ Store/
β βββ Orders/
β βββ Profile/
β βββ Wishlist/
β βββ Help/
βββ context/ # React Context
β βββ AuthContext.ts
β βββ ThemeContext.ts
βββ hooks/ # Custom React Hooks
β βββ useAuth.ts
β βββ useTheme.ts
β βββ useWindow.ts
β βββ use-mobile.ts
βββ utils/
β βββ services/ # API calls
β β βββ Auth/
β β βββ Account/
β β βββ Products/
β β βββ Orders/
β β βββ Wishlists/
β βββ types/ # TypeScript types & interfaces
β β βββ Form.ts
β β βββ Response.ts
β β βββ Auth/
β β βββ Account/
β β βββ Orders/
β β βββ Wishlists/
β βββ data/ # Static data & constants
β βββ util/ # Helper utilities
βββ lib/
βββ utils.ts # Utility functions
Untuk development, buat file .env.local:
# API Configuration
VITE_API_BASE_URL=http://localhost:3000/api
VITE_API_TIMEOUT=10000
# Feature Flags
VITE_ENABLE_DEMO_MODE=false| Variable | Default | Deskripsi |
|---|---|---|
VITE_API_BASE_URL |
http://localhost:3000/api |
Base URL untuk API backend |
VITE_API_TIMEOUT |
10000 |
Timeout API request (ms) |
VITE_ENABLE_DEMO_MODE |
false |
Mode demo untuk testing |
# Development server
npm run dev
# Production build
npm run build
# Lint code
npm run lint
# Preview production build
npm run preview- TypeScript: Strict mode enabled
- Styling: Tailwind CSS + CSS Modules (jika diperlukan)
- Components: Functional components dengan hooks
- API Calls: Gunakan React Query untuk data fetching
- Error Handling: Try-catch untuk async operations
- Folder Structure: Gunakan struktur yang ada, jangan buat folder baru tanpa discussion
- Component Naming: PascalCase untuk component files (.tsx)
- Constants: Simpan di
utils/data/ - Types: Simpan di
utils/types/ - API Calls: Buat service files di
utils/services/ - Hooks: Buat custom hooks di
hooks/
import { FC } from "react";
interface Props {
// Define props here
}
const MyComponent: FC<Props> = ({}) => {
return <div>{/* JSX here */}</div>;
};
export default MyComponent;import api from "../interceptor";
export const myService = async () => {
try {
const response = await api.get("/endpoint");
return response.data;
} catch (error) {
console.error("Error:", error);
throw error;
}
};- tsconfig.json: Base configuration
- tsconfig.app.json: Application-specific config
- tsconfig.node.json: Node.js tools config
Konfigurasi berada di vite.config.ts:
- Path alias:
@/βsrc/ - React plugin untuk HMR
- Tailwind CSS Vite plugin
Konfigurasi di eslint.config.js:
npm run lint # Check linting issues
npm run lint --fix # Auto-fix issues- Create feature branch:
git checkout -b feature/your-feature - Commit changes:
git commit -m 'Add your feature' - Push branch:
git push origin feature/your-feature - Open Pull Request
FelienZ
Last Updated: December 2025