# withspectrum/spectrum architecture

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

- Interactive diagram: https://gitdiagram.com/withspectrum/spectrum
- Repository: https://github.com/withspectrum/spectrum

## Overview

Spectrum is a full-stack platform for online communities, combining forum-style threaded discussions with real-time chat, moderation, and community management. A typical user enters through the web app, which communicates with the GraphQL API for community, channel, and conversation data; Hyperion also renders the app server-side. The graph keeps documented product areas visible while showing only relationships supported by the excerpts, SOURCE INDEX references, or README. Several model and frontend subsystems are represented by their exact tree paths, but their internal calls were not sampled.

Main entry points: [`api/loaders/index.js`](https://github.com/withspectrum/spectrum/blob/alpha/api/loaders/index.js) (Request loaders), [`hyperion/renderer/index.js`](https://github.com/withspectrum/spectrum/blob/alpha/hyperion/renderer/index.js) (Server renderer), [`api/index.js`](https://github.com/withspectrum/spectrum/blob/alpha/api/index.js) (API server), [`api/apollo-server.js`](https://github.com/withspectrum/spectrum/blob/alpha/api/apollo-server.js) (GraphQL API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_routes["App routes<br/>[routes.js]"]
  node_threadview["Thread view<br/>[style.js]"]
  node_gqlclient["GraphQL client<br/>[index.js]"]
end

subgraph group_api["API and identity"]
  node_apientry["API server<br/>[index.js]"]
  node_auth["Authentication<br/>[authentication.js]"]
  node_authroutes["Sign-in routes"]
  node_graphqlapi["GraphQL API<br/>[apollo-server.js]"]
  node_schema["GraphQL schema<br/>[schema.js]"]
  node_loaders["Request loaders<br/>[index.js]"]
end

subgraph group_domain["Community domain"]
  node_community["Community data<br/>[community.js]"]
  node_channel["Channel data<br/>[channel.js]"]
  node_thread["Thread data<br/>[thread.js]"]
  node_message["Message data<br/>[message.js]"]
  node_memberships["Membership data"]
  node_channelmembers["Channel membership<br/>[usersChannels.js]"]
  node_dmembers["DM membership"]
end

subgraph group_render["Rendering and content"]
  node_ssr["Server renderer<br/>[index.js]"]
  node_htmltemplate["HTML template<br/>[html-template.js]"]
end

subgraph group_shared["Shared data access"]
  node_userqueries["User queries<br/>[user.js]"]
  node_rethinks[("RethinkDB")]
  node_redis[("Redis")]
end

node_member(("Community member"))

node_member -.->|"uses"| node_routes
node_routes -->|"routes to"| node_threadview
node_gqlclient -.->|"sends operations"| node_apientry
node_apientry -->|"mounts"| node_authroutes
node_apientry -->|"applies"| node_graphqlapi
node_graphqlapi -->|"uses"| node_schema
node_graphqlapi -->|"creates"| node_loaders
node_loaders -->|"loads"| node_community
node_loaders -->|"loads"| node_channel
node_loaders -->|"loads"| node_thread
node_loaders -->|"loads"| node_message
node_loaders -->|"loads"| node_memberships
node_loaders -->|"loads"| node_channelmembers
node_loaders -->|"loads"| node_dmembers
node_authroutes -.->|"authenticates"| node_auth
node_ssr -->|"renders"| node_routes
node_ssr -->|"uses"| node_htmltemplate
node_ssr -->|"creates"| node_loaders
node_userqueries -.->|"queries"| node_rethinks
node_member -.->|"uses for caching"| node_redis

click node_routes "https://github.com/withspectrum/spectrum/blob/alpha/src/routes.js"
click node_threadview "https://github.com/withspectrum/spectrum/blob/alpha/src/views/thread/style.js"
click node_gqlclient "https://github.com/withspectrum/spectrum/blob/alpha/shared/graphql/index.js"
click node_apientry "https://github.com/withspectrum/spectrum/blob/alpha/api/index.js"
click node_auth "https://github.com/withspectrum/spectrum/blob/alpha/api/authentication.js"
click node_authroutes "https://github.com/withspectrum/spectrum/blob/alpha/api/routes/auth/create-signin-routes.js"
click node_graphqlapi "https://github.com/withspectrum/spectrum/blob/alpha/api/apollo-server.js"
click node_schema "https://github.com/withspectrum/spectrum/blob/alpha/api/schema.js"
click node_loaders "https://github.com/withspectrum/spectrum/blob/alpha/api/loaders/index.js"
click node_community "https://github.com/withspectrum/spectrum/blob/alpha/api/models/community.js"
click node_channel "https://github.com/withspectrum/spectrum/blob/alpha/api/models/channel.js"
click node_thread "https://github.com/withspectrum/spectrum/blob/alpha/api/models/thread.js"
click node_message "https://github.com/withspectrum/spectrum/blob/alpha/api/models/message.js"
click node_memberships "https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersCommunities.js"
click node_channelmembers "https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersChannels.js"
click node_dmembers "https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersDirectMessageThreads.js"
click node_ssr "https://github.com/withspectrum/spectrum/blob/alpha/hyperion/renderer/index.js"
click node_htmltemplate "https://github.com/withspectrum/spectrum/blob/alpha/hyperion/renderer/html-template.js"
click node_userqueries "https://github.com/withspectrum/spectrum/blob/alpha/shared/db/queries/user.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_routes,node_threadview,node_gqlclient toneBlue
class node_apientry,node_auth,node_authroutes,node_graphqlapi,node_schema,node_loaders toneAmber
class node_community,node_channel,node_thread,node_message,node_memberships,node_channelmembers,node_dmembers toneMint
class node_ssr,node_htmltemplate toneRose
class node_userqueries,node_rethinks,node_redis,node_member toneIndigo
```

## Components

### Web experience

- [App routes](https://github.com/withspectrum/spectrum/blob/alpha/src/routes.js): `src/routes.js`
- [Thread view](https://github.com/withspectrum/spectrum/blob/alpha/src/views/thread/style.js): `src/views/thread/style.js`
- [GraphQL client](https://github.com/withspectrum/spectrum/blob/alpha/shared/graphql/index.js): `shared/graphql/index.js`

### API and identity

- [API server](https://github.com/withspectrum/spectrum/blob/alpha/api/index.js): `api/index.js`
- [Authentication](https://github.com/withspectrum/spectrum/blob/alpha/api/authentication.js): `api/authentication.js`
- [Sign-in routes](https://github.com/withspectrum/spectrum/blob/alpha/api/routes/auth/create-signin-routes.js): `api/routes/auth/create-signin-routes.js`
- [GraphQL API](https://github.com/withspectrum/spectrum/blob/alpha/api/apollo-server.js): `api/apollo-server.js`
- [GraphQL schema](https://github.com/withspectrum/spectrum/blob/alpha/api/schema.js): `api/schema.js`
- [Request loaders](https://github.com/withspectrum/spectrum/blob/alpha/api/loaders/index.js): `api/loaders/index.js`

### Community domain

- [Community data](https://github.com/withspectrum/spectrum/blob/alpha/api/models/community.js): `api/models/community.js`
- [Channel data](https://github.com/withspectrum/spectrum/blob/alpha/api/models/channel.js): `api/models/channel.js`
- [Thread data](https://github.com/withspectrum/spectrum/blob/alpha/api/models/thread.js): `api/models/thread.js`
- [Message data](https://github.com/withspectrum/spectrum/blob/alpha/api/models/message.js): `api/models/message.js`
- [Membership data](https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersCommunities.js): `api/models/usersCommunities.js`
- [Channel membership](https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersChannels.js): `api/models/usersChannels.js`
- [DM membership](https://github.com/withspectrum/spectrum/blob/alpha/api/models/usersDirectMessageThreads.js): `api/models/usersDirectMessageThreads.js`

### Rendering and content

- [Server renderer](https://github.com/withspectrum/spectrum/blob/alpha/hyperion/renderer/index.js): `hyperion/renderer/index.js`
- [HTML template](https://github.com/withspectrum/spectrum/blob/alpha/hyperion/renderer/html-template.js): `hyperion/renderer/html-template.js`

### Shared data access

- [User queries](https://github.com/withspectrum/spectrum/blob/alpha/shared/db/queries/user.js): `shared/db/queries/user.js`
- **RethinkDB**
- **Redis**

### Other components

- **Community member**

## Connections

- Community member → App routes: uses (evidence: `README.md`)
- App routes → Thread view: routes to (evidence: `src/routes.js`)
- GraphQL client → API server: sends operations
- API server → Sign-in routes: mounts (evidence: `api/index.js`)
- API server → GraphQL API: applies (evidence: `api/index.js`)
- GraphQL API → GraphQL schema: uses (evidence: `api/apollo-server.js`)
- GraphQL API → Request loaders: creates (evidence: `api/apollo-server.js`)
- Request loaders → Community data: loads
- Request loaders → Channel data: loads
- Request loaders → Thread data: loads
- Request loaders → Message data: loads
- Request loaders → Membership data: loads
- Request loaders → Channel membership: loads
- Request loaders → DM membership: loads
- Sign-in routes → Authentication: authenticates
- Server renderer → App routes: renders (evidence: `hyperion/renderer/index.js`)
- Server renderer → HTML template: uses (evidence: `hyperion/renderer/index.js`)
- Server renderer → Request loaders: creates (evidence: `hyperion/renderer/index.js`)
- User queries → RethinkDB: queries (evidence: `README.md`)
- Community member → Redis: uses for caching (evidence: `README.md`)
