# Production deployment

This project is Laravel 12 and requires PHP 8.2 or newer (the Composer constraint is `^8.2`). Use a PHP hosting plan with MySQL/MariaDB, the Laravel-required PHP extensions, HTTPS, writable `storage` and `bootstrap/cache`, and SSH/Composer access. A static-only hosting plan cannot run this application.

## Subdomain setup

1. Create the subdomain in the hosting panel and enable its SSL certificate.
2. Set that subdomain's document root to the Laravel project's `public` folder. Keep `.env`, `app`, `vendor`, and the rest of the project outside the public web root. Do not move `public/index.php` to the project root.
3. Upload the project and install locked dependencies with `composer install --no-dev --optimize-autoloader`. The checked-in `public/build` assets are ready to serve; Node.js is only needed if rebuilding them.
4. Create a MySQL database and its dedicated database user. Copy `.env.example` to `.env`, then configure `APP_ENV=production`, `APP_DEBUG=false`, `APP_URL=https://your-subdomain.example`, a new `APP_KEY`, DB credentials, secure sessions, and SMTP email.
5. Set writable permissions for `storage` and `bootstrap/cache`; create the public upload symlink with `php artisan storage:link` (or ask the host to create the equivalent symlink if shared hosting blocks Artisan links).
6. Run `php artisan migrate --force`. Run `php artisan db:seed --class=DatabaseSeeder --force` only when you intend to create the initial roles/admin and demo catalog. Set `ADMIN_EMAIL` and `ADMIN_PASSWORD` before seeding production; never use the local demo password.
7. Configure the subdomain URL/DNS, confirm HTTPS, test seller application and admin approval, checkout, email, file uploads, and backups before opening sales.

## SSLCommerz

1. Create sandbox credentials with SSLCommerz and set `SSLCOMMERZ_STORE_ID`, `SSLCOMMERZ_STORE_PASSWORD`, and `SSLCOMMERZ_SANDBOX=true` in the hosting environment. Do not put live merchant credentials in Git or share them in chat.
2. Clear cached config after changing environment settings: `php artisan config:clear`.
3. Register `https://your-subdomain.example/payments/sslcommerz/ipn` in the SSLCommerz sandbox merchant panel and complete a sandbox checkout. Payment status is changed only after the app calls SSLCommerz's validation API and checks transaction ID, amount, and currency.
4. After merchant onboarding and sandbox approval, replace the variables with production Store ID/password and set `SSLCOMMERZ_SANDBOX=false`. Confirm SSL and the production IPN endpoint before accepting real payments.

## Marketplace operations

- Entrepreneurs apply at `/sell/register`; a store admin approves/rejects applications at `/admin/sellers`.
- Approved sellers submit products in their seller workspace. New or changed listings return to draft until an admin reviews and publishes them.
- Checkout creates a separate seller fulfillment record for each vendor in a mixed cart. Sellers see only their own items and can update their own fulfillment status.
- Commission defaults to 10% and can be adjusted per seller by an admin (0–50%). Current seller earnings are estimates; payouts are manual. This app does not yet transfer funds automatically to sellers or provide regulated escrow/split settlement.

## Important launch limits

Before public commercial launch, configure legal terms/privacy/returns, tax and shipping rules, customer email delivery, backups/restore, monitoring, and real product media. Test the deployed build using the production PHP/MySQL versions. SSLCommerz live checkout remains unavailable until the merchant supplies credentials and completes sandbox/live approval.
