# RC-009
## Theme Engine Foundation

You are implementing Release Candidate RC-009 for the INVEETAIRE platform.

IMPORTANT

This is NOT invitation design.

This is NOT feature development.

This is NOT UI redesign.

This patch creates ONLY the Theme Engine foundation.

The first invitation theme will be implemented later in RC-010.

Keep this implementation minimal.

---

Current Status

Landing Page complete.

Dashboard complete.

Design System complete.

Business workflow complete.

Authentication complete.

Public invitation already works.

Now we are preparing the architecture for multiple invitation themes.

---

Objective

Create a lightweight Theme Engine.

The Theme Engine must allow future invitation themes to be added without modifying controllers.

The controller must never know theme-specific implementation.

---

Folder Structure

Create:

app/modules/Theme/

ThemeRegistry.php

ThemeLoader.php

ThemeRenderer.php

ThemeService.php

ThemeManifest.php

Create:

themes/

theme-001/

theme.json

preview.webp (placeholder allowed)

index.php

assets/

css/

js/

images/

No second theme.

No additional themes.

---

Theme Manifest

Each theme owns:

theme.json

Example:

code

name

version

author

preview

entry

Nothing else.

Keep manifest intentionally minimal.

---

Workspace

Reuse the existing workspace.

Assume workspace stores:

theme_code

Example

theme-001

Do NOT introduce a new database table.

Do NOT create theme CRUD.

---

Theme Registry

Responsibilities

Scan

/themes

Locate every

theme.json

Return available themes.

No SQL.

No caching.

Keep implementation lightweight.

---

Theme Loader

Responsibilities

Read theme.json

Validate required fields

Resolve entry file

Validate folder existence

Fallback to

theme-001

if requested theme cannot be loaded.

Never crash.

---

Theme Renderer

Responsibilities

Receive

Workspace

Guest

Invitation

Theme

Resolve the entry view.

Render the invitation.

Controllers must not know theme paths.

---

Theme Service

Coordinate

Registry

Loader

Renderer

No HTML.

No SQL.

---

Theme Manifest

Responsible for parsing

theme.json

Only.

---

Current Public Invitation

Keep existing invitation behavior unchanged.

Do NOT redesign invitation.

Do NOT modify invitation sections.

Do NOT implement Aurora.

Do NOT implement theme switching UI.

Do NOT implement preview.

Do NOT implement admin selection.

Those belong to future RCs.

---

Constraints

Do NOT

Modify authentication

Modify routing unnecessarily

Modify business modules

Modify invitation content

Modify dashboard

Modify landing page

Modify database schema

Create additional themes

Implement marketplace

Implement package logic

Implement live switching

Implement uploads

Implement theme editor

---

Verification

Verify

Registry discovers theme-001

Loader loads theme.json

Renderer resolves index.php

Fallback works

Invalid theme falls back to theme-001

No controller contains theme-specific logic

PHP syntax passes

---

Acceptance Criteria

PASS only if

Theme Engine exists.

Single theme registered.

JSON manifest loaded.

Renderer separated from controller.

Fallback implemented.

Architecture ready for RC-010.

Business logic unchanged.

PHP syntax passes.

---

Output

Provide

1. Files created.

2. Files modified.

3. Theme Engine architecture.

4. Theme loading workflow.

5. Theme rendering workflow.

6. Fallback workflow.

7. Verification.

8. Acceptance checklist.

9. PHP syntax results.

Stop after implementation.

Wait for Human Approval.