HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-26-0-120 6.17.0-1009-aws #9~24.04.2-Ubuntu SMP Fri Mar 6 23:50:29 UTC 2026 x86_64
User: ubuntu (1000)
PHP: 8.3.6
Disabled: NONE
Upload Files
File: //var/www/html/api.aianced.com/SETUP.md
# Aianced API — Setup Guide

## 1. Install dependencies

```bash
cd aianced-api
composer install
```

## 2. Configure environment

```bash
cp .env.example .env
php artisan key:generate
```

Fill in `.env`:
- `DB_*` — your MySQL credentials
- `MAIL_*` — your SMTP / Mailgun credentials
- `AIANCED_ADMIN_EMAIL` — your email for lead notifications

## 4. Run migrations

```bash
php artisan migrate
```

## 5. Set up queue (for async email)

```bash
php artisan queue:table
php artisan migrate
php artisan queue:work --daemon
```

Or use a supervisor process on your server.

## 6. Deploy to server

Point `api.aianced.com` to the `public/` folder of this Laravel project.

Add to `.htaccess` or Apache vhost:
```
DocumentRoot /var/www/aianced-api/public
```

## 7. CORS for local development

In `config/cors.php`, temporarily add:
```php
'http://localhost:5173',
```
Remove before going to production.

## 8. Update frontend API URL

In `aianced-app/src/config/api.js`:
```js
const BASE_URL = 'https://api.aianced.com/api/v1';
```

## Endpoints

| Method | URL | Description |
|--------|-----|-------------|
| POST | `/api/v1/analyze` | Analyze idea, return summary |
| POST | `/api/v1/leads` | Store lead + send admin email |

## Phase 2 — Real AI

When ready to use real AI:
1. Set `AIANCED_AI_PROVIDER=openai` in `.env`
2. Add `OPENAI_API_KEY=sk-...`
3. Uncomment the OpenAI block in `AiAnalysisService::analyze()`
4. Run `composer require openai-php/laravel`

The frontend requires zero changes.