Copilot instructions
.github/copilot-instructions.mdCopilot instructions
Quality
97/100
Scores the file, not the repository.Length
880 words
28 headings · 5 code blocksRepository
28k
— · pushed 3 days agoLast changed
3 days ago
First indexed 3 days ago.1# Bagisto Development Guide23## Project Overview45This is a **Bagisto** e-commerce platform - an open-source Laravel-based e-commerce framework. Bagisto is built with:6- **PHP** (Server-side)7- **Laravel** (PHP Framework)8- **Vue.js** (Frontend components)9- **Tailwind CSS** (Styling)1011## Architecture1213### Modular Package Structure1415Bagisto follows a modular, package-based architecture. All core features are organized into Laravel packages located in `packages/Webkul/`.1617### Available Packages1819- `Admin` - Administrative interface and management20- `Attribute` - Product attributes and attribute sets21- `BookingProduct` - Booking/rental functionality22- `CartRule` - Cart-based promotions23- `CatalogRule` - Catalog-based promotions24- `Category` - Category management25- `Checkout` - Cart and checkout process26- `CMS` - CMS pages27- `Core` - Core utilities and helpers28- `Customer` - Customer management29- `DataGrid` - Tabular data display component30- `DataTransfer` - Import/export data31- `DebugBar` - Debug toolbar32- `FPC` - Full page caching33- `GDPR` - GDPR compliance34- `ImageCache` - Image caching/resizing35- `Installer` - Installation wizard36- `Inventory` - Stock management37- `MagicAI` - AI features (Laravel AI SDK)38- `Marketing` - SEO, URL rewrites, search terms, campaigns39- `Notification` - Notifications40- `Payment` - Base payment classes (CashOnDelivery, MoneyTransfer)41- `Paypal` - PayPal integration42- `PayU` - PayU integration43- `Product` - Product management44- `Razorpay` - Razorpay integration45- `RMA` - Return merchandise authorization46- `Rule` - Shared rule engine base47- `Sales` - Order management48- `Shipping` - Shipping methods49- `Shop` - Customer storefront50- `Sitemap` - XML sitemap generation51- `SocialLogin` - OAuth social login52- `SocialShare` - Social sharing53- `Stripe` - Stripe integration54- `Tax` - Tax calculations55- `Theme` - Theme management56- `User` - Admin user management5758### Standard Package Structure5960Each package follows this structure:6162```63Package/src/64├── Config/ # Configuration files (admin-menu.php, system.php)65├── Database/66│ ├── Migrations/ # Database migrations67│ ├── Seeders/ # Database seeders68│ └── Factories/ # Model factories69├── Http/70│ ├── Controllers/ # Admin and Shop controllers71│ ├── Middleware/ # Route middleware72│ └── Requests/ # Form requests/validation73├── Models/ # Eloquent models with Proxy pattern74├── Repositories/ # Repository pattern (Prettus L5 Repository)75├── Resources/76│ ├── views/ # Blade views (admin/, shop/)77│ ├── lang/ # Localization files78│ └── assets/ # CSS, JS assets79├── Routes/ # admin-routes.php, shop-routes.php80├── Providers/ # Service providers81└── Contracts/ # Interface definitions82```8384## Development Patterns8586### Repository Pattern8788Bagisto uses **Prettus L5 Repository** for data access abstraction:89- Repository Contracts define interfaces90- Repository Implementations contain data access logic91- Works with Eloquent models9293### Event-Driven Architecture9495The framework triggers events throughout the application lifecycle for extensibility.9697### Proxy Pattern9899Models use proxy classes (e.g., `ProductProxy`) for extensibility.100101## Key Conventions102103### Naming Conventions104105- **Namespace**: `Webkul\<PackageName>`106- **Routes**: Separate `admin-routes.php` and `shop-routes.php`107- **Views**: Organized in `admin/` and `shop/` folders108- **Models**: Singular name (e.g., `Product`, `Category`)109- **Repositories**: `<ModelName>Repository` pattern110- **Controllers**: `<ModelName>Controller` in Admin/Shop folders111112### Package Registration1131141. Add namespace to `composer.json` psr-4 autoload1152. Run `composer dump-autoload`1163. Register ServiceProvider in `bootstrap/providers.php`1174. Register ModuleServiceProvider in `config/concord.php`1185. Run `php artisan optimize:clear`119120### Creating New Packages121122Use Bagisto Package Generator:123```bash124composer require bagisto/bagisto-package-generator125php artisan package:make Webkul/<PackageName>126```127128Or manually create:1291. Create `packages/Webkul/<PackageName>/src/`1302. Create Service Provider in `src/Providers/`1313. Update composer.json and register provider132133## Working with Features134135### Shipping Methods136- Extend `Webkul\Shipping\Carriers\AbstractCarrier`137- Configure in `Config/system.php`138- Register in service provider139140### Payment Methods141- Extend `Webkul\Payment\Payment\AbstractPayment`142- Configure in `Config/system.php`143144### Product Types145- Extend appropriate type class in `Product\Type/`146- Configure in `Config/product_types.php`147148### Themes149- Create in `packages/Webkul/<Theme>/`150- Use Vite for asset bundling — run `npm install` and `npm run build` from within the respective package directory (Admin, Shop, or Installer), not from the project root151- Follow Blade templating conventions152153## Code Style154155- Use **Pint** for PHP code style (`./vendor/bin/pint`)156- Follow Laravel conventions157- Use type hints where possible158- Write meaningful variable/method names159160## Testing161162### Pest (PHP)163```bash164vendor/bin/pest # Run all tests165vendor/bin/pest --testsuite="Admin Feature Test" # Run a specific test suite166vendor/bin/pest packages/Webkul/Admin/tests/Feature # Run tests in a directory167vendor/bin/pest --filter="test name" # Run a single test by name168```169Tests use **Pest 3** with package-specific TestCase classes. Each package's tests live in `packages/Webkul/<Package>/tests/`.170171### E2E Tests (Playwright)172Run from within each package directory:173```bash174# Admin175cd packages/Webkul/Admin && npm install && npx playwright install --with-deps chromium176cd packages/Webkul/Admin && npx playwright test --config=tests/e2e-pw/playwright.config.ts177178# Shop179cd packages/Webkul/Shop && npm install && npx playwright install --with-deps chromium180cd packages/Webkul/Shop && npx playwright test --config=tests/e2e-pw/playwright.config.ts181```182Tests require a running Laravel server (`php artisan serve`) and seeded database.183184### Translations185When adding new translation keys, provide translations for **all 21 locales** in the package's `Resources/lang/` directory. Verify with:186```bash187php artisan bagisto:translations:check188```189190## Documentation References191192- [Architecture Overview](https://devdocs.bagisto.com/architecture/overview.html)193- [Backend Architecture](https://devdocs.bagisto.com/architecture/backend.html)194- [Frontend Architecture](https://devdocs.bagisto.com/architecture/frontend.html)195- [Package Development](https://devdocs.bagisto.com/package-development/getting-started.html)196- [Shipping Method Development](https://devdocs.bagisto.com/shipping-method-development/getting-started.html)197- [Payment Method Development](https://devdocs.bagisto.com/payment-method-development/getting-started.html)198- [Product Type Development](https://devdocs.bagisto.com/product-type-development/getting-started.html)199- [Theme Development](https://devdocs.bagisto.com/theme-development/getting-started.html)200201## Important Notes202203- Never modify core packages directly - use events/listeners or create custom packages204- Clear caches after making changes: `php artisan optimize:clear`205- Use repository pattern for all database operations206- Follow the modular structure when adding new features207
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/bagistoAGENTS.md · 28k | AGENTS.md | setupbuildteststyle+7 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| louislam/uptime-kuma.github/copilot-instructions.md · 90k | Copilot instructions | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| chihebnabil/lovable-boilerplate.github/instructions/global.instructions.md · 63 | Copilot instructions | buildlint-formatstylearch+4 | 100/100 | 3 days ago | |
| thangaram611/second-brain.github/copilot-instructions.md · 0 | Copilot instructions | setupteststylearch+4 | 96/100 | 3 days ago | |
| nerolis-lab/nerolis-lab.github/copilot-instructions.md · 32 | Copilot instructions | setupbuildtestlint-format+11 | 96/100 | 3 days ago | |
| darkmatter/nixmac.github/copilot-instructions.md · 24 | Copilot instructions | setupbuildtestlint-format+8 | 96/100 | 3 days ago | |
| keycloak/keycloak.github/copilot-instructions.md · 36k | Copilot instructions | setupbuildtestlint-format+6 | 93/100 | 3 days ago | |
| photoprism/photoprism.github/copilot-instructions.md · 40k | Copilot instructions | buildtestlint-formatstyle+5 | 90/100 | 2 days ago | |
| koel/koel.github/copilot-instructions.md · 17k | Copilot instructions | buildtestlint-formatstyle+7 | 90/100 | 3 days ago |
