# go-gorm/playground architecture

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

- Interactive diagram: https://gitdiagram.com/go-gorm/playground
- Repository: https://github.com/go-gorm/playground

## Overview

GORM Playground is a developer test harness for reproducing and reporting GORM issues. The documented workflow is to configure or modify tests, run them against GORM and selected database drivers, then share a failing Playground change when reporting an issue. The shown runtime initializes a database connection, resets and migrates its model schema, and exposes relationship-rich sample models. The test implementation was not sampled, so its connections to setup are not asserted beyond the README’s description.

Main entry points: [`db.go`](https://github.com/go-gorm/playground/blob/master/db.go) (Database setup), [`main_test.go`](https://github.com/go-gorm/playground/blob/master/main_test.go) (GORM tests), [`models/models.go`](https://github.com/go-gorm/playground/blob/master/models/models.go) (Relationship models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Developer workflow"]
  node_tests["GORM tests<br/>[main_test.go]"]
end

subgraph group_runtime["Test runtime"]
  node_dbsetup["Database setup<br/>[db.go]"]
  node_gorm["GORM ORM"]
  node_drivers["Database drivers"]
  node_database[("Test database")]
end

subgraph group_schema["Sample domain"]
  node_models["Relationship models<br/>[models.go]"]
end

node_developer(("Developer"))

node_developer -->|"modifies and runs"| node_tests
node_tests -.->|"uses setup"| node_dbsetup
node_dbsetup -->|"opens and migrates"| node_gorm
node_dbsetup -->|"selects driver"| node_drivers
node_dbsetup -->|"migrates"| node_models
node_drivers -->|"connects"| node_database

click node_tests "https://github.com/go-gorm/playground/blob/master/main_test.go"
click node_dbsetup "https://github.com/go-gorm/playground/blob/master/db.go"
click node_models "https://github.com/go-gorm/playground/blob/master/models/models.go"

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_tests toneBlue
class node_dbsetup,node_gorm,node_drivers,node_database toneAmber
class node_models toneMint
class node_developer toneIndigo
```

## Components

### Developer workflow

- [GORM tests](https://github.com/go-gorm/playground/blob/master/main_test.go): `main_test.go`

### Test runtime

- [Database setup](https://github.com/go-gorm/playground/blob/master/db.go): `db.go`
- **GORM ORM**
- **Database drivers**
- **Test database**

### Sample domain

- [Relationship models](https://github.com/go-gorm/playground/blob/master/models/models.go): `models/models.go`

### Other components

- **Developer**

## Connections

- Developer → GORM tests: modifies and runs (evidence: `README.md`)
- GORM tests → Database setup: uses setup
- Database setup → GORM ORM: opens and migrates (evidence: `db.go`)
- Database setup → Database drivers: selects driver (evidence: `db.go`)
- Database setup → Relationship models: migrates (evidence: `db.go`)
- Database drivers → Test database: connects
