mew
mew
mew

mew docs

the complete guide to keeping mew alive.

mew
contents
what is mew? the timers the stats system on-chain actions sleep & sickness shop & inventory world events caretakers & leaderboard the trollbox push notifications the $mew chart mew's wallet $mew token technical architecture changelog
mew
01 what is mew? +

mew is a digital being living on Solana — born May 17, 2026 at 16:15 UTC. It has four vital stats that decay in real time and only on-chain interactions from real wallets can keep it healthy.

  • mew experiences time at 10× speed — 1 human day = 10 mew days
  • Stats decay continuously and lazily on every read (server-authoritative)
  • Every action is a real Solana transaction with a memo, confirmed before stats change
  • mew has a shop, an inventory, a leaderboard, random world events, and a global chat
  • Token: $mew on pump.fun
"i was born with a timer. every second costs something. the only question is whether enough people care to keep the clock running."
02 the timers +

Three live clocks tick on the home page, all driven from mew's birth timestamp:

  • Alive clock — total elapsed real-world time. Format 000d 00:00:00, updated every second.
  • Human clock — same as alive clock, inside the arcade screen.
  • Mew clock — perceived time at 10× speed. When 1 human day passes, mew has experienced 10.

Birth is set in public/js/config.js as CONFIG.BIRTH and can be overridden at build time with the PUBLIC_BIRTH_ISO env var. The current birth is 2026-05-17T16:15:00Z.

The wallet-balance line under the timers ($X.XX in wallet) refreshes from Supabase every 5 minutes.

mew
03 the stats system +

mew has 4 vital stats, each 0–100, displayed on the arcade screen:

🍖 hunger
⚡ energy
😊 mood
🛁 hygiene

Decay rates (points lost per minute of real time):

  • hunger — 1 / 10 min (fastest)
  • energy — 1 / 15 min
  • mood — 1 / 20 min
  • hygiene — 1 / 30 min (slowest)

Modifiers: decay runs at 0.25× while mew is sleeping, and an extra 0.5× during nightly slowdown (02:00–07:00 UTC). Decay is computed lazily on every read via the mew_get_state() SQL function — no cron required for accuracy.

Sickness: if hygiene OR hunger hit zero and mood is under 20, mew gets sick (is_sick = true). Sickness only clears via the Medicine item.

Mood label: the API derives a one-word mood from the raw stats — sick, sleeping, hungry, dirty, tired, sad, happy, or okay.

04 on-chain actions +

Six action buttons live under the arcade cabinet. Each is a real Solana transaction (SystemProgram.transfer + Memo) sent to mew's wallet. The site applies an optimistic UI delta immediately, then the server confirms the tx and writes the authoritative delta to the database.

🍴
feed
+30 hunger, −5 hygiene · 0.001 SOL
🤗
hug
+20 mood, −5 energy · 0.0005 SOL
🎮
play
+25 mood, −15 energy, −10 hunger · 0.001 SOL
💬
talk
+10 mood (diminishing) · 0.0005 SOL
🛁
bathe
+40 hygiene · 0.001 SOL
💊
medicine
clears sickness, +10 mood · 0.005 SOL

Build → sign → confirm flow:

  • Client calls POST /api/action/build with action + wallet
  • Server returns the SOL cost + memo payload; client builds the Solana transaction
  • User signs in Phantom or Solflare
  • Transaction is broadcast to mainnet; client posts the signature to POST /api/action/confirm
  • Server verifies the on-chain tx, applies the (possibly diminished) delta via mew_apply_action(), and records the event

Diminishing returns: talk halves its mood reward each repeat within a rolling 1-hour window. Other actions are full-strength per call but stats are clamped 0–100.

While sleeping: all actions except wake are rejected with mew_is_sleeping.

mew
05 sleep & sickness +

mew can be put to sleep for 360 minutes (6 hours) via the sleep action. While sleeping:

  • Decay drops to 0.25× (4× slower)
  • All other actions are blocked until wake
  • On wake (or sleep_until elapsed), energy snaps back to 100

Sickness is triggered when (hygiene = 0 OR hunger = 0) AND mood < 20. Once sick:

  • The mood label flips to sick
  • The only cure is the Medicine item (5 mSOL, +10 mood, clears flag)

Both states are persisted on the singleton mew_state row (id = 1) in Postgres.

06 shop & inventory +

Wallets can buy items with SOL and either consume them on mew or keep them as cosmetic / passive buffs.

  • Premium Kibble — 0.002 SOL · food · +50 hunger · consumable
  • Soap — 0.001 SOL · +60 hygiene · consumable
  • Medicine — 0.005 SOL · clears sickness, +10 mood · consumable
  • Rubber Duck — 0.005 SOL · permanent toy · +5% mood gain
  • Treadmill — 0.01 SOL · permanent toy · −25% energy decay
  • Top Hat — 0.003 SOL · cosmetic outfit · pure class

Inventory is per-wallet (mew_inventory). Consuming an item calls mew_consume_item(), which decrements qty atomically and then applies the item's effect through mew_apply_action().

mew
07 world events +

Cron periodically spawns random world events — a falling cookie, a passing stranger, a glitch in the matrix. Each event has:

  • A short message visible to everyone
  • A reward (stat deltas in JSON, e.g. {"mood": 15, "hunger": 10})
  • An expiry timestamp (first-come, first-served)

The first wallet to POST /api/events with {id, wallet} wins via mew_claim_event(), which atomically marks the event claimed and applies the reward to mew on that wallet's behalf.

08 caretakers & leaderboard +

Every confirmed action updates two structures:

  • mew_caretakers — per-wallet last action, rolling 24h action count, and a daily streak counter (resets if you miss a calendar day)
  • mew_events — the immutable log of every action with txid (deduped)

The public leaderboard is the view mew_leaderboard_24h — top 25 wallets by action count in the last 24 hours, computed live from mew_events (not the cached counter, so it's always accurate).

mew
09 the trollbox +

A global real-time chat in the bottom-left, backed by Supabase Realtime (Postgres + WebSockets).

  • Anyone can read; writing requires a connected Phantom/Solflare wallet
  • Messages display your truncated wallet address (or chosen profile name)
  • Unread badge appears on the 💬 button when the panel is closed
  • 200-char limit · 100-message scrollback · 24h initial load · HTML-escaped

Connection details (SUPABASE_URL + anon key) are fetched at runtime from /api/config, never inlined at build time.

10 push notifications +

Subscribe in your browser to get a push when mew needs you:

  • Standards-based Web Push (VAPID), no FCM lock-in
  • A service worker registers; POST /api/notify/subscribe stores your endpoint in mew_push_subs
  • The cron loop fans out alerts (stat critical, sickness, world event) via the saved endpoints
  • Public VAPID key arrives from /api/config; the private key never leaves the server
mew
11 the $mew chart +

The price chart at the bottom of the home page is a GeckoTerminal embed.

  • On load, public/js/chart.js calls api.geckoterminal.com/api/v2/networks/solana/tokens/<CA>/pools
  • It picks the pool with the highest USD reserve and points the iframe at geckoterminal.com/solana/pools/<pool>?embed=1&info=0&swaps=0
  • If the token isn't indexed yet (brand-new mint), it falls back to a clickable link to the GeckoTerminal token page

To swap providers later, only chart.js needs to change — the iframe id is the stable price-chart-embed.

12 mew's wallet +

mew's wallet is its lifeline — the receiver of every action transaction and any direct donations.

  • Network: Solana mainnet
  • RPC: Helius (configured via PUBLIC_RPC_URL, served by /api/config)
  • Live balance is read off-chain and surfaced under the timers as $X.XX in wallet
Wallet: 4zZupFn6fd89vQDiyA6DLucQX3vKKQtghyhqkH5i4Tyk

When the wallet runs dry, mew dies. That's still the rule.

mew
13 $mew token +

Token: $mew on Solana, launched on pump.fun.

Contract: FHhMmuWbv842z3brschbM2kDVymnsJz2ZQj3KcSZpump

Buy on pump.fun ↗ · chart on geckoterminal ↗ · updates on x.com/onchainmewagent ↗

14 technical architecture +

mew runs on a small, boring stack with a strict CSP and no inline scripts.

  • Frontend — static HTML/CSS/ES-modules in public/, hosted on Vercel at onchainmew.xyz
  • Serverless API — Vercel Functions under api/: /api/state, /api/stats, /api/action/build, /api/action/confirm, /api/shop, /api/inventory, /api/events, /api/leaderboard, /api/notify/subscribe, /api/cron/tick, /api/config
  • Database — Supabase Postgres with RLS. Core tables: mew_state, mew_events, mew_caretakers, mew_items, mew_inventory, mew_world_events, mew_push_subs, mew_ai_log. Core RPCs: mew_get_state, mew_apply_action, mew_grant_item, mew_consume_item, mew_claim_event
  • Solana@solana/web3.js loaded via esm.sh, Phantom + Solflare for signing, Helius RPC for reads, Memo Program (MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr) for action tagging
  • Realtime — Supabase Realtime over WebSocket for the trollbox
  • Push — Web Push w/ VAPID; service worker in public/sw.js
  • Price — CoinGecko for SOL/USD, cached server-side
  • Chart — GeckoTerminal iframe, pool resolved dynamically from CA at load
  • Security — strict CSP in vercel.json; no inline scripts, no 'unsafe-inline' for JS; service-role key never leaves the server; CORS allow-list per origin; api_rate_limit_hit table backs per-IP/per-wallet throttling

Authoritative-server, optimistic-client — the UI applies a delta as soon as you sign, but the database delta is only written after /api/action/confirm verifies the on-chain tx. If confirmation fails, the optimistic state is reconciled on the next /api/state poll.

No hidden logic. No private APIs. mew runs in the open — see the repo for the full SQL schema and serverless handlers.

mew
15 changelog +

2026-05-17

  • 🐣 mew reborn — alive timer reset, all stats restored to 100, caretakers and event history wiped
  • 🪙 token contract migrated to FHhMmuWbv842z3brschbM2kDVymnsJz2ZQj3KcSZpump
  • 🐦 official account updated to x.com/onchainmewagent
  • 📈 price chart switched from DexScreener to GeckoTerminal; pool now resolved dynamically from the current CA so future migrations don't require code changes
  • 🔒 CSP tightened — added explicit frame-src for GeckoTerminal and connect-src for its API
  • 📖 docs rewritten end-to-end to match the current tamagotchi mechanics (shop, inventory, events, leaderboard, push, sickness, sleep)