# commonly-ts/trivious-tickets architecture

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

- Interactive diagram: https://gitdiagram.com/commonly-ts/trivious-tickets
- Repository: https://github.com/commonly-ts/trivious-tickets

## Overview

This repository is a Trivious-framework ticket module, not the Trello API wrapper described by its README. Its visible workflow configures a ticket, submits it through TicketsClient, and binds Discord button handlers for ticket actions; persistence is backed by a TypeORM entity and an injected DataSource. Creation-method internals and most action implementations were not sampled, so their specific storage and Discord effects are not inferred.

Main entry points: [`src/features/tickets/ticket.bind.ts`](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/ticket.bind.ts) (Button binding), [`src/features/client/main.client.ts`](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/client/main.client.ts) (TicketsClient), [`src/features/tickets/methods/ticket.close.ts`](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.close.ts) (Close ticket), [`src/features/database/TicketEntity.ts`](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/database/TicketEntity.ts) (Ticket entity)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_config["Ticket configuration"]
  node_builder["Ticket builder<br/>[ticket.object.ts]"]
  node_options["Button options<br/>[ticket.options.ts]"]
end

subgraph group_runtime["Ticket runtime"]
  node_client["TicketsClient<br/>[main.client.ts]"]
  node_create["Create ticket<br/>[_ticket.create.ts]"]
  node_entity[("Ticket entity<br/>[TicketEntity.ts]")]
  node_functions["Ticket helpers"]
end

subgraph group_actions["Ticket actions"]
  node_close["Close ticket<br/>[ticket.close.ts]"]
  node_claim["Claim ticket<br/>[ticket.claim.ts]"]
  node_unclaim["Unclaim ticket<br/>[ticket.unclaim.ts]"]
  node_reopen["Reopen ticket<br/>[ticket.reopen.ts]"]
  node_delete["Delete ticket<br/>[ticket.delete.ts]"]
end

subgraph group_framework["Framework integration"]
  node_bind["Button binding<br/>[ticket.bind.ts]"]
  node_structure["Dynamic loading<br/>[structure.ts]"]
end

node_consumer(("Module consumer"))
node_trivious{{"Trivious runtime"}}
node_discord{{"Discord API"}}

node_consumer -->|"configures"| node_builder
node_consumer -->|"calls"| node_client
node_builder -->|"supplies config"| node_client
node_client -->|"creates via"| node_create
node_client -->|"binds buttons"| node_bind
node_client -->|"uses runtime"| node_trivious
node_client -->|"gets repository"| node_entity
node_bind -->|"loads handlers"| node_structure
node_bind -->|"registers components"| node_trivious
node_bind -->|"loads handler"| node_close
node_bind -->|"loads handler"| node_claim
node_bind -->|"loads handler"| node_unclaim
node_bind -->|"loads handler"| node_reopen
node_bind -->|"loads handler"| node_delete
node_close -->|"calls helpers"| node_functions
node_functions -->|"queries"| node_entity
node_close -->|"updates"| node_entity
node_close -->|"edits channel"| node_discord
node_options -->|"encodes IDs"| node_trivious

click node_builder "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/builders/ticket.object.ts"
click node_options "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/builders/ticket.options.ts"
click node_client "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/client/main.client.ts"
click node_create "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/_ticket.create.ts"
click node_entity "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/database/TicketEntity.ts"
click node_functions "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/ticket.functions.ts"
click node_bind "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/ticket.bind.ts"
click node_structure "https://github.com/commonly-ts/trivious-tickets/blob/main/src/structure.ts"
click node_close "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.close.ts"
click node_claim "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.claim.ts"
click node_unclaim "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.unclaim.ts"
click node_reopen "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.reopen.ts"
click node_delete "https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.delete.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_builder,node_options toneBlue
class node_client,node_create,node_entity,node_functions toneAmber
class node_close,node_claim,node_unclaim,node_reopen,node_delete,node_discord toneMint
class node_bind,node_structure toneRose
class node_consumer,node_trivious toneIndigo
```

## Components

### Ticket configuration

- [Ticket builder](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/builders/ticket.object.ts): `src/features/builders/ticket.object.ts`
- [Button options](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/builders/ticket.options.ts): `src/features/builders/ticket.options.ts`

### Ticket runtime

- [TicketsClient](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/client/main.client.ts): `src/features/client/main.client.ts`
- [Create ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/_ticket.create.ts): `src/features/tickets/methods/_ticket.create.ts`
- [Ticket entity](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/database/TicketEntity.ts): `src/features/database/TicketEntity.ts`
- [Ticket helpers](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/ticket.functions.ts): `src/features/tickets/ticket.functions.ts`

### Ticket actions

- [Close ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.close.ts): `src/features/tickets/methods/ticket.close.ts`
- [Claim ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.claim.ts): `src/features/tickets/methods/ticket.claim.ts`
- [Unclaim ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.unclaim.ts): `src/features/tickets/methods/ticket.unclaim.ts`
- [Reopen ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.reopen.ts): `src/features/tickets/methods/ticket.reopen.ts`
- [Delete ticket](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/methods/ticket.delete.ts): `src/features/tickets/methods/ticket.delete.ts`

### Framework integration

- [Button binding](https://github.com/commonly-ts/trivious-tickets/blob/main/src/features/tickets/ticket.bind.ts): `src/features/tickets/ticket.bind.ts`
- [Dynamic loading](https://github.com/commonly-ts/trivious-tickets/blob/main/src/structure.ts): `src/structure.ts`

### Other components

- **Module consumer**
- **Trivious runtime**
- **Discord API**

## Connections

- Module consumer → Ticket builder: configures
- Module consumer → TicketsClient: calls
- Ticket builder → TicketsClient: supplies config
- TicketsClient → Create ticket: creates via
- TicketsClient → Button binding: binds buttons
- TicketsClient → Trivious runtime: uses runtime
- TicketsClient → Ticket entity: gets repository
- Button binding → Dynamic loading: loads handlers
- Button binding → Trivious runtime: registers components
- Button binding → Close ticket: loads handler
- Button binding → Claim ticket: loads handler
- Button binding → Unclaim ticket: loads handler
- Button binding → Reopen ticket: loads handler
- Button binding → Delete ticket: loads handler
- Close ticket → Ticket helpers: calls helpers
- Ticket helpers → Ticket entity: queries
- Close ticket → Ticket entity: updates
- Close ticket → Discord API: edits channel
- Button options → Trivious runtime: encodes IDs
