CLAUDE.md
CLAUDE.mdCLAUDE.mdroot
Quality
100/100
Scores the file, not the repository.Length
664 words
16 headings · 7 code blocksRepository
28k
— · pushed 3 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Project Overview67Bagisto 2.4.x - open-source Laravel 12 e-commerce platform. PHP 8.3+, Vue.js 3, Tailwind CSS 3, Vite 5.89## Common Commands1011### Development12```bash13composer install # Install PHP dependencies14php artisan bagisto:install # Full installation (migrations, seeders, assets)15php artisan serve # Start PHP dev server16php artisan optimize:clear # Clear all caches (run after config/code changes)17```1819### Testing20```bash21vendor/bin/pest # Run all tests22vendor/bin/pest --testsuite="Admin Feature Test" # Run a specific test suite23vendor/bin/pest packages/Webkul/Admin/tests/Feature # Run tests in a directory24vendor/bin/pest --filter="test name" # Run a single test by name25```2627Test suites defined in `phpunit.xml`: Admin Feature, Core Unit, Customer Unit, DataGrid Unit, Installer Feature, PayU Unit/Feature, Razorpay Unit/Feature, Shop Feature, Stripe Unit/Feature.2829Tests use **Pest 3** with package-specific TestCase classes bound in `tests/Pest.php`. Each package's tests live in `packages/Webkul/<Package>/tests/`.3031### E2E Tests (Playwright)32E2E tests are run from within each package directory. Each package has its own Playwright config and tests:3334**Admin**:35```bash36cd packages/Webkul/Admin37npm install38npx playwright install --with-deps chromium39npx playwright test --config=tests/e2e-pw/playwright.config.ts40```4142**Shop**:43```bash44cd packages/Webkul/Shop45npm install46npx playwright install --with-deps chromium47npx playwright test --config=tests/e2e-pw/playwright.config.ts48```4950Tests require a running Laravel server (`php artisan serve`) and seeded database. Set `BASE_URL` env var if not using default.5152### Code Style53```bash54vendor/bin/pint # Fix PHP code style (Laravel Pint)55vendor/bin/pint --test # Check style without fixing56```5758### Translations59When adding new translation keys, always provide translations for **all locales** in the package's `Resources/lang/` directory. Verify with:60```bash61php artisan bagisto:translations:check62```6364## Architecture6566### Modular Package System6768All core functionality lives in **`packages/Webkul/`** (~42 packages). Each package is a self-contained Laravel package with its own models, controllers, routes, views, migrations, and service providers.6970**Dual registration**: Each package registers in two places:711. **`bootstrap/providers.php`** - Main ServiceProvider (routes, views, events, config)722. **`config/concord.php`** - ModuleServiceProvider (Konekt Concord model/enum registration)7374### Key Design Patterns7576**Repository Pattern**: All database access goes through repositories (`Prettus L5 Repository`). Interfaces in `Contracts/`, implementations in `Repositories/`. Never use models directly for queries in controllers.7778**Proxy Pattern**: Models have Proxy classes (e.g., `ProductProxy`, `CategoryProxy`) enabling model substitution without modifying core code. Always reference proxies when type-hinting across packages.7980**Event-Driven Extensibility**: The framework fires events at key lifecycle points. Extend behavior via listeners rather than modifying core packages.8182### Package Anatomy8384```85packages/Webkul/<Package>/src/86├── Config/ # system.php (admin settings), admin-menu.php, acl.php87├── Database/ # Migrations/, Seeders/, Factories/88├── Http/Controllers/ # Separate Admin/ and Shop/ controller directories89├── Models/ # Eloquent models + Proxy classes90├── Repositories/ # Data access layer91├── Contracts/ # Interfaces for models and repositories92├── Resources/93│ ├── views/ # Blade templates (admin/, shop/)94│ ├── lang/ # Localization (translatable strings)95│ └── assets/ # CSS/JS source files96├── Routes/ # admin-routes.php, shop-routes.php, api.php97├── Providers/ # ServiceProvider + ModuleServiceProvider98└── Listeners/ # Event listeners99```100101### Frontend Assets102103Admin, Shop, and Installer each have independent Vite builds. Run `npm install` and `npm run dev`/`npm run build` from within the respective package directory:104- **Admin**: `packages/Webkul/Admin/` builds to `public/themes/admin/default/build/`105- **Shop**: `packages/Webkul/Shop/` builds to `public/themes/shop/default/build/`106- **Installer**: `packages/Webkul/Installer/`107108Vue 3 components are used within Blade templates via `@pushOnce('scripts')` / Blade component slots.109110### Naming Conventions111112- **Namespace**: `Webkul\<PackageName>` (e.g., `Webkul\Product`)113- **Routes**: Separate `admin-routes.php` and `shop-routes.php` per package114- **Models**: Singular (`Product`, `Category`)115- **Repositories**: `<Model>Repository` (e.g., `ProductRepository`)116- **Controllers**: `<Model>Controller` in `Http/Controllers/Admin/` or `Shop/`117118### Adding a New Package1191201. Create `packages/Webkul/<Name>/src/` with the standard structure1212. Add PSR-4 namespace to root `composer.json` autoload1223. Register ServiceProvider in `bootstrap/providers.php`1234. Register ModuleServiceProvider in `config/concord.php`1245. Run `composer dump-autoload && php artisan optimize:clear`125126Or use: `php artisan package:make Webkul/<Name>` (requires `bagisto/bagisto-package-generator`)127128## CI Pipeline129130- **pest_tests.yml**: Pest tests on PHP 8.3 + MySQL 8.0131- **pint_tests.yml**: Code style checks with Laravel Pint132- **admin_playwright_tests.yml / shop_playwright_tests.yml**: E2E tests (6 parallel shards)133- **translation_tests.yml**: Translation file validation134
Also in bagisto/bagisto
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagisto.github/copilot-instructions.md · 28k | Copilot instructions | setupbuildteststyle+5 | 97/100 | 3 days ago | |
| bagisto/bagistoAGENTS.md · 28k | AGENTS.md | setupbuildteststyle+7 | 100/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 950 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| livewire/livewireCLAUDE.md · 24k | CLAUDE.md | setupbuildteststyle+4 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| lollipopkit/flutter_server_boxCLAUDE.md · 8.3k | CLAUDE.md | buildteststylearch+2 | 98/100 | 3 days ago | |
| supabase/supabase.claude/CLAUDE.md · 107k | CLAUDE.md | testlint-formatstylearch+1 | 97/100 | 3 days ago | |
| MetaMask/metamask-design-systemCLAUDE.md · 34 | CLAUDE.md | buildtestlint-formatstyle+5 | 97/100 | 3 days ago |
