# Istockhomes Live — Architecture (Phase 1)

**Status:** Phase 1 design + UI shells  
**Public path:** `/live/` (production `/public_html/live/`)  
**Secure config:** `App/secure/live/` (production `/public_html/App/secure/live/`)

## Controlling principle

**One Live Engine. Every Business.**

Live is a platform service, not a brand-specific product and not a second Foundation.

## Ownership boundaries

| Concern | Owner |
|---------|--------|
| Users, authentication, verification | **App2 / Foundation** |
| Businesses, permissions, listings, transactions | **App2 / Foundation** |
| Live sessions, scheduling, replays, business videos | **`/live/`** |
| Secrets (OpenAI One Key, DB credentials) | **`App/secure/`** — never inside `/live/` |
| Public media bytes | **One Public Uploads** `/App/uploads/` |

## Locked rules that apply

1. **RULE 1 — Never overwrite App broadly.** Phase 1 only *creates* `App/secure/live/`. No unrelated App edits.
2. **One Only One.** One Live engine; one video record per recording; no duplicate OpenAI keys.
3. **OPEN PORTAL awareness.** `/live/` must not embed API keys. Config is non-secret; keys stay in Foundation secure paths.
4. **BUILD LOCK.** No streaming, WebRTC, LiveKit, payments, chat, or AI moderation implementation in Phase 1.

## Relationship to App2

- App2 remains the identity and marketplace Foundation.
- Live consumes verification and business context via future authenticated Foundation APIs (not by copying App2 auth into Live).
- Phase 1 shells do **not** refactor App2 core auth/DB/keys/uploads.

## Surfaces (Phase 1 shells)

| Path | Role |
|------|------|
| `/live/index.php` | Service home |
| `/live/go-live.php` | First-time purpose + Go Live Now / Schedule Live |
| `/live/schedule-live.php` | Schedule draft UI |
| `/live/video.php` | Business Video post-session workflow + sharing design |
| `/live/watch.php` | Public/embed watch placeholder |
| `/live/dashboard.php` | Operator overview shell |
| `/live/api/` | JSON status stub |
| `/live/admin/` | Future moderator shell |
| `/live/replays/` | Future replay index shell |
| `/live/docs/` | Architecture docs |

## Media model

```
Live Session (optional live moment)
        │
        ▼
Business Video (canonical record) ──► Listing attachment (reference)
        │                          ──► Business gallery (reference)
        │                          ──► Private library (visibility flag)
        │                          ──► Public link / embed / QR / share
        ▼
One file object under /App/uploads/ (design; Phase 1 does not write media)
```

**One recording → one video record → display anywhere by reference.**

## OpenAI

- Canonical key path (reference only): `/public_html/App/secure/OpenAI-One-Key.php`
- Phase 1: documented reference in `App/secure/live/live-config.php` — **no key copy, no key load for Live shells.**

## Directive

See Architecture Directive 004 (LOCKED): `App2/docs2/004.md` (mirrored in this folder).
