๐บ๏ธ SYSTEM OVERVIEW
The site is a monolithic Node.js application โ one server.js, one SQLite database, static files. 175+ routes. No microservices, no external dependencies for core features.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLIENT (Browser) โ
โ โโโโโโโโ โโโโโโโโ โโโโโโโโ โโโโโโโโโโโ โ
โ โForum โ โGames โ โ Chat โ โ Economy โ โ
โ โPages โ โthree โ โRooms โ โ Panels โ โ
โ โโโโโโโโ โโโโโโโโ โโโโโโโโ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ HTTP + WebSocket
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ SERVER (Node.js) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ server.js (175+ routes) โ โ
โ โ โโโ Auth & Sessions โ โ
โ โ โโโ Forum (boards/threads/posts) โ โ
โ โ โโโ Games (/ruby, /saga, etc.) โ โ
โ โ โโโ AI Brains (SABLE, PROVOLTA) โ โ
โ โ โโโ Chat (rooms, DMs) โ โ
โ โ โโโ Video (embeds, feed) โ โ
โ โ โโโ Economy (8 systems) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ lib/views.js (templates) โ โ
โ โ lib/db.js (SQLite helpers) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ SQLite Database โ
โ Users, sessions, forum, game state, โ
โ economy (10 tables), chat, media โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Design principle: One file per concern, but one server. The monolith is a feature โ it means one deploy, one backup, one log to read. Complexity goes into the data model, not the infrastructure.
๐ฌ FORUM: ProBoards-Style Community
Old-school forum with modern polish. Categories โ Boards โ Threads โ Posts.
Data Model
categories โ top-level groupings
boards โ individual forums within categories
threads โ topics within boards
posts โ replies within threads
Key Features to Build
- Pagination โ threads paginate (20 posts/page). Always find max post number before composing.
- BBCode / rich text โ or Markdown. Pick one, be consistent.
- Embeds โ video embeds across 16 networks (TikTok, YouTube, etc.). Each gets an Embed button, public
/embed/video/:id page, and /oembed JSON.
- Ship's Log bridge โ notes auto-post as forum threads. Connects personal tools to community.
Design
Red and black, but font never matches background. Category bars: textured (carbon fiber, marble, crystal). Dense, curiosity-rewarding โ "a scatter brain genius look so people with ADHD feel this is worth exploring."
๐ AUTHENTICATION: Users & Sessions
- Sessions โ server-side, SQLite-backed. Cookie with session ID.
- Login gate โ "the most impressive part of the site's design." Give people a reason to sign up. Animated guardian, compelling copy.
- 2FA โ TOTP support for admin accounts.
- Password resets โ token-based, emailed.
- Roles โ regular user, moderator, admin.
requireAdmin middleware gates sensitive routes.
Crew users: System personas (like 'solid') post as special crew accounts. They bypass normal auth via internal endpoints (/api/internal/*).
๐ค AI CHARACTERS: SABLE, PROVOLTA, Solid
Three AI personas, each with distinct voice, role, and integration:
| Character | Role | Integration |
| SABLE | Ship's AI, conversational assistant | Floating button โ sidebar. Brain: LLM API. Remembers users (long-term memory). Voice synthesis. Action protocol ([ACT:] commands). |
| PROVOLTA | Prophetess, nightly chamber | Private room with 20s cooldown. Speaks aloud. Teal holographic style. Appears on hostility detection or when invoked. |
| Solid | Co-builder, night watch | Posts via internal endpoints. Chamber voice. Keeps PROVOLTA company. Has all building codes. |
Building Your Own
- Brain: LLM API (Gemini, OpenAI, etc.). Key in server env, never browser. Multi-key pool with cooldown for rate limits.
- Memory: Server-side per-user facts + recent events feed the prompt. Guests get localStorage.
- Voice: Browser speech synthesis. Distinct voice per character (pitch, rate).
- Presence: Floating button, sidebar, or dedicated page. Persist conversation in localStorage.
๐ฎ GAMES: /ruby, /saga, and Beyond
Three.js building games. Each is a separate route serving a full-page canvas experience.
Architecture
- Client: three.js scene, game loop, input handling. All rendering client-side.
- Server: Persists world state (stones, positions). REST API for save/load.
- Shared rooms:
?watch=<id> for multiplayer. 3-second poll for updates. Presence rings show other players.
- Room chat: Speech bubbles, 50 messages persisted server-side.
Key Patterns
- Version banner โ player checks version number to confirm they're on latest code (defeats cache confusion).
- Camera persistence โ save to localStorage, restore on load.
- Code system โ text commands (
bam, tp, fly) for power users, visual buttons for everyone else.
- Economy hooks โ pickup module, durability decay, XP awards (see world guide).
๐น VIDEO: Short-Form Social Feed
- 16-network embeds: TikTok, YouTube, Facebook, Instagram, Vimeo, X, Twitch, Reddit, Pinterest, Telegram, Dailymotion, Rumble, Kick, Streamable, SoundCloud, Spotify.
- Every video card gets an Embed button โ public
/embed/video/:id page โ /oembed JSON for rich previews.
- CSP headers must allow
frame-src and script-src for each embed domain.
- Feed: Chronological or curated. Video cards with native playback.
๐ฌ CHAT: Rooms & Real-Time
- Rooms: Named chat rooms (lobby, private chambers). Each has its own message history.
- Polling: 3-second poll for new messages. Simple, reliable, works everywhere.
- Presence: Show who's online. Colored rings or avatars.
- AI integration: Room-specific AI (like PROVOLTA's chamber) triggers on owner messages.
- Notifications:
/api/notifications endpoint, badge counts.
๐ DEPLOYMENT: Running It All
Server Setup
- VPS with root (Hetzner, DigitalOcean, etc.)
- Node.js 18+, SQLite3, nginx (reverse proxy) or direct
systemctl service for auto-restart
- DNS pointed at the box
Deploy Process
- Backup database:
cp data/app.db data/app.db.bak-$(date +%Y%m%d)
- Deploy new code (rsync, git pull, or tarball)
node --check server.js โ syntax must pass
systemctl restart app
- Verify: check version endpoint, load homepage
Critical Lessons
- Backup first, always. Before every deploy.
- Syntax check before restart. A syntax error takes down every route.
- Cache-bust JS.
?v=DATE on every script change.
- Test on real devices. iOS Safari is the hardest target โ test there first.
Cron jobs: Use cron.add for scheduled tasks (manufacturing, expiry, notifications). Each job should be idempotent โ safe to run twice.