# App vs Library vs Framework — what the FvRE can and can't extract

**Date**: 2026-07-18
**For**: G (operator) and any future Mavis session

This doc fixes a confusion I caused. I wrote "library/framework (like SnappyMail/MailSo) — None" in the which-tool-when doc, which is wrong. SnappyMail is an app. The library is **MailSo** (one part of SnappyMail). Here's the clean version.

---

## The 30-second version

**APP**: I run in a browser. I have a URL. **The FvRE can extract me.**
- Example: SnappyMail's webmail UI, SmartPantry, Elementor sites, Oscar AI's front-end
- Tool: FvRE Component B (A, B, or C depending on what you have)

**LIBRARY**: I run in PHP/JS/Python/etc. I have no URL. **The FvRE cannot extract me.**
- Example: MailSo (the IMAP/SMTP engine inside SnappyMail), React, jQuery
- Tool: There isn't one — the FvRE is for web UIs

**FRAMEWORK**: I'm a structure for building apps. I have a URL (sometimes) but extracting me gives you the UI, not the API surface. **The FvRE can extract my UI, not my API.**
- Example: WordPress (the framework) hosts Elementor (a plugin), SnappyMail's backend (the framework) hosts MailSo (a library)
- Tool: FvRE for the UI, hand-extract for the API

---

## What SnappyMail actually is

SnappyMail is a **webmail app** that includes a **library** and uses a **framework pattern**:

```
┌────────────────────────────────────────────────────┐
│  SnappyMail Webmail App (runs in a browser)        │
│  ┌──────────────────────────────────────────────┐  │
│  │  UI: HTML/CSS/JS — login, inbox, compose    │  │
│  │      This is what you SEE when you open it   │  │
│  │      THIS IS APP TERRITORY                   │  │
│  │      FvRE can extract this                   │  │
│  ├──────────────────────────────────────────────┤  │
│  │  Backend: PHP code that handles accounts,   │  │
│  │           sessions, settings storage        │  │
│  │      This is the FRAMEWORK part             │  │
│  │      FvRE extracts the UI, not the API       │  │
│  ├──────────────────────────────────────────────┤  │
│  │  MailSo: PHP library for IMAP/SMTP/MIME     │  │
│  │      No URL, no UI, just classes            │  │
│  │      THIS IS LIBRARY TERRITORY               │  │
│  │      FvRE cannot extract this                │  │
│  └──────────────────────────────────────────────┘  │
└────────────────────────────────────────────────────┘
```

**SnappyMail as a whole = an APP.** Most people mean this when they say "SnappyMail."
**MailSo inside SnappyMail = a LIBRARY.** This is the IMAP/SMTP engine.
**SnappyMail's own backend (account management, settings) = a FRAMEWORK pattern.**

---

## Concrete examples

| Thing | Category | FvRE can extract? | What you'd get |
|---|---|---|---|
| SnappyMail running at https://mail.example.com | APP | YES (Tool A or C) | Recipe for the webmail UI |
| MailSo (the PHP classes in `app/libraries/MailSo/`) | LIBRARY | NO | — |
| WordPress running at example.com | APP | YES (Tool A + elementor-adapter) | Recipe for the WordPress site |
| React (the JS library your app uses) | LIBRARY | NO | — |
| SnappyMail's account-management code | FRAMEWORK | NO (without code-reading) | — |
| SnappyMail's login screen (UI) | APP (part of the whole app) | YES | Recipe for the login form |
| SnappyMail's IMAP connect behaviour | LIBRARY behaviour | NO (without code-reading) | — |
| SmartPantry (the whole SPA) | APP | YES (Tool C, 95.82% proven) | Recipe for the whole app |
| SmartPantry's localStorage schema | DATA (not a thing) | NO | — |
| Elementor website | APP | YES (Tool A + elementor-adapter) | Recipe for the website |
| An npm package (any) | LIBRARY | NO | — |

---

## What this means for FreshCloud Mail

Our goal: build a FreshVibe-style webmail inside Oscar (the groupware layer). What we want from SnappyMail:

| What we want | Category | How to get it |
|---|---|---|
| How the inbox view looks | APP UI | FvRE (Tool A or C on a running SnappyMail URL) |
| How the compose form works | APP UI | FvRE |
| How the email view shows MIME parts | APP UI | FvRE |
| How IMAP connect works (sequence, errors, retries) | LIBRARY behaviour | **Hand-extract** (Component H, like SmartPantry) |
| How SMTP send works | LIBRARY behaviour | **Hand-extract** |
| How MIME parsing works | LIBRARY behaviour | **Hand-extract** |
| How accounts are stored (per-user, encrypted) | FRAMEWORK pattern | **Hand-extract** + new design for multi-user |
| How login sessions work | FRAMEWORK pattern | **Hand-extract** + new design |

**The FvRE gives us the UI shapes.** Hand-extraction gives us the behavioural layer. The hand-extraction is what we did for SmartPantry — read the source, write recipe.json files with the 5 fields (behaviour/data/key_functions/files/tests).

**Total effort for the full FreshCloud Mail extraction:**

- 1 day: Deploy SnappyMail locally, run fv-extract against it (Tool A or C) — produces structural recipes for the UI
- 1-2 days: Identify the 12-20 behavioural modules in MailSo (IMAP connect, folder list, message fetch, search, SMTP send, etc.)
- 1 week: Hand-extract each module into a recipe.json (behaviour/data/key_functions/files/tests) — the SmartPantry shape that worked
- 2-3 days: Hand-extract the framework patterns (accounts, sessions) and add the multi-user + world-class deltas
- 1-2 weeks: Build a generator that consumes the recipes → FreshVibe Way v8 components
- 1 week: Run the generator, sample-review the output, write tests

**Total**: 4-5 weeks, ~80-120 hours Mavis + ~25-40 hours GLM (free).

---

## The corrected line in the which-tool-when doc

Old (wrong):
> | A library/framework (like SnappyMail/MailSo) | None — these aren't web UIs |

New (correct):
> | **The webmail UI of SnappyMail** (the running app) | **Tool A or C** | It's a web app, has a URL |
> | **The MailSo library** (IMAP/SMTP classes inside SnappyMail) | None — it's a PHP library, not a web UI | Hand-extract behavioural recipes (like SmartPantry) |
> | **The SnappyMail backend** (account mgmt, sessions, settings) | None — extractable only by reading source code | Hand-extract framework patterns |

---

## The mental model to keep

When you ask "should I FvRE this?", ask:

1. **Can I open it in a browser at a URL?** If yes, FvRE can extract it.
2. **Is it just code in a repo with no UI of its own?** If yes, FvRE can't extract it — hand-extract the behaviour.
3. **Is it both (like SnappyMail)?** Split it: FvRE for the UI, hand-extract for the library/framework parts.

SnappyMail is BOTH. The FvRE handles the UI half. Hand-extraction handles the library/framework half. Both go into the same Recipe Book.
