Files
Web-on-the-Fly/README.md
T
ducoterra 806b21d856
Build and Push Containers / test (push) Successful in 28s
Build and Push Containers / build-and-push (push) Successful in 3m32s
init
2026-07-31 08:16:05 -04:00

52 lines
1.9 KiB
Markdown

# Web On The Fly
Flask app that streams AI-generated fake websites via Server-Sent Events (SSE). Each visit generates a unique, realistic-looking website on the fly.
## How it works
1. Visit `/` → you see a loading page with a spinner and live character counter
2. The client opens an SSE connection to `/stream`
3. The server calls an LLM (OpenAI-compatible API) to generate a complete HTML page
4. Chunks are base64-encoded and streamed back via SSE
5. Client buffers chunks in-memory, then replaces the document when generation is done
Each page is randomized: different site type (fake store, wiki, blog, forum, etc.), theme, and mood.
## Local dev with Podman
Build:
```bash
podman build -t localhost/web-on-the-fly:latest -f Containerfile .
```
Run (requires `.env` with `OPENAI_API_KEY`):
```bash
podman run --env-file .env -p 5000:5000 localhost/web-on-the-fly:latest
```
## Environment variables
Loaded from `.env` via `python-dotenv`:
| Variable | Required | Default | Description |
|---|---|---|---|
| `OPENAI_API_KEY` | Yes | — | API key for the LLM provider |
| `OPENAI_API_URL` | No | `https://api.openai.com/v1/chat/completions` | OpenAI-compatible endpoint |
| `MODEL` | No | `gpt-4o-mini` | Model name to use |
## Site types
Generated pages can be any of:
- **fake_store** — online stores with products, prices, reviews
- **fake_homepage** — personal portfolios, artist sites, food blogs
- **fake_social** — social media profiles, Reddit threads, dating app pages
- **fake_wiki** — Wikipedia-style articles about fictional topics
- **fake_forum** — retro forums with threads and discussions
- **fake_blog** — tech blogs, lifestyle blogs, horror story blogs
- **fake_news** — local news, sports, celebrity gossip
- **fake_app** — SaaS dashboards, mobile app landing pages
- **fake_other** — fake email inboxes, search results, 404 pages, etc.