TinyFrens developer guide

A practical overview of how TinyFrens is put together and how to work on it. This replaces the old root DEVELOPER.md, which described an early prototype and is now out of date.

What TinyFrens is

Verified NFT companions that follow one account across platforms:

All of them share one companion UI in web/ and one relay server in server/ for multiplayer "party rooms," chat, wallets, and platform auth.

Repository map

Path What it is Stack
web/ The shared pet UI. Runs as a PWA and inside Telegram/Farcaster. Vanilla JS + CSS
server/ Live relay: friends, party rooms, chat, Bankr wallet, Telegram/Discord, FRENS economy Python + aiohttp + SQLite
android/ Native floating-overlay pet Kotlin
desktop/ Windows/Mac floating pet Electron
ios/ Native iOS shell + WidgetKit widget Swift
site/ Welcome / marketing page Static HTML
snap/ Farcaster in-feed Snap (2.0) TypeScript + Hono
contracts/ On-chain FRENS economy Solidity + Foundry
scripts/ Build + signing helpers (site build, Farcaster signer, videos, testnet) Node / Python
docs/ Documentation (you are here) Markdown

Companion identity and care state

Every surface renders artwork from the same verified NFT selection. A separate small state object tracks care and display preferences; it does not define a replacement species, colour, expression, or accessory:

{
  "hunger": 80, "happiness": 80, "energy": 80,
  "born": 1690000000000, "mode": "roam",
  "opacity": 100, "reduceMotion": false
}

Rule of thumb: companion features use the shared web/ implementation. Native code may provide only the platform adapter required to display that same verified NFT. The universal-surface CI check rejects known parallel/fallback paths. Game rules live in GAMEPLAY.md.

Multiplayer: the relay server

server/app.py is a single-process aiohttp app with a SQLite DB. It provides:

Run it locally:

cd server
pip install -r requirements.txt
python -m unittest discover -s . -v   # 27 tests
python app.py                          # listens on $PORT (default 8080)

Config is via environment variables — see server/.env.example. Deployment notes (systemd + nginx, as used on the live miono host) are in server/README.md.

Platform adapters (web)

When web/ loads inside a host, a small adapter detects it and wires identity + rooms:

web/friends.js is the WebSocket client; web/party.js renders rooms and exposes window.TinyFrensParty.joinChat/joinPublic/joinPrivate.

Building & deploying

Conventions

First tasks for a new contributor

  1. Read GAMEPLAY.md and ROADMAP.md.
  2. Run the server tests: cd server && python -m unittest discover -s . -v.
  3. Serve web/ locally (python -m http.server from web/) and open it.
  4. Pick a ⬜ item from TELEGRAM-DISCORD.md or ROADMAP.md.