# irabeny89/gosqlitex architecture

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

- Interactive diagram: https://gitdiagram.com/irabeny89/gosqlitex
- Repository: https://github.com/irabeny89/gosqlitex

## Overview

gosqlitex is a Go SQLite wrapper with separate read and write pools, plus migration APIs and the mig8 command-line tool. The main workflow opens a client, routes application queries to the appropriate pool, and lets mig8 generate, apply, or list migrations. The sampled source shows pool routing and migration orchestration; other documented API behavior is represented at the public API level where implementation details were not sampled.

Main entry points: [`cmd/mig8/mig8.go`](https://github.com/irabeny89/gosqlitex/blob/main/cmd/mig8/mig8.go) (mig8 command), [`db.go`](https://github.com/irabeny89/gosqlitex/blob/main/db.go) (Read pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Database Client"]
  node_client_api["Client API<br/>[db.go]"]
  node_open["Open client<br/>[db.go]"]
  node_pool_config["Pool setup<br/>[db.go]"]
  node_read_pool["Read pool<br/>[db.go]"]
  node_write_pool["Write pool<br/>[db.go]"]
end

subgraph group_migration["Migrations"]
  node_migration_api["Migration API<br/>[db.go]"]
  node_migration_runner["Migration runner<br/>[db.go]"]
  node_migration_helpers["Migration helpers<br/>[db.go]"]
  node_migration_files["Migration files"]
end

subgraph group_cli["mig8 CLI"]
  node_mig8["mig8 command<br/>[mig8.go]"]
end

node_app(("Go application"))
node_sqlite[("SQLite database")]
node_operator(("CLI operator"))

node_app -->|"opens"| node_open
node_open -->|"configures"| node_pool_config
node_pool_config -->|"creates writer"| node_write_pool
node_pool_config -->|"creates readers"| node_read_pool
node_read_pool -->|"reads"| node_sqlite
node_write_pool -->|"writes"| node_sqlite
node_app -->|"calls"| node_client_api
node_client_api -->|"routes reads"| node_read_pool
node_client_api -->|"routes writes"| node_write_pool
node_app -->|"calls"| node_migration_api
node_migration_api -->|"runs or lists"| node_migration_runner
node_migration_runner -->|"uses"| node_migration_helpers
node_migration_runner -->|"reads"| node_migration_files
node_migration_helpers -->|"records changes"| node_write_pool
node_migration_helpers -->|"checks records"| node_read_pool
node_operator -->|"runs"| node_mig8
node_mig8 -->|"opens client"| node_open
node_mig8 -->|"runs or lists"| node_migration_api
node_mig8 -->|"generates file"| node_migration_files

click node_client_api "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_open "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_pool_config "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_read_pool "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_write_pool "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_migration_api "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_migration_runner "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_migration_helpers "https://github.com/irabeny89/gosqlitex/blob/main/db.go"
click node_mig8 "https://github.com/irabeny89/gosqlitex/blob/main/cmd/mig8/mig8.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_client_api,node_open,node_pool_config,node_read_pool,node_write_pool toneBlue
class node_migration_api,node_migration_runner,node_migration_helpers,node_migration_files,node_sqlite toneAmber
class node_mig8 toneMint
class node_app,node_operator toneIndigo
```

## Components

### Database Client

- [Client API](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Open client](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Pool setup](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Read pool](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Write pool](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`

### Migrations

- [Migration API](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Migration runner](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- [Migration helpers](https://github.com/irabeny89/gosqlitex/blob/main/db.go): `db.go`
- **Migration files**

### mig8 CLI

- [mig8 command](https://github.com/irabeny89/gosqlitex/blob/main/cmd/mig8/mig8.go): `cmd/mig8/mig8.go`

### Other components

- **Go application**
- **SQLite database**
- **CLI operator**

## Connections

- Go application → Open client: opens
- Open client → Pool setup: configures
- Pool setup → Write pool: creates writer
- Pool setup → Read pool: creates readers
- Read pool → SQLite database: reads
- Write pool → SQLite database: writes
- Go application → Client API: calls
- Client API → Read pool: routes reads
- Client API → Write pool: routes writes
- Go application → Migration API: calls
- Migration API → Migration runner: runs or lists
- Migration runner → Migration helpers: uses
- Migration runner → Migration files: reads
- Migration helpers → Write pool: records changes
- Migration helpers → Read pool: checks records
- CLI operator → mig8 command: runs
- mig8 command → Open client: opens client
- mig8 command → Migration API: runs or lists
- mig8 command → Migration files: generates file
