# 🚀 Laravel Livewire Base Template: Reusable Project Plan

> **પ્રોજેક્ટનું લક્ષ્ય (Goal):** એક એવો મજબૂત અને મોડ્યુલર બેઝ ટેમ્પલેટ તૈયાર કરવો, જે ભવિષ્યના કોઈપણ નવા પ્રોજેક્ટ માટે Starter Kit તરીકે વાપરી શકાય. જેમાં Admin Panel અને Frontend બંને માટે કોમન મોડ્યુલ્સ, પેજીસ અને કમ્પોનન્ટ્સ પહેલેથી જ તૈયાર અને Reusable હોય.

---

## ૧. ટેકનોલોજી સ્ટેક (Tech Stack)

| Component | Technology | ભૂમિકા / વિગત |
| :--- | :--- | :--- |
| **Backend Framework** | Laravel 10.x | Core PHP Framework |
| **Fullstack Reactive UI** | Livewire 3 | Single-page જેવો અનુભવ (SPA feel) વગર જટિલ JavaScript |
| **Client-side Interactivity**| Alpine.js | Livewire 3 માં ઇનબિલ્ટ (Dropdowns, Toggles) |
| **Base Styling** | Tailwind CSS v3 | Utility-first CSS Framework |
| **Interactive Components** | WireUI | Dynamic Forms, Selects, Datepicker, Toasts & Dialogs |
| **UI Styling & Themes** | DaisyUI (`d-` prefix) | Cards, Badges, Drawer Sidebar, 30+ Light/Dark Themes |
| **Access Control (RBAC)** | Spatie Permission | Roles, Permissions અને Guards મેનેજમેન્ટ |
| **Media & File Uploads** | Spatie MediaLibrary | Profile Avatar, Site Logo, Responsive Images |
| **Activity Tracking** | Spatie Activitylog | Audit Trail (કોણે શું ફેરફાર કર્યો તેનો લોગ) |
| **Global Search** | Spatie Searchable | Admin Header Multi-Model Search |
| **Frontend SEO** | Spatie Sitemap | Auto `sitemap.xml` Generation |
| **Dev Email Preview** | Spatie Mail-Preview *(dev)* | Localhost Browser Email Preview |

> 📌 **બધા પેકેજોનું વિગતવાર લિસ્ટ અને સ્ટેટસ જોવા માટે:** [PACKAGES.md](file:///c:/xampp/htdocs/laravel-livewire-10-template/PACKAGES.md)  
> 🛡️ **પ્રોજેક્ટના કડક ડેવલપમેન્ટ નિયમો (Strict Rules):** [RULES.md](file:///c:/xampp/htdocs/laravel-livewire-10-template/RULES.md)

---

## ૨. UI ઇન્ટિગ્રેશન અને પ્રિફિક્સ સ્ટ્રેટેજી (Design Architecture)

WireUI અને DaisyUI વચ્ચે કોઈ CSS અથડામણ (conflict) ન થાય તે માટે નીચેની સ્ટ્રેટેજી લાગુ કરવામાં આવશે:

```
+-------------------------------------------------------------------+
|                        TAILWIND CSS (BASE)                        |
+---------------------------------+---------------------------------+
|      WIREUI COMPONENTS          |       DAISYUI COMPONENTS        |
|  (No Prefix / Livewire Native)  |      (Prefix: "d-" applied)     |
+---------------------------------+---------------------------------+
| • <x-input />                   | • .d-card, .d-card-body         |
| • <x-select />                  | • .d-badge, .d-badge-primary    |
| • <x-datetime-picker />         | • .d-drawer, .d-drawer-side     |
| • <x-modal />                   | • .d-stats, .d-stat             |
| • $wireui.notify() [Toasts]     | • Themes: data-theme="dark"     |
| • $wireui.dialog() [Confirms]   | • .d-menu, .d-navbar            |
+---------------------------------+---------------------------------+
```

### કલર સિન્ક્રોનાઇઝેશન (Color Sync):
`tailwind.config.js` માં Primary અને Neutral કલર્સ એકસરખા રાખવામાં આવશે જેથી WireUI ના બટન/ઇનપુટ્સ અને DaisyUI ના કાર્ડ/બેજ એક જ ડિઝાઇન લેંગ્વેજમાં દેખાય.

---

## ૩. પ્રોજેક્ટ ફોલ્ડર સ્ટ્રક્ચર (Reusable Architecture)

```text
laravel-livewire-10-template/
├── app/
│   ├── Livewire/
│   │   ├── Admin/                    # Admin Panel Livewire Components
│   │   │   ├── Dashboard.php
│   │   │   ├── Users/
│   │   │   │   ├── UserIndex.php     # Search, filter, table
│   │   │   │   └── UserForm.php      # Create & Edit user
│   │   │   ├── Roles/
│   │   │   │   └── RoleManager.php   # Roles & Permissions CRUD
│   │   │   ├── Settings/
│   │   │   │   └── GeneralSetting.php# Logo, Title, SMTP, etc.
│   │   │   └── Activity/
│   │   │       └── ActivityLog.php   # System Audit logs
│   │   ├── Front/                    # Public Facing Frontend Pages
│   │   │   ├── Home.php
│   │   │   ├── About.php
│   │   │   └── Contact.php
│   │   └── Shared/                   # Front & Admin બંનેમાં વપરાતા Components
│   │       ├── Profile/
│   │       │   └── EditProfile.php
│   │       └── Components/
│   │           └── ConfirmDialog.php
│   ├── Models/
│   │   ├── User.php
│   │   └── Setting.php
│   └── Traits/
│       └── WithDatatable.php         # Sorting, Searching, Pagination trait
├── resources/
│   ├── css/
│   │   └── app.css
│   ├── js/
│   │   └── app.js
│   └── views/
│       ├── layouts/
│       │   ├── admin.blade.php       # Admin Layout (Sidebar, Header, WireUI Scripts)
│       │   ├── app.blade.php         # Public Frontend Layout (Navbar, Footer)
│       │   └── auth.blade.php        # Clean Auth Layout (Login, Register)
│       ├── livewire/
│       │   ├── admin/
│       │   ├── front/
│       │   └── shared/
│       └── components/               # Custom Reusable Blade Components
└── database/
    └── seeders/
        ├── RolePermissionSeeder.php  # Default Super Admin, Admin, User
        ├── AdminUserSeeder.php       # Default login credentials
        └── SettingSeeder.php         # Default site settings
```

---

## ૪. કોર મોડ્યુલ્સની યાદી (Core Modules Checklist)

- [ ] **1. Authentication System (Custom Livewire Auth):**
  - Login, Register (Enable/Disable via Settings)
  - Forgot Password & Reset Password
  - Update Profile, Change Password, Profile Avatar Upload
- [ ] **2. Role & Permission Management (RBAC):**
  - Spatie Permission ઇન્ટિગ્રેશન
  - Roles લિસ્ટ, Add/Edit Role, Permission Assigning UI
  - Super Admin Guard
- [ ] **3. User Management Module (CRUD with Datatable):**
  - Search, Filter by Role/Status, Column Sorting, Custom Pagination
  - User Status Toggle (Active / Inactive)
  - Bulk Actions (Delete, Change Status)
- [ ] **4. Global Settings Module:**
  - Site Name, Logo, Favicon, Contact Email, Meta Details
  - Maintenance Mode toggle
- [ ] **5. Reusable Datatable Trait:**
  - `WithDatatable` Trait જે ભવિષ્યમાં કોઈપણ નવા મોડેલ (દા.ત. Products, Orders, Leads) પર ૧ લાઈનમાં લાગુ કરી શકાય.
- [ ] **6. UI Notifications & Dialogs:**
  - WireUI Toast Notifications (Success, Error, Info, Warning)
  - Delete Confirmation Dialogs
- [ ] **7. Theme Switcher (DaisyUI):**
  - Light Mode & Dark Mode switch (User preference save in local storage/session)

---

## ૫. અમલીકરણના ૬ તબક્કા (6-Phase Implementation Roadmap)

```mermaid
flowchart TD
    P1[Phase 1: Environment & Package Setup] --> P2[Phase 2: Master Layouts & Styling Setup]
    P2 --> P3[Phase 3: Auth & Profile Management]
    P3 --> P4[Phase 4: Spatie RBAC & User Management]
    P4 --> P5[Phase 5: Global Settings & Reusable Utilities]
    P5 --> P6[Phase 6: Testing, Documentation & Boilerplate Cleanup]
```

### **Phase 1: Environment & Package Setup** ✅ (COMPLETED)
1. ✅ Livewire (v4.4.7) installed.
2. ✅ WireUI (v2.6.0) installed and config published (`config/wireui.php`).
3. ✅ Tailwind CSS (v3.4.17) + DaisyUI (v4.12.24 with `d-` prefix) configured and verified.
4. ✅ `postcss.config.js`, `tailwind.config.js`, and `resources/css/app.css` configured with successful Vite build.
5. ✅ Spatie Permission, MediaLibrary, Activitylog, Searchable, Sitemap, Mail Preview installed and published.

### **Phase 2: Master Layouts & Design Structure**
1. **Admin Layout (`admin.blade.php`):**
   - Responsive Collapsible Sidebar (DaisyUI Drawer)
   - Top Header with Breadcrumbs, Theme Toggle, Profile Dropdown
   - WireUI Scripts & Styles ઇન્ટિગ્રેશન
2. **Frontend Layout (`app.blade.php`):**
   - Clean Navbar, Content Container, Modern Footer
3. **Auth Layout (`auth.blade.php`):**
   - Center card, branding logo, background styling

### **Phase 3: Authentication & Security**
1. Login, Register, Forgot Password માટે Livewire કમ્પોનન્ટ્સ.
2. Livewire Profile Management (Avatar upload, personal info, update password).
3. Middleware protection (Admin routes vs Public routes).

### **Phase 4: RBAC & User Management (Full CRUD)**
1. `RolePermissionSeeder` થી બેઝિક રોલ્સ (Super Admin, Admin, Manager, User) તૈયાર કરવા.
2. Reusable Datatable સાથે User List View.
3. WireUI Modal અથવા Form પેજ દ્વારા User Add/Edit.
4. Role Assignment & Permission Check gates.

### **Phase 5: App Settings & Reusable Utilities**
1. Key-Value Settings Database Table & Model.
2. Settings Manager પેજ (Logo, Site Name, Footer Text, SEO).
3. Reusable Traits (`WithDatatable`, `WithNotifications`).

### **Phase 6: Review, Polish & Boilerplate Documentation**
1. બ્રાઉઝરમાં સંપૂર્ણ ટેસ્ટિંગ (Responsive & Cross-theme).
2. નવા પ્રોજેક્ટમાં આ ટેમ્પલેટને કેવી રીતે Clone/Rename કરવો તેનું સ્પષ્ટ `STARTER_GUIDE.md` બનાવવું.

---

## ૬. નવો પ્રોજેક્ટ શરૂ કરતી વખતે આનો ઉપયોગ કેવી રીતે થશે?
જ્યારે તમારે કોઈ નવો પ્રોજેક્ટ શરૂ કરવો હશે:
1. આ રિપોઝીટરી કોપી કરો.
2. `.env` માં નવું DB નામ સેટ કરો.
3. `php artisan migrate --seed` ચલાવો.
4. **તરત જ તમારું Login, Admin Panel, User Management, Roles અને Theme તૈયાર હશે!** તમે સીધું જ તમારા ક્લાયન્ટના નવા ફીચર્સ બનાવવાનું શરૂ કરી શકશો.
