# Deploy to hadiyahbazar.com

## 1. DNS (at your domain registrar)
Point the domain to your server's IP:

| Type | Name | Value        |
|------|------|--------------|
| A    | @    | SERVER_IP    |
| A    | www  | SERVER_IP    |

DNS can take from a few minutes to a few hours to update.

## 2. Server (Ubuntu example)
```bash
sudo apt update
sudo apt install nginx mysql-server php8.3-fpm php8.3-mysql php8.3-mbstring php8.3-xml php8.3-curl php8.3-zip unzip git composer
sudo mysql -e "CREATE DATABASE hadiyahbazar CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'hadiyah_user'@'localhost' IDENTIFIED BY 'change-this-password';
GRANT ALL ON hadiyahbazar.* TO 'hadiyah_user'@'localhost'; FLUSH PRIVILEGES;"
```

## 3. Project
Create the Laravel project and merge the dashboard files as described in the main README, at `/var/www/hadiyahbazar`, then:

```bash
cd /var/www/hadiyahbazar
cp deploy/.env.production.example .env      # edit DB_PASSWORD
composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan migrate --force
php artisan config:cache && php artisan route:cache && php artisan view:cache
sudo chown -R www-data:www-data storage bootstrap/cache
```

## 4. Web server + HTTPS
```bash
sudo cp deploy/nginx-hadiyahbazar.conf /etc/nginx/sites-available/hadiyahbazar
sudo ln -s /etc/nginx/sites-available/hadiyahbazar /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d hadiyahbazar.com -d www.hadiyahbazar.com
```

## 5. After going live
- Register your admin account at https://hadiyahbazar.com/register, then disable public registration
  (remove the register route in `routes/auth.php`) so strangers cannot sign up.
- Keep `APP_DEBUG=false`.
- Schedule regular backups (Database Backup page, or `mysqldump` from cron).

Shared hosting (cPanel)? Point the domain's document root to the project's `public` folder, import the
database through phpMyAdmin or run `php artisan migrate` over SSH, and use the same `.env` values.
