# Quick Setup Guide

## Step 1: Install Dependencies

```bash
cd "Education for Life"
composer install
npm install
```

## Step 2: Configure Environment

```bash
# Windows
copy .env.example .env

# Linux/Mac
cp .env.example .env
```

Edit `.env` file:
```env
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=erp_system
DB_USERNAME=root
DB_PASSWORD=your_password

APP_KEY=base64:generate-a-random-32-char-key
JWT_SECRET=generate-a-random-jwt-secret-key
```

## Step 3: Setup Database

```sql
-- Create database
CREATE DATABASE erp_system CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

-- Import schema
-- Use your MySQL client or command line:
mysql -u root -p erp_system < ../project.sql
```

## Step 4: Verify Installation

Start the development server:
```bash
php -S localhost:8000 -t public
```

Open browser and test:
- Homepage: http://localhost:8000/
- Health check: http://localhost:8000/health
- API health: http://localhost:8000/api/health

## Step 5: Test API Authentication

### Login Request
```bash
curl -X POST http://localhost:8000/api/v1/auth/login \
  -H "Content-Type: application/json" \
  -d "{\"username\":\"admin\",\"password\":\"password\"}"
```

### Get Current User
```bash
curl -X GET http://localhost:8000/api/v1/auth/me \
  -H "Authorization: Bearer YOUR_TOKEN_HERE"
```

## Common Issues

### Issue: Database connection failed
**Solution:** Check your `.env` database credentials

### Issue: Composer dependencies not installed
**Solution:** Run `composer install` from project root

### Issue: JWT token errors
**Solution:** Make sure `JWT_SECRET` is set in `.env`

### Issue: Permission denied errors
**Solution:** 
```bash
# Windows (run as Administrator)
icacls storage /grant Everyone:(OI)(CI)F /T

# Linux/Mac
chmod -R 775 storage
chmod -R 775 bootstrap/cache
```

## Next Steps

1. Change default admin password
2. Configure email settings in `.env`
3. Customize company settings
4. Start building additional modules
5. Configure web server (Apache/Nginx) for production

## Useful Commands

```bash
# Compile assets for development
npm run dev

# Watch assets for changes
npm run watch

# Compile assets for production
npm run prod

# Run static analysis
composer phpstan

# Check coding standards
composer phpcs

# Run tests
composer test
```

## Development Tools

### VS Code Extensions (Recommended)
- PHP Intelephense
- PHP Debug
- EditorConfig
- GitLens
- ESLint
- Prettier

### Database Tools
- phpMyAdmin
- MySQL Workbench
- DBeaver
- HeidiSQL

## Support

Need help? Check:
- README.md for detailed documentation
- docs/ folder for module-specific guides
- GitHub issues for known problems
- Support email: support@educationforlife.org
