# reddit/devvit-pixelary architecture

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

- Interactive diagram: https://gitdiagram.com/reddit/devvit-pixelary
- Repository: https://github.com/reddit/devvit-pixelary

## Overview

Pixelary is a Reddit-community pixel-art drawing and guessing game. A player chooses a word, draws on the canvas, and submits the result as a post; community members guess it, earning points that feed progression and rewards. The server exposes gameplay through tRPC and also supports word-slate selection, tournament posts, and community post types. The README documents the gameplay and scoring stages; sampled source confirms editor submission and selected server routes. Several subsystems are represented by their exact enclosing directories because their implementations were not sampled.

Main entry points: [`src/server/trpc/router.ts`](https://github.com/reddit/devvit-pixelary/blob/main/src/server/trpc/router.ts) (Gameplay API), [`src/client/entries/editor/_components/EditorRouter.tsx`](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/EditorRouter.tsx) (Editor flow), [`src/client/entries/editor/_components/DrawStep.tsx`](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/DrawStep.tsx) (Pixel drawing), [`src/client/entries/editor/_components/ReviewStep.tsx`](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/ReviewStep.tsx) (Review and submit)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Drawing gameplay"]
  node_editor_flow["Editor flow<br/>[EditorRouter.tsx]"]
  node_word_step["Word choice<br/>[WordStep.tsx]"]
  node_draw_step["Pixel drawing<br/>[DrawStep.tsx]"]
  node_drawing_state["Canvas state"]
  node_review_step["Review and submit<br/>[ReviewStep.tsx]"]
end

subgraph group_words["Word selection"]
  node_slate["Slate bandit<br/>[slate.ts]"]
  node_dictionary["Word dictionary<br/>[dictionary.ts]"]
end

subgraph group_community["Community modes"]
  node_drawing_service["Drawing posts<br/>[drawing.ts]"]
  node_guessing["Guessing and scoring<br/>[drawing.ts]"]
  node_post_modes["Community post modes"]
  node_tournament["Tournament play<br/>[post.ts]"]
end

subgraph group_progress["Progression"]
  node_progression["Points and levels<br/>[progression.ts]"]
  node_rewards["Rewards and items"]
end

subgraph group_platform["Server platform"]
  node_trpc["Gameplay API<br/>[router.ts]"]
  node_server["HTTP server<br/>[index.ts]"]
  node_redis[("Redis and permissions<br/>[redis.ts]")]
end

node_player(("Player"))
node_community_members(("Community members"))
node_reddit{{"Reddit platform"}}

node_player -->|"starts drawing"| node_editor_flow
node_editor_flow -->|"shows choice"| node_word_step
node_editor_flow -->|"shows canvas"| node_draw_step
node_draw_step -->|"uses state"| node_drawing_state
node_editor_flow -->|"shows review"| node_review_step
node_review_step -->|"submits drawing"| node_trpc
node_server -->|"mounts API"| node_trpc
node_trpc -->|"creates drawing"| node_drawing_service
node_community_members -->|"guess drawings"| node_guessing
node_drawing_service -.->|"supports scoring"| node_guessing
node_trpc -->|"generates slate"| node_slate
node_trpc -->|"reads words"| node_dictionary
node_player -->|"earns points"| node_progression
node_progression -->|"uses rewards"| node_rewards
node_trpc -->|"checks permissions"| node_redis
node_reddit -.->|"hosts game"| node_server
node_player -.->|"joins tournament"| node_tournament
node_player -.->|"views community posts"| node_post_modes

click node_editor_flow "https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/EditorRouter.tsx"
click node_word_step "https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/WordStep.tsx"
click node_draw_step "https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/DrawStep.tsx"
click node_drawing_state "https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_hooks/useDrawingState.tsx"
click node_review_step "https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/ReviewStep.tsx"
click node_drawing_service "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/drawing.ts"
click node_guessing "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/drawing.ts"
click node_post_modes "https://github.com/reddit/devvit-pixelary/tree/main/src/server/services/posts"
click node_tournament "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/tournament/post.ts"
click node_slate "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/words/slate.ts"
click node_dictionary "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/words/dictionary.ts"
click node_progression "https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/progression.ts"
click node_rewards "https://github.com/reddit/devvit-pixelary/tree/main/src/server/services/rewards"
click node_trpc "https://github.com/reddit/devvit-pixelary/blob/main/src/server/trpc/router.ts"
click node_server "https://github.com/reddit/devvit-pixelary/blob/main/src/server/index.ts"
click node_redis "https://github.com/reddit/devvit-pixelary/blob/main/src/server/core/redis.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_editor_flow,node_word_step,node_draw_step,node_drawing_state,node_review_step toneBlue
class node_slate,node_dictionary toneAmber
class node_drawing_service,node_guessing,node_post_modes,node_tournament toneMint
class node_progression,node_rewards toneRose
class node_trpc,node_server,node_redis,node_player,node_community_members,node_reddit toneIndigo
```

## Components

### Drawing gameplay

- [Editor flow](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/EditorRouter.tsx): `src/client/entries/editor/_components/EditorRouter.tsx`
- [Word choice](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/WordStep.tsx): `src/client/entries/editor/_components/WordStep.tsx`
- [Pixel drawing](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/DrawStep.tsx): `src/client/entries/editor/_components/DrawStep.tsx`
- [Canvas state](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_hooks/useDrawingState.tsx): `src/client/entries/editor/_hooks/useDrawingState.tsx`
- [Review and submit](https://github.com/reddit/devvit-pixelary/blob/main/src/client/entries/editor/_components/ReviewStep.tsx): `src/client/entries/editor/_components/ReviewStep.tsx`

### Word selection

- [Slate bandit](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/words/slate.ts): `src/server/services/words/slate.ts`
- [Word dictionary](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/words/dictionary.ts): `src/server/services/words/dictionary.ts`

### Community modes

- [Drawing posts](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/drawing.ts): `src/server/services/posts/drawing.ts`
- [Guessing and scoring](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/drawing.ts): `src/server/services/posts/drawing.ts`
- [Community post modes](https://github.com/reddit/devvit-pixelary/tree/main/src/server/services/posts): `src/server/services/posts`
- [Tournament play](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/posts/tournament/post.ts): `src/server/services/posts/tournament/post.ts`

### Progression

- [Points and levels](https://github.com/reddit/devvit-pixelary/blob/main/src/server/services/progression.ts): `src/server/services/progression.ts`
- [Rewards and items](https://github.com/reddit/devvit-pixelary/tree/main/src/server/services/rewards): `src/server/services/rewards`

### Server platform

- [Gameplay API](https://github.com/reddit/devvit-pixelary/blob/main/src/server/trpc/router.ts): `src/server/trpc/router.ts`
- [HTTP server](https://github.com/reddit/devvit-pixelary/blob/main/src/server/index.ts): `src/server/index.ts`
- [Redis and permissions](https://github.com/reddit/devvit-pixelary/blob/main/src/server/core/redis.ts): `src/server/core/redis.ts`

### Other components

- **Player**
- **Community members**
- **Reddit platform**

## Connections

- Player → Editor flow: starts drawing (evidence: `README.md`)
- Editor flow → Word choice: shows choice (evidence: `src/client/entries/editor/_components/EditorRouter.tsx`)
- Editor flow → Pixel drawing: shows canvas (evidence: `src/client/entries/editor/_components/EditorRouter.tsx`)
- Pixel drawing → Canvas state: uses state (evidence: `src/client/entries/editor/_components/DrawStep.tsx`)
- Editor flow → Review and submit: shows review (evidence: `src/client/entries/editor/_components/EditorRouter.tsx`)
- Review and submit → Gameplay API: submits drawing (evidence: `src/client/entries/editor/_components/ReviewStep.tsx`)
- HTTP server → Gameplay API: mounts API (evidence: `src/server/index.ts`)
- Gameplay API → Drawing posts: creates drawing (evidence: `src/server/trpc/router.ts`)
- Community members → Guessing and scoring: guess drawings (evidence: `README.md`)
- Drawing posts → Guessing and scoring: supports scoring (evidence: `src/server/services/posts/drawing.ts`)
- Gameplay API → Slate bandit: generates slate (evidence: `src/server/trpc/router.ts`)
- Gameplay API → Word dictionary: reads words (evidence: `src/server/trpc/router.ts`)
- Player → Points and levels: earns points (evidence: `README.md`)
- Points and levels → Rewards and items: uses rewards (evidence: `src/server/services/progression.ts`)
- Gameplay API → Redis and permissions: checks permissions (evidence: `src/server/trpc/router.ts`)
- Reddit platform → HTTP server: hosts game
- Player → Tournament play: joins tournament
- Player → Community post modes: views community posts
