# Deployment Guide
## AHABA Journal of Creative Arts (AJCA) Management System

---

## Prerequisites

- PHP 8.2 or higher
- MySQL 8.0 or higher
- Apache 2.4+ with mod_rewrite enabled
- Composer
- XAMPP (recommended for local development)

## Installation Steps

### 1. Extract the Application

Place the application in your web root (for XAMPP: `C:\xampp\htdocs\ahaba_journals`).

### 2. Create Database

Open phpMyAdmin or MySQL CLI and run:

```sql
CREATE DATABASE IF NOT EXISTS ajca_journal CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
```

### 3. Import Database Schema

```bash
mysql -u root -p ajca_journal < database/schema.sql
```

Or import `database/schema.sql` via phpMyAdmin.

### 4. Configure Environment

Copy `.env` to the root directory and configure:

```env
APP_URL=http://localhost/ahaba_journals
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=ajca_journal
DB_USERNAME=root
DB_PASSWORD=
```

### 5. Install Dependencies

```bash
cd C:\xampp\htdocs\ahaba_journals
composer install --optimize-autoloader
```

### 6. Set Permissions (Windows)

Ensure the following directories are writable:
- `storage/`
- `uploads/`
- `logs/`
- `cache/`

### 7. Configure Apache

Ensure `mod_rewrite` is enabled in Apache.

The `.htaccess` files are pre-configured for URL rewriting.

### 8. Access the Application

- **Public Website:** `http://localhost/ahaba_journals`
- **Admin Login:** `http://localhost/ahaba_journals/login`
- **Default Admin:** admin@ajca.org / password

## Default Admin Credentials

- **Email:** admin@ajca.org
- **Password:** password

## Directory Structure

```
ahaba_journals/
├── public/          # Web root (point your virtual host here)
├── app/             # Application controllers, models, services
├── core/            # Framework core classes
├── config/          # Configuration files
├── database/        # SQL schema and migrations
├── routes/          # Route definitions
├── resources/       # View templates
├── storage/         # File storage
├── uploads/         # User uploads
├── vendor/          # Composer dependencies
└── logs/            # Application logs
```

## Troubleshooting

### 404 Errors
- Ensure mod_rewrite is enabled
- Check `.htaccess` files exist in `public/` and root
- Verify `AllowOverride All` in Apache config

### Database Connection Errors
- Check database credentials in `.env`
- Ensure MySQL is running
- Verify the database exists

### Blank White Screen
- Set `APP_DEBUG=true` in `.env`
- Check PHP error logs in `logs/` directory
- Verify file permissions

### File Upload Issues
- Check `upload_max_filesize` and `post_max_size` in php.ini
- Ensure `uploads/` directory is writable

## Security Checklist

- [ ] Change default admin password immediately
- [ ] Set `APP_ENV=production` and `APP_DEBUG=false`
- [ ] Configure HTTPS/SSL
- [ ] Regular database backups
- [ ] Monitor audit logs
- [ ] Update file upload size limits as needed
- [ ] Configure firewall rules
- [ ] Set strong session encryption key

## Production Server Requirements

- PHP 8.2+ with extensions: PDO, MySQL, mbstring, openssl, json, fileinfo
- MySQL 8+ with InnoDB support
- Apache 2.4+ with mod_rewrite
- SSL certificate for HTTPS
- Minimum 2GB RAM, 10GB storage

## Backup Strategy

- Daily database backups: `mysqldump -u root -p ajca_journal > backup_$(date +%Y%m%d).sql`
- Regular uploads directory backups
- Store backups off-site or in cloud storage

## Support

For issues and support, contact the development team or refer to the documentation.
