# daryltanwk/chatordie2 architecture

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

- Interactive diagram: https://gitdiagram.com/daryltanwk/chatordie2
- Repository: https://github.com/daryltanwk/chatordie2

## Overview

ChatOrDie is a Meteor application combining account access, a global chat, and collaborative three-word story creation. The main user flow is login or registration, enter the home chat to send and view messages, or open the three-word area to create a story and append or remove segments. Routes gate authenticated pages and subscribe to stories; shared Meteor methods validate requests and persist chat and story data. The README is empty, so capability coverage is based on the supplied tree and excerpts; relationships for unsampled server publication and home setup are omitted.

Main entry points: [`routecontrollers/MainRouteController.js`](https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/MainRouteController.js) (Route dispatch), [`client/register_client.js`](https://github.com/daryltanwk/chatordie2/blob/master/client/register_client.js) (Registration form), [`client/home_client.js`](https://github.com/daryltanwk/chatordie2/blob/master/client/home_client.js) (Chat interface), [`common/misc_common.js`](https://github.com/daryltanwk/chatordie2/blob/master/common/misc_common.js) (Message methods)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Account access"]
  node_login["Login controls<br/>[misc_client.js]"]
  node_registration["Registration form<br/>[register_client.js]"]
  node_account_validation["Account validation<br/>[register_server.js]"]
  node_account_errors["Account errors<br/>[COD_Errors.js]"]
  node_accounts_store[("Meteor users<br/>[register_server.js]")]
end

subgraph group_chat["Global chat"]
  node_chat_view["Chat interface<br/>[home_client.js]"]
  node_chat_methods["Message methods<br/>[misc_common.js]"]
  node_chat_errors["Chat errors<br/>[COD_Errors.js]"]
  node_messages_store[("Messages collection<br/>[misc_common.js]")]
end

subgraph group_stories["Three-word stories"]
  node_story_ui["Story interface"]
  node_story_methods["Story methods"]
  node_story_errors["Story errors"]
  node_stories_store[("Stories collection")]
end

subgraph group_routing["Application routing"]
  node_route_dispatch["Route dispatch"]
  node_home_route["Home route"]
  node_register_route["Registration route"]
  node_story_route["Story routes"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens app"| node_route_dispatch
node_route_dispatch -->|"renders login"| node_login
node_route_dispatch -->|"redirects home"| node_home_route
node_route_dispatch -->|"allows registration"| node_register_route
node_visitor -->|"submits details"| node_registration
node_registration -->|"creates account"| node_accounts_store
node_account_validation -->|"checks usernames"| node_accounts_store
node_registration -->|"shows errors"| node_account_errors
node_visitor -->|"enters credentials"| node_login
node_login -->|"routes after login"| node_route_dispatch
node_home_route -->|"renders home"| node_chat_view
node_chat_view -->|"calls sendMsg"| node_chat_methods
node_chat_methods -->|"writes messages"| node_messages_store
node_chat_view -->|"reads messages"| node_messages_store
node_chat_methods -->|"throws errors"| node_chat_errors
node_route_dispatch -.->|"routes stories"| node_story_route
node_story_route -->|"finds story"| node_stories_store
node_story_route -->|"renders views"| node_story_ui
node_story_ui -->|"calls story methods"| node_story_methods
node_story_methods -->|"writes stories"| node_stories_store
node_story_methods -->|"throws errors"| node_story_errors
node_story_ui -->|"observes story"| node_stories_store

click node_route_dispatch "https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/MainRouteController.js"
click node_home_route "https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/HomeRouteController.js"
click node_register_route "https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/RegisterRouteController.js"
click node_story_route "https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/ThreeWordRouteController.js"
click node_login "https://github.com/daryltanwk/chatordie2/blob/master/client/misc_client.js"
click node_registration "https://github.com/daryltanwk/chatordie2/blob/master/client/register_client.js"
click node_account_validation "https://github.com/daryltanwk/chatordie2/blob/master/server/register_server.js"
click node_account_errors "https://github.com/daryltanwk/chatordie2/blob/master/COD_Errors.js"
click node_chat_view "https://github.com/daryltanwk/chatordie2/blob/master/client/home_client.js"
click node_chat_methods "https://github.com/daryltanwk/chatordie2/blob/master/common/misc_common.js"
click node_chat_errors "https://github.com/daryltanwk/chatordie2/blob/master/COD_Errors.js"
click node_story_ui "https://github.com/daryltanwk/chatordie2/blob/master/client/threeword_client.js"
click node_story_methods "https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js"
click node_story_errors "https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js"
click node_messages_store "https://github.com/daryltanwk/chatordie2/blob/master/common/misc_common.js"
click node_stories_store "https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js"
click node_accounts_store "https://github.com/daryltanwk/chatordie2/blob/master/server/register_server.js"

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_login,node_registration,node_account_validation,node_account_errors,node_accounts_store toneBlue
class node_chat_view,node_chat_methods,node_chat_errors,node_messages_store toneAmber
class node_story_ui,node_story_methods,node_story_errors,node_stories_store toneMint
class node_route_dispatch,node_home_route,node_register_route,node_story_route toneRose
class node_visitor toneIndigo
```

## Components

### Account access

- [Login controls](https://github.com/daryltanwk/chatordie2/blob/master/client/misc_client.js): `client/misc_client.js`
- [Registration form](https://github.com/daryltanwk/chatordie2/blob/master/client/register_client.js): `client/register_client.js`
- [Account validation](https://github.com/daryltanwk/chatordie2/blob/master/server/register_server.js): `server/register_server.js`
- [Account errors](https://github.com/daryltanwk/chatordie2/blob/master/COD_Errors.js): `COD_Errors.js`
- [Meteor users](https://github.com/daryltanwk/chatordie2/blob/master/server/register_server.js): `server/register_server.js`

### Global chat

- [Chat interface](https://github.com/daryltanwk/chatordie2/blob/master/client/home_client.js): `client/home_client.js`
- [Message methods](https://github.com/daryltanwk/chatordie2/blob/master/common/misc_common.js): `common/misc_common.js`
- [Chat errors](https://github.com/daryltanwk/chatordie2/blob/master/COD_Errors.js): `COD_Errors.js`
- [Messages collection](https://github.com/daryltanwk/chatordie2/blob/master/common/misc_common.js): `common/misc_common.js`

### Three-word stories

- [Story interface](https://github.com/daryltanwk/chatordie2/blob/master/client/threeword_client.js): `client/threeword_client.js`
- [Story methods](https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js): `common/threeword_common.js`
- [Story errors](https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js): `common/threeword_common.js`
- [Stories collection](https://github.com/daryltanwk/chatordie2/blob/master/common/threeword_common.js): `common/threeword_common.js`

### Application routing

- [Route dispatch](https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/MainRouteController.js): `routecontrollers/MainRouteController.js`
- [Home route](https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/HomeRouteController.js): `routecontrollers/HomeRouteController.js`
- [Registration route](https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/RegisterRouteController.js): `routecontrollers/RegisterRouteController.js`
- [Story routes](https://github.com/daryltanwk/chatordie2/blob/master/routecontrollers/ThreeWordRouteController.js): `routecontrollers/ThreeWordRouteController.js`

### Other components

- **Visitor**

## Connections

- Visitor → Route dispatch: opens app (evidence: `routecontrollers/MainRouteController.js`)
- Route dispatch → Login controls: renders login (evidence: `routecontrollers/MainRouteController.js`)
- Route dispatch → Home route: redirects home (evidence: `routecontrollers/MainRouteController.js`)
- Route dispatch → Registration route: allows registration (evidence: `routecontrollers/MainRouteController.js`)
- Visitor → Registration form: submits details (evidence: `client/register_client.js`)
- Registration form → Meteor users: creates account (evidence: `client/register_client.js`)
- Account validation → Meteor users: checks usernames (evidence: `server/register_server.js`)
- Registration form → Account errors: shows errors (evidence: `COD_Errors.js`)
- Visitor → Login controls: enters credentials (evidence: `client/misc_client.js`)
- Login controls → Route dispatch: routes after login (evidence: `client/misc_client.js`)
- Home route → Chat interface: renders home (evidence: `routecontrollers/HomeRouteController.js`)
- Chat interface → Message methods: calls sendMsg (evidence: `client/home_client.js`)
- Message methods → Messages collection: writes messages (evidence: `common/misc_common.js`)
- Chat interface → Messages collection: reads messages (evidence: `client/home_client.js`)
- Message methods → Chat errors: throws errors (evidence: `COD_Errors.js`)
- Route dispatch → Story routes: routes stories
- Story routes → Stories collection: finds story (evidence: `routecontrollers/ThreeWordRouteController.js`)
- Story routes → Story interface: renders views (evidence: `routecontrollers/ThreeWordRouteController.js`)
- Story interface → Story methods: calls story methods (evidence: `client/threeword_client.js`)
- Story methods → Stories collection: writes stories (evidence: `common/threeword_common.js`)
- Story methods → Story errors: throws errors (evidence: `common/threeword_common.js`)
- Story interface → Stories collection: observes story (evidence: `client/threeword_client.js`)
