Application code for Karaoke Nite lives entirely within a few folders inside the src/
directory:
components
connection
pages
shared
server
typings
Standalone React components not directly tied to any part of the site. These form a sort of fledgling component library that fills out our basic buttons, logos, typography, and the like.
- π Do split out the "common" parts of designs into reusable components here.
- π Do prefer using the
forms/
components for form inputs,layout/
components for grid layouts, andtypography/
components for headings, links, paragraphs, and other forms of body text. - π Don't place components here that rely on any sort of complex cross-component logic, such as server connection contexts.
π‘ Sticking to our fledgling design system makes it easier to keep pieces of the UI looking consistent and reduces work recreating similar components.
Room-specific logic for initialization a Socket.IO connection to the server and communicating over it.
- π Do keep all code around initializing server connections here, to abstract those details away from other folders.
- π Don't update UI based on the results of those connections here; prefer doing that in page-specific React components.
Next.js Pages are stored here.
These are the root entry points launched by Next.js when you yarn dev:site
.
- π Do place non-
index
pages in their own folders. - π Don't import between pages (use
components
orshared
for that).
Code available on both the client and server. This is mostly shared definitions around Socket.IO events or room defaults.
- π Do place shared code here instead of duplicating in other directories.
- π Don't take on large, client-specific, or server-specific dependencies in this folder.
Node application that sets up Socket.IO connections.
Uses a quick little logging.ts
logger setup to print out nice color-coded logs for major events.
For now, a glitch-backup.js
file is kept as reference of working Networked Aframe sample hosting code; it can be run directly with node
as a drop-in replacement for testing (though it doesn't support Karaoke Nite events).
Global .d.ts
"definition" files for TypeScript to inform the type system of any types not available as type declaration packages.