# Development Setup Instructions

## Running Without Docker for Development

You can run the application without Docker containers for easier development by running the frontend and backend services directly on your host machine.

## Prerequisites

- Node.js 18+ and npm
- PHP 8.1+ with required extensions
- MySQL/MariaDB database
- Redis (optional, for caching)

## Backend Setup

1. **Install PHP Dependencies:**
   ```bash
   cd backend
   composer install
   ```

2. **Configure Environment:**
   ```bash
   cp .env.example .env
   # Edit .env with your database credentials
   ```

3. **Start Backend Server:**
   ```bash
   cd backend
   php -S localhost:8080
   ```

## Frontend Setup

1. **Install Dependencies:**
   ```bash
   cd frontend
   npm install
   ```

2. **Configure Environment:**
   ```bash
   cp .env.example .env.local
   # Edit .env.local with your API URL
   ```

3. **Start Development Server:**
   ```bash
   cd frontend
   npm run dev
   ```

## Access the Application

- Frontend: http://localhost:5173
- Backend API: http://localhost:8080
- Full Application: http://localhost:5173 (will proxy API calls to backend)

## Benefits of Development Setup

- **Hot Reload**: Frontend automatically reloads on code changes
- **Fast Debugging**: No container overhead, direct file access
- **Easy Logging**: Direct access to logs and error messages
- **Database Access**: Direct connection to local database for debugging
- **No Docker Issues**: Avoid container networking and volume mounting problems

## Switching Between Development and Production

To switch back to Docker setup:
```bash
# Stop development servers
# Kill PHP server (Ctrl+C)
# Kill npm dev server (Ctrl+C)

# Start Docker containers
docker-compose -f docker-compose.unified.yml up -d
```

## Troubleshooting

If you encounter issues:

1. **Port Conflicts**: Make sure ports 8080 (backend) and 5173 (frontend) are available
2. **Database Connection**: Verify MySQL is running and credentials in .env are correct
3. **PHP Extensions**: Ensure all required PHP extensions are installed
4. **Node Version**: Make sure you're using Node.js 18+
