How corn323/fan-interactify works
Project type and purpose
• This is a hybrid full-stack application combining:
• An Electron desktop app (for the streamer’s UI)
• A local Express/TRPC server with Prisma (to orchestrate connections, handle API calls, persist data)
• A Nuxt.js front-end (served over a public ngrok tunnel to audience devices)
Main components
a. Electron Desktop App
• Main process (electron/main.ts)
• Renderer process (Vue app in app.vue + components/)
• Preload script (electron/preload.ts) exposing IPC hooks
• QR-code generator & file-picker for custom images
b. Local Server (server/)
• Express + TRPC endpoint layer (server/trpc/)
• Prisma ORM + SQLite/Postgres (server/prisma/)
• IPC bridge (ipcRequestHandler.ts) for pushing events back to Electron
c. Nuxt Interaction Page (interactionPage/)
• Nuxt3 app serving front-end UI for viewers
• tRPC client plugin to send shake payloads to TRPC server
d. Static Deployment Output (liveStickInteractionPage/)
• Prebuilt Nuxt output, mounted into Electron/Express via mklink
e. Ngrok Tunnel (ngrokUrl.json)
• Exposes local server & Nuxt pages to the public Internet
f. Audience Devices
• Mobile browsers that scan QR, load the Nuxt page, and send motion data
Relationships and data flows
1. Electron startup → spawns Express/TRPC server on a local port
2. Electron generates ngrok tunnel → obtains a public URL → renders it as a QR code
3. Viewer scans QR → browser opens Nuxt interaction page via the ngrok URL
4. Nuxt front-end establishes a TRPC connection → calls shake/motion endpoints
5. TRPC server receives motion events → writes to Prisma if needed → forwards events via IPC to Electron main
6. Electron main or renderer updates the cheering-stick visuals in real time
Architectural patterns & design principles
• Separation of concerns: Desktop UI vs. headless server vs. web client
• Modular TRPC routers (e.g., post.ts, index.ts) for each API domain
• ORM-based persistence (Prisma migrations + schema)
• IPC bridge for internal event propagation (server → electron main)
• Static asset linkage (Nuxt output folder linked into project for easy serving)