# noah20102021/spotemoji architecture

> Architecture diagram of the GitHub repository noah20102021/spotemoji, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/noah20102021/spotemoji
- Repository: https://github.com/noah20102021/spotemoji

## Overview

#### Purpose and Runtime
Spot Emoji! is a browser-based real-time multiplayer emoji matching game. The Node.js server hosts static client assets and coordinates live lobby/game events through Express and Socket.io. Local startup is via `npm start` in `package.json`, with the server entry point at `server.js`.

#### Server and Real-Time Authority
`server.js` is the backend boundary: it initializes the HTTP application and Socket.io transport, serves the game to browsers, and is expected to own multiplayer session coordination. Clients should treat the server as the authority for lobby membership, round progression, and cross-player event broadcast rather than synchronizing directly with each other.

Paths:
- `server.js`
- `package.json`
- `package-lock.json`

#### Browser Entry Surfaces
The application is delivered as separate HTML screens rather than a framework SPA. `public/index.html` is the primary landing/entry page; `public/lobby.html` represents the multiplayer lobby surface; `public/cardtester.html` appears to be a dedicated card/game-data testing surface.

Paths:
- `public/index.html`
- `public/lobby.html`
- `public/cardtester.html`

#### Client Game Controller
`public/client.js` is the main browser-side control layer. It connects the UI to Socket.io, sends user intent such as creating/joining a lobby or selecting an emoji, and applies server-driven updates to the DOM. It is the key boundary between presentation pages and real-time game state.

Paths:
- `public/client.js`
- `public/index.html`
- `public/lobby.html`

#### Lobby-to-Round Flow
The primary control flow is: a player loads the landing page, enters or creates a lobby, connects over Socket.io, waits for or triggers a game start, then participates in fast rounds by identifying matching emojis. Server-originated events update all connected players; client-originated actions report player choices back to the server. Lobby state is transient multiplayer state, while the browser renders the current server-provided state.

Paths:
- `server.js`
- `public/lobby.html`
- `public/client.js`

#### Presentation and Static Assets
Styling is plain CSS, shared by the static HTML pages. Visual branding and browser metadata are served from the public directory. `style_backup.css` is likely a historical alternative and should not be treated as the primary design contract unless referenced by the pages.

Paths:
- `public/style.css`
- `public/assets/images`
- `public/assets/favicon/site.webmanifest`

#### Infrastructure and External Dependencies
Material runtime dependencies are Node.js, Express.js, and Socket.io, as specified by the README and resolved through npm. The deployment model is a single web server exposing HTTP for page/assets and WebSocket-compatible Socket.io connections for real-time play. No database, external API, authentication provider, or separate frontend build pipeline is evidenced by the supplied tree.

Paths:
- `package.json`
- `server.js`
- `public/`

Main entry points: [`server.js`](https://github.com/noah20102021/spotemoji/blob/master/server.js) (Game server), [`public/index.html`](https://github.com/noah20102021/spotemoji/blob/master/public/index.html) (Landing page), [`public/lobby.html`](https://github.com/noah20102021/spotemoji/blob/master/public/lobby.html) (Lobby page), [`public/client.js`](https://github.com/noah20102021/spotemoji/blob/master/public/client.js) (Game controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser client"]
  node_landing["Landing page<br/>HTML screen<br/>[index.html]"]
  node_lobby_page["Lobby page<br/>HTML screen<br/>[lobby.html]"]
  node_card_tester["Card tester<br/>HTML screen<br/>[cardtester.html]"]
  node_client_controller["Game controller<br/>browser JS<br/>[client.js]"]
end

subgraph group_server["Node runtime"]
  node_web_server["Game server<br/>Node entry<br/>[server.js]"]
  node_session_coordinator["Session coordinator<br/>server state<br/>[server.js]"]
  node_npm_runtime["npm runtime<br/>package runtime<br/>[package.json]"]
  node_dependencies["Express + Socket.io<br/>runtime dependencies<br/>[package-lock.json]"]
end

subgraph group_static["Static delivery"]
  node_styles["Shared styles<br/>CSS<br/>[style.css]"]
  node_visual_assets["Branding assets<br/>static assets"]
  node_browser_metadata["Browser metadata<br/>web manifest<br/>[site.webmanifest]"]
end

node_player(("Player<br/>user"))
node_socket_channel["Socket.io channel<br/>real-time transport"]

node_player -->|"loads"| node_landing
node_landing -->|"enters lobby"| node_lobby_page
node_landing -->|"runs"| node_client_controller
node_lobby_page -->|"runs"| node_client_controller
node_card_tester -->|"served by"| node_web_server
node_client_controller -->|"sends intent / receives updates"| node_socket_channel
node_socket_channel -->|"Socket.io connection"| node_web_server
node_web_server -->|"delegates game events"| node_session_coordinator
node_session_coordinator -->|"broadcasts lobby and round state"| node_socket_channel
node_web_server -->|"serves"| node_landing
node_web_server -->|"serves"| node_lobby_page
node_web_server -->|"serves"| node_styles
node_web_server -->|"serves"| node_visual_assets
node_web_server -->|"serves"| node_browser_metadata
node_npm_runtime -->|"starts"| node_web_server
node_npm_runtime -->|"declares and resolves"| node_dependencies
node_dependencies -->|"provides HTTP and real-time runtime"| node_web_server

click node_landing "https://github.com/noah20102021/spotemoji/blob/master/public/index.html"
click node_lobby_page "https://github.com/noah20102021/spotemoji/blob/master/public/lobby.html"
click node_card_tester "https://github.com/noah20102021/spotemoji/blob/master/public/cardtester.html"
click node_client_controller "https://github.com/noah20102021/spotemoji/blob/master/public/client.js"
click node_web_server "https://github.com/noah20102021/spotemoji/blob/master/server.js"
click node_session_coordinator "https://github.com/noah20102021/spotemoji/blob/master/server.js"
click node_npm_runtime "https://github.com/noah20102021/spotemoji/blob/master/package.json"
click node_dependencies "https://github.com/noah20102021/spotemoji/blob/master/package-lock.json"
click node_styles "https://github.com/noah20102021/spotemoji/blob/master/public/style.css"
click node_visual_assets "https://github.com/noah20102021/spotemoji/tree/master/public/assets/images"
click node_browser_metadata "https://github.com/noah20102021/spotemoji/blob/master/public/assets/favicon/site.webmanifest"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_landing,node_lobby_page,node_card_tester,node_client_controller toneBlue
class node_web_server,node_session_coordinator,node_npm_runtime,node_dependencies toneAmber
class node_styles,node_visual_assets,node_browser_metadata toneMint
class node_player,node_socket_channel toneNeutral
```

## Components

### Browser client

- [Landing page](https://github.com/noah20102021/spotemoji/blob/master/public/index.html): HTML screen · `public/index.html`
- [Lobby page](https://github.com/noah20102021/spotemoji/blob/master/public/lobby.html): HTML screen · `public/lobby.html`
- [Card tester](https://github.com/noah20102021/spotemoji/blob/master/public/cardtester.html): HTML screen · Dedicated game-data testing surface. · `public/cardtester.html`
- [Game controller](https://github.com/noah20102021/spotemoji/blob/master/public/client.js): browser JS · Bridges page UI and server-driven game state. · `public/client.js`

### Node runtime

- [Game server](https://github.com/noah20102021/spotemoji/blob/master/server.js): Node entry · Serves static content and owns multiplayer authority. · `server.js`
- [Session coordinator](https://github.com/noah20102021/spotemoji/blob/master/server.js): server state · Coordinates lobby membership, rounds, and broadcasts. · `server.js`
- [npm runtime](https://github.com/noah20102021/spotemoji/blob/master/package.json): package runtime · Defines startup and resolved Node dependencies. · `package.json`
- [Express + Socket.io](https://github.com/noah20102021/spotemoji/blob/master/package-lock.json): runtime dependencies · `package-lock.json`

### Static delivery

- [Shared styles](https://github.com/noah20102021/spotemoji/blob/master/public/style.css): CSS · `public/style.css`
- [Branding assets](https://github.com/noah20102021/spotemoji/tree/master/public/assets/images): static assets · `public/assets/images`
- [Browser metadata](https://github.com/noah20102021/spotemoji/blob/master/public/assets/favicon/site.webmanifest): web manifest · `public/assets/favicon/site.webmanifest`

### Other components

- **Player**: user
- **Socket.io channel**: real-time transport

## Connections

- Player → Landing page: loads
- Landing page → Lobby page: enters lobby
- Landing page → Game controller: runs
- Lobby page → Game controller: runs
- Card tester → Game server: served by
- Game controller → Socket.io channel: sends intent / receives updates
- Socket.io channel → Game server: Socket.io connection
- Game server → Session coordinator: delegates game events
- Session coordinator → Socket.io channel: broadcasts lobby and round state
- Game server → Landing page: serves
- Game server → Lobby page: serves
- Game server → Shared styles: serves
- Game server → Branding assets: serves
- Game server → Browser metadata: serves
- npm runtime → Game server: starts
- npm runtime → Express + Socket.io: declares and resolves
- Express + Socket.io → Game server: provides HTTP and real-time runtime
