# notghoull/spookcord architecture

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

- Interactive diagram: https://gitdiagram.com/notghoull/spookcord
- Repository: https://github.com/notghoull/spookcord

## Overview

Spookcord is an early-stage, self-hostable chat platform. Users sign up or sign in, enter chat, select a channel, load messages, and receive live message updates; they can also create or join servers and manage channels. The server exposes authenticated RPC and auth endpoints, while shared schemas define API data and a database schema supports persistence. The excerpts show message-query, realtime, server-creation, and authentication wiring; some listed routers and UI flows were not sampled, so their relationships are left unasserted or marked unverified.

Main entry points: [`apps/web/src/components/Chat/ChatView.svelte`](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Chat/ChatView.svelte) (Chat view), [`apps/server/src/routers/index.ts`](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/index.ts) (RPC router registry), [`apps/server/src/routers/server.ts`](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/server.ts) (Server operations), [`apps/server/src/routers/channel.ts`](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/channel.ts) (Channel and message operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_webapp["Web application<br/>[+layout.svelte]"]
  node_signup["Signup form<br/>[SignUpForm.svelte]"]
  node_chat["Chat view<br/>[ChatView.svelte]"]
  node_chatinput["Chat input<br/>[ChatInput.svelte]"]
  node_communityui["Server and channel UI"]
  node_settingsui["Profile settings"]
end

subgraph group_api["API and identity"]
  node_serverentry["HTTP and RPC entry<br/>[index.ts]"]
  node_rpcrouter["RPC router registry<br/>[index.ts]"]
  node_auth["Authentication<br/>[auth.ts]"]
  node_authrouter["Auth endpoints<br/>[auth.ts]"]
  node_context["Session context<br/>[context.ts]"]
end

subgraph group_domain["Community features"]
  node_serverops["Server operations<br/>[server.ts]"]
  node_channelops["Channel and message operations<br/>[channel.ts]"]
  node_userops["User operations<br/>[user.ts]"]
  node_meops["Current-member operations<br/>[me.ts]"]
end

subgraph group_shared["Shared data"]
  node_messageview["Message display<br/>[Message.svelte]"]
  node_schema["Database schema<br/>[schema.ts]"]
  node_types["API contracts<br/>[server.ts]"]
  node_channeltypes["Messaging contracts<br/>[channel.ts]"]
end

node_person(("Member"))
node_database[("PostgreSQL database")]
node_supabase["Supabase realtime"]

node_person -->|"uses"| node_webapp
node_person -->|"registers"| node_signup
node_signup -.->|"submits credentials"| node_auth
node_webapp -.->|"opens chat"| node_chat
node_chat -->|"queries messages"| node_channelops
node_chat -->|"requests JWT"| node_authrouter
node_chat -->|"subscribes to messages"| node_supabase
node_chat -->|"renders messages"| node_messageview
node_chat -->|"renders input"| node_chatinput
node_chatinput -.->|"sends messages"| node_channelops
node_person -->|"manages communities"| node_communityui
node_communityui -.->|"requests server actions"| node_serverops
node_serverentry -->|"routes auth requests"| node_auth
node_serverentry -->|"creates RPC context"| node_context
node_serverentry -->|"dispatches RPC"| node_rpcrouter
node_rpcrouter -->|"registers"| node_authrouter
node_rpcrouter -->|"registers"| node_serverops
node_rpcrouter -->|"registers"| node_channelops
node_rpcrouter -->|"registers"| node_userops
node_rpcrouter -->|"registers"| node_meops
node_authrouter -->|"issues JWT"| node_auth
node_auth -->|"persists auth data"| node_database
node_serverops -->|"reads and writes"| node_database
node_serverops -->|"validates server data"| node_types
node_serverops -->|"queries entities"| node_schema
node_channelops -.->|"reads and writes"| node_database
node_channelops -.->|"uses contracts"| node_channeltypes
node_userops -.->|"reads user data"| node_database
node_meops -.->|"reads member data"| node_database
node_settingsui -.->|"updates profile"| node_userops

click node_webapp "https://github.com/notghoull/spookcord/blob/main/apps/web/src/routes/%2Blayout.svelte"
click node_signup "https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/SignUpForm.svelte"
click node_chat "https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Chat/ChatView.svelte"
click node_chatinput "https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Chat/ChatInput.svelte"
click node_messageview "https://github.com/notghoull/spookcord/blob/main/packages/ui/src/lib/components/Message.svelte"
click node_communityui "https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Servers/CreateServerPopup.svelte"
click node_settingsui "https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/User-Settings/UserProfileSettings.svelte"
click node_serverentry "https://github.com/notghoull/spookcord/blob/main/apps/server/src/index.ts"
click node_rpcrouter "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/index.ts"
click node_auth "https://github.com/notghoull/spookcord/blob/main/apps/server/src/lib/auth.ts"
click node_authrouter "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/auth.ts"
click node_context "https://github.com/notghoull/spookcord/blob/main/apps/server/src/lib/context.ts"
click node_serverops "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/server.ts"
click node_channelops "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/channel.ts"
click node_userops "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/user.ts"
click node_meops "https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/me.ts"
click node_schema "https://github.com/notghoull/spookcord/blob/main/packages/db-schema/src/schema.ts"
click node_types "https://github.com/notghoull/spookcord/blob/main/packages/types/src/api/server.ts"
click node_channeltypes "https://github.com/notghoull/spookcord/blob/main/packages/types/src/api/channel.ts"

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_webapp,node_signup,node_chat,node_chatinput,node_communityui,node_settingsui toneBlue
class node_serverentry,node_rpcrouter,node_auth,node_authrouter,node_context,node_database toneAmber
class node_serverops,node_channelops,node_userops,node_meops toneMint
class node_messageview,node_schema,node_types,node_channeltypes toneRose
class node_person,node_supabase toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/notghoull/spookcord/blob/main/apps/web/src/routes/%2Blayout.svelte): `apps/web/src/routes/+layout.svelte`
- [Signup form](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/SignUpForm.svelte): `apps/web/src/components/SignUpForm.svelte`
- [Chat view](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Chat/ChatView.svelte): `apps/web/src/components/Chat/ChatView.svelte`
- [Chat input](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Chat/ChatInput.svelte): `apps/web/src/components/Chat/ChatInput.svelte`
- [Server and channel UI](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/Servers/CreateServerPopup.svelte): `apps/web/src/components/Servers/CreateServerPopup.svelte`
- [Profile settings](https://github.com/notghoull/spookcord/blob/main/apps/web/src/components/User-Settings/UserProfileSettings.svelte): `apps/web/src/components/User-Settings/UserProfileSettings.svelte`

### API and identity

- [HTTP and RPC entry](https://github.com/notghoull/spookcord/blob/main/apps/server/src/index.ts): `apps/server/src/index.ts`
- [RPC router registry](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/index.ts): `apps/server/src/routers/index.ts`
- [Authentication](https://github.com/notghoull/spookcord/blob/main/apps/server/src/lib/auth.ts): `apps/server/src/lib/auth.ts`
- [Auth endpoints](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/auth.ts): `apps/server/src/routers/auth.ts`
- [Session context](https://github.com/notghoull/spookcord/blob/main/apps/server/src/lib/context.ts): `apps/server/src/lib/context.ts`

### Community features

- [Server operations](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/server.ts): `apps/server/src/routers/server.ts`
- [Channel and message operations](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/channel.ts): `apps/server/src/routers/channel.ts`
- [User operations](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/user.ts): `apps/server/src/routers/user.ts`
- [Current-member operations](https://github.com/notghoull/spookcord/blob/main/apps/server/src/routers/me.ts): `apps/server/src/routers/me.ts`

### Shared data

- [Message display](https://github.com/notghoull/spookcord/blob/main/packages/ui/src/lib/components/Message.svelte): `packages/ui/src/lib/components/Message.svelte`
- [Database schema](https://github.com/notghoull/spookcord/blob/main/packages/db-schema/src/schema.ts): `packages/db-schema/src/schema.ts`
- [API contracts](https://github.com/notghoull/spookcord/blob/main/packages/types/src/api/server.ts): `packages/types/src/api/server.ts`
- [Messaging contracts](https://github.com/notghoull/spookcord/blob/main/packages/types/src/api/channel.ts): `packages/types/src/api/channel.ts`

### Other components

- **Member**
- **PostgreSQL database**
- **Supabase realtime**

## Connections

- Member → Web application: uses
- Member → Signup form: registers (evidence: `apps/web/src/components/SignUpForm.svelte`)
- Signup form → Authentication: submits credentials
- Web application → Chat view: opens chat
- Chat view → Channel and message operations: queries messages (evidence: `apps/web/src/components/Chat/ChatView.svelte`)
- Chat view → Auth endpoints: requests JWT (evidence: `apps/web/src/components/Chat/ChatView.svelte`)
- Chat view → Supabase realtime: subscribes to messages (evidence: `apps/web/src/components/Chat/ChatView.svelte`)
- Chat view → Message display: renders messages (evidence: `apps/web/src/components/Chat/ChatView.svelte`)
- Chat view → Chat input: renders input (evidence: `apps/web/src/components/Chat/ChatView.svelte`)
- Chat input → Channel and message operations: sends messages
- Member → Server and channel UI: manages communities
- Server and channel UI → Server operations: requests server actions
- HTTP and RPC entry → Authentication: routes auth requests (evidence: `apps/server/src/index.ts`)
- HTTP and RPC entry → Session context: creates RPC context (evidence: `apps/server/src/index.ts`)
- HTTP and RPC entry → RPC router registry: dispatches RPC (evidence: `apps/server/src/index.ts`)
- RPC router registry → Auth endpoints: registers (evidence: `apps/server/src/routers/index.ts`)
- RPC router registry → Server operations: registers (evidence: `apps/server/src/routers/index.ts`)
- RPC router registry → Channel and message operations: registers (evidence: `apps/server/src/routers/index.ts`)
- RPC router registry → User operations: registers (evidence: `apps/server/src/routers/index.ts`)
- RPC router registry → Current-member operations: registers (evidence: `apps/server/src/routers/index.ts`)
- Auth endpoints → Authentication: issues JWT (evidence: `apps/server/src/routers/auth.ts`)
- Authentication → PostgreSQL database: persists auth data (evidence: `apps/server/src/lib/auth.ts`)
- Server operations → PostgreSQL database: reads and writes (evidence: `apps/server/src/routers/server.ts`)
- Server operations → API contracts: validates server data (evidence: `apps/server/src/routers/server.ts`)
- Server operations → Database schema: queries entities (evidence: `apps/server/src/routers/server.ts`)
- Channel and message operations → PostgreSQL database: reads and writes
- Channel and message operations → Messaging contracts: uses contracts
- User operations → PostgreSQL database: reads user data
- Current-member operations → PostgreSQL database: reads member data
- Profile settings → User operations: updates profile
