tinyfiles.tv
⚠️ TINKER TOY — NOT LIVE YET — DISCLAIMER

This is a toy prototype. Your garden is local-only — stored only in this browser tab. It is NOT saved to the server and NOT shared with anyone yet. Refresh = gone (unless this tab autosaves). Shared community state, accounts, and moderation are coming later. Don’t plant anything you wouldn’t want to lose. And yes — the weeds fight back on purpose. They want the whole garden.

Seed: Tool: 🌱 Plants: 0🌾 Weeds HP: 1,000,000🛡️ Shield: off
Seeds: 0 / 1,000,000•1,000,000 to go•Weeds: 0•Bloom: —

1,000,000 seeds = one very big garden. Every seed you plant deals 1 damage to the Weeds. Every 30 seeds, and every 45 seconds, the Weeds hit back — they spread, they choke a plant, they try to take a whole row. Water to grow a sprout into a full plant. Pull weeds to clear them.

🌾
The weeds say:

Dirt. Perfect, empty dirt. Let us keep it that way. No tomatoes. No sunflowers. Just… us. Weeds. Everywhere.

No attacks yet. The weeds are pretending to be grass.

Your patch — 20 x 20. This is the first patch of the million-seed garden.Tap dirt to plant — tap a sprout with Water to grow it
🌱 Sprout — needs water🌿 Growing — water again🍅🌻🥕 Mature — fully grown🌾 Weed — pull it or it spreads🟫 Dirt — empty, plant here

How to grow: Plant → Water once = growing → Water again = mature. Mature plants resist weeds better. Fight = undoes the weeds’ last attack, +10 bonus damage. Mulch = blocks for 60s.

How it works (when it’s real)

Everyone gardens on the same garden. One seed at a time. You plant, the weeds try to choke it, you fight them back with mulch. Cooldowns, accounts, and moderation will keep it from becoming chaos. For now, you’re gardening alone — think of this as practice against very rude weeds.

  • Plant a seed to deal damage — 1 seed = 1 HP off the Weeds
  • Every 30 seeds + every 45 seconds, the Weeds attack
  • Fight undoes its last attack, Mulch blocks for 60s
  • Download .txt to keep your patch

Community — coming soon

Shared state is not connected yet. This box is a placeholder for what’s next:

🟢 0 gardeners planting right now (fake — local toy)
🌻 Last patch: —
⚔️ Last fight: — (not saved)
📜 Rules: No hate, no NSFW, no ads. Mods will nuke it later.

Backend  ·  Template · Proposed · Not connected

⬇ Backend — TinyGarden Backend — Template

Right now TinyGarden is a tinker toy — grid is a local 20 x 20 array in this tab, weedAttack() chokes a plant from the grid, totalEver is a local counter, history is 10 in-memory snapshots, and Refresh = gone (except local autosave). The disclaimer on this page is the truth: local-only, not saved, not shared. This backend is the map to make it real: one shared garden, per-seed writes by x / y, weed attacks as server events, cooldowns, accounts, and moderation. Proposed, not connected.

01 / Files to create
api/tinygarden/seed.php         POST /api/tinygarden/seed
api/tinygarden/seeds.php        GET  /api/tinygarden/seeds?since=
api/tinygarden/fight.php        POST /api/tinygarden/fight
api/tinygarden/snapshot.php     GET  /api/tinygarden/snapshot
api/tinygarden/clear.php        POST /api/tinygarden/clear  (mod only)
sql/tinygarden_tables.sql

Keep the tinyfiles PHP pattern: each endpoint loads /api/bootstrap.php, uses json_in() / json_out(), prepared PDO statements.

02 / Database tables
-- sql/tinygarden_tables.sql
tinygarden_plants
  -- one row per seed — 1,000,000 max, 1000 x 1000 garden
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  x SMALLINT NOT NULL               -- 0-999
  y SMALLINT NOT NULL               -- 0-999
  kind VARCHAR(20) NOT NULL         -- "tomato", "sunflower", "weed", ...
  stage TINYINT NOT NULL DEFAULT 0  -- 0 sprout, 1 growing, 2 mature
  user_id INT NOT NULL
  planted_at DATETIME NOT NULL
  UNIQUE(x, y)                      -- last write wins per tile

tinygarden_attacks
  -- Weeds fight back — server events, not client guesses
  id BIGINT AUTO_INCREMENT PRIMARY KEY
  kind ENUM('spread','choke','overgrow','try_take_row') NOT NULL
  x SMALLINT NULL
  y SMALLINT NULL
  detail VARCHAR(200) NULL
  created_at DATETIME NOT NULL

tinygarden_snapshot
  id INT AUTO_INCREMENT PRIMARY KEY
  path VARCHAR(200) NOT NULL         -- "/data/tinygarden/snapshot.json"
  seed_count INT NOT NULL DEFAULT 0
  created_at DATETIME NOT NULL

tinygarden_cooldowns
  user_id INT PRIMARY KEY
  last_plant_at DATETIME NOT NULL
  seeds_last_minute INT NOT NULL DEFAULT 0

Garden is 1000 x 1000 = 1,000,000 seeds. Never store a full garden per user — store only seeds by x / y, plus one snapshot. Same idea as TinyMap / TinyNovel / TinySong / TinyCity / TinyComic, but seeds instead of pixels / words / notes / tiles / panels. Toy shows 20 x 20 — real garden is the full 1M-seed map, toy is just the first patch.

03 / API endpoints & request flow
POST /api/tinygarden/seed
{ "seeds": [ { "x": 512, "y": 400, "kind": "tomato", "stage": 0 }, ... ] }
- auth required, 1-100 seeds per request (one patch = many seeds)
- validates x 0-999, y 0-999, kind in allowed set, stage 0-2
- cooldown: max 1 write per 500ms, max 100 seeds per request
- writes INSERT ... ON DUPLICATE KEY UPDATE kind, stage, user_id, planted_at
- returns { "ok": true, "planted": 12, "cooldown_ms": 500 }

GET /api/tinygarden/seeds?since=2026-11-18T00:00:00Z
- returns { "ok": true, "seeds": [ { x, y, kind, stage }, ... ] }
- since = last poll time, max 5000 seeds per response
- client polls every 2s, applies only new seeds — same grid toggle as now

POST /api/tinygarden/fight
{ "attack_id": 123 }
- auth required, one fight per attack, max 1 fight per 5s
- server undoes that attack (restores choked plant, removes weeds)
- returns { "ok": true, "restored": "tomato", "bonus": 10 }

GET /api/tinygarden/snapshot
- returns { "ok": true, "url": "/data/tinygarden/snapshot.json",
  "seed_count": 1234, "updated_at": "..." }
- new visitors load snapshot first, then poll /seeds?since=

POST /api/tinygarden/clear  (mod only)
- auth + role=mod required, else 403
- clears tinygarden_plants + rebuilds snapshot, logs who cleared it

Weed attacks are server events in the real version — tinygarden_attacks — not client random. Client in this toy fakes them with weedAttack(). Server decides spread / choke / overgrow / try_take_row on a timer + every 30 seeds, so everyone sees the same fight.

04 / Cooldown, moderation & validation (server owns this)
// Cooldown — keeps it from becoming chaos:
//   1 write request per 500ms per user
//   100 seeds per request, 1 fight per 5s per user
//   if user exceeds it, return { "ok": false, "error": "cooldown",
//   "retry_ms": 320 } — client shows "Slow down" and retries.

// Moderation:
//   no hate / NSFW / ads — mods can clear + ban user_id from planting
//   server stores user_id per seed, so a bad patch can be rolled
//   back by user + x / y range, not by wiping the whole garden.

// Validation:
//   x / y must be integers 0-999, kind must be in allowed set, stage 0-2
//   seeds must be an array, 1-100 items — else 400
//   growth / bloom are derived — server only sees seeds.

Keep the disclaimer until this ships: “Tinker toy — not live yet. Refresh = gone.” Remove it only when /api/tinygarden/seed is actually storing seeds.

05 / Frontend wiring
// Grid is already local in this page:
//   grid[20][20] — same array as now
//   totalEver — same counter as now, drives Weeds HP

// After planting (debounced 800ms), also send to server:
async function sendSeeds(seeds){
  const res = await fetch('/api/tinygarden/seed', { method:'POST',
    headers:{'Content-Type':'application/json'},
    body: JSON.stringify({ seeds }) });
  // if cooldown, wait retry_ms and retry once
}

// Poll for other people's seeds:
async function pollSeeds(){
  const res = await fetch('/api/tinygarden/seeds?since=' + encodeURIComponent(lastPoll));
  const data = await res.json();
  // data.seeds.forEach(s => setSeedAt(s.x, s.y, s.kind, s.stage))
  // setSeedAt = same grid assignment as plantTile(), but no history push
}

// On load:
//   1. GET /api/tinygarden/snapshot -> load JSON into grid
//   2. setInterval(pollSeeds, 2000)
//   3. keep local plantTile() / fightGarden() / undo() / downloadGarden() as-is
// If API fails, fall back to current local-only toy + disclaimer.

Keep the current toy playable with no backend — if /api/tinygarden/seeds fails, gardening stays local-only and the disclaimer stays.

Copy the snippets above into api/tinygarden/ + sql/tinygarden_tables.sql — no GitHub needed. The <pre> blocks are the backend spec: shared 1,000,000-seed garden, per-seed writes by x / y, weed attacks as server events, cooldowns + moderation, same layout, disclaimer stays until wired.