# ahmdd4vd/k-12-reverse architecture

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

- Interactive diagram: https://gitdiagram.com/ahmdd4vd/k-12-reverse
- Repository: https://github.com/ahmdd4vd/k-12-reverse

## Overview

K12-Reverse is a CLI for concurrent ChatGPT account registration, using Gmail address variations and IMAP OTP retrieval, with optional K12 workspace invitations and credential integrations. The documented workflow runs from configuration and batch orchestration through registration, verification, and token output. The README also describes Codex export and 9Router import. Some implementation links are inferred from module responsibilities and documentation; unsampled source limits certainty about their exact call wiring.

Main entry points: [`internal/register/flow.go`](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/flow.go) (Registration flow), [`cmd/register/main.go`](https://github.com/ahmdd4vd/k-12-reverse/blob/main/cmd/register/main.go) (Register CLI), [`internal/register/client.go`](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/client.go) (HTTP client), [`internal/config/config.go`](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/config/config.go) (Configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and setup"]
  node_cli["Register CLI<br/>[main.go]"]
  node_config["Configuration<br/>[config.go]"]
  node_configfile["config.json<br/>[config.json]"]
end

subgraph group_registration["Registration workflow"]
  node_batch["Batch runner<br/>[batch.go]"]
  node_flow["Registration flow<br/>[flow.go]"]
  node_login["Login flow<br/>[flow_login.go]"]
  node_client["HTTP client<br/>[client.go]"]
end

subgraph group_email["Email verification"]
  node_dot["Dot variations<br/>[dot_generator.go]"]
  node_pool["Gmail pool<br/>[gmail_pool.go]"]
  node_imap["IMAP OTP reader<br/>[gmail_imap.go]"]
  node_invite["Workspace invites<br/>[gmail_invite.go]"]
end

subgraph group_integrations["Token integrations"]
  node_codex["Codex token export<br/>[export_codex.go]"]
  node_router["9Router importer<br/>[import_9router.go]"]
end

subgraph group_support["Registration support"]
  node_sentinel["Sentinel tokens<br/>[generator.go]"]
  node_proxy["Proxy validation<br/>[proxy.go]"]
  node_chrome["Browser profiles<br/>[profiles.go]"]
end

node_operator(("Operator"))
node_chatgpt{{"ChatGPT / OpenAI"}}
node_gmail{{"Gmail IMAP"}}
node_workspace{{"K12 workspaces"}}
node_codexfile["Codex auth file"]
node_routerdb[("9Router database")]

node_operator -->|"configures and runs"| node_cli
node_cli -->|"loads and saves"| node_config
node_config -->|"reads and writes"| node_configfile
node_cli -->|"starts batch"| node_batch
node_batch -->|"runs workers"| node_flow
node_flow -->|"performs login"| node_login
node_flow -->|"sends requests"| node_client
node_client -->|"sends HTTP"| node_chatgpt
node_flow -->|"selects Gmail"| node_pool
node_pool -->|"generates variants"| node_dot
node_flow -->|"retrieves OTP"| node_imap
node_imap -->|"searches inbox"| node_gmail
node_flow -.->|"requests invitations"| node_invite
node_invite -.->|"sends invite requests"| node_workspace
node_flow -->|"generates tokens"| node_sentinel
node_cli -.->|"offers token export"| node_codex
node_codex -.->|"writes credentials"| node_codexfile
node_cli -.->|"offers import"| node_router
node_router -.->|"inserts or updates"| node_routerdb
node_cli -->|"checks proxy"| node_proxy
node_proxy -->|"tests access"| node_chatgpt
node_client -->|"selects profile"| node_chrome

click node_cli "https://github.com/ahmdd4vd/k-12-reverse/blob/main/cmd/register/main.go"
click node_config "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/config/config.go"
click node_configfile "https://github.com/ahmdd4vd/k-12-reverse/blob/main/config.json"
click node_batch "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/batch.go"
click node_flow "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/flow.go"
click node_login "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/flow_login.go"
click node_client "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/client.go"
click node_dot "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/dot_generator.go"
click node_pool "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_pool.go"
click node_imap "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_imap.go"
click node_invite "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_invite.go"
click node_sentinel "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/sentinel/generator.go"
click node_codex "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/export_codex.go"
click node_router "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/import_9router.go"
click node_proxy "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/util/proxy.go"
click node_chrome "https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/chrome/profiles.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_cli,node_config,node_configfile toneBlue
class node_batch,node_flow,node_login,node_client,node_routerdb toneAmber
class node_dot,node_pool,node_imap,node_invite toneMint
class node_codex,node_router toneRose
class node_sentinel,node_proxy,node_chrome,node_operator,node_chatgpt,node_gmail,node_workspace,node_codexfile toneIndigo
```

## Components

### CLI and setup

- [Register CLI](https://github.com/ahmdd4vd/k-12-reverse/blob/main/cmd/register/main.go): `cmd/register/main.go`
- [Configuration](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/config/config.go): `internal/config/config.go`
- [config.json](https://github.com/ahmdd4vd/k-12-reverse/blob/main/config.json): `config.json`

### Registration workflow

- [Batch runner](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/batch.go): `internal/register/batch.go`
- [Registration flow](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/flow.go): `internal/register/flow.go`
- [Login flow](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/flow_login.go): `internal/register/flow_login.go`
- [HTTP client](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/client.go): `internal/register/client.go`

### Email verification

- [Dot variations](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/dot_generator.go): `internal/email/dot_generator.go`
- [Gmail pool](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_pool.go): `internal/email/gmail_pool.go`
- [IMAP OTP reader](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_imap.go): `internal/email/gmail_imap.go`
- [Workspace invites](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/email/gmail_invite.go): `internal/email/gmail_invite.go`

### Token integrations

- [Codex token export](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/export_codex.go): `internal/register/export_codex.go`
- [9Router importer](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/register/import_9router.go): `internal/register/import_9router.go`

### Registration support

- [Sentinel tokens](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/sentinel/generator.go): `internal/sentinel/generator.go`
- [Proxy validation](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/util/proxy.go): `internal/util/proxy.go`
- [Browser profiles](https://github.com/ahmdd4vd/k-12-reverse/blob/main/internal/chrome/profiles.go): `internal/chrome/profiles.go`

### Other components

- **Operator**
- **ChatGPT / OpenAI**
- **Gmail IMAP**
- **K12 workspaces**
- **Codex auth file**
- **9Router database**

## Connections

- Operator → Register CLI: configures and runs
- Register CLI → Configuration: loads and saves
- Configuration → config.json: reads and writes
- Register CLI → Batch runner: starts batch
- Batch runner → Registration flow: runs workers
- Registration flow → Login flow: performs login
- Registration flow → HTTP client: sends requests
- HTTP client → ChatGPT / OpenAI: sends HTTP
- Registration flow → Gmail pool: selects Gmail
- Gmail pool → Dot variations: generates variants
- Registration flow → IMAP OTP reader: retrieves OTP
- IMAP OTP reader → Gmail IMAP: searches inbox
- Registration flow → Workspace invites: requests invitations
- Workspace invites → K12 workspaces: sends invite requests
- Registration flow → Sentinel tokens: generates tokens
- Register CLI → Codex token export: offers token export
- Codex token export → Codex auth file: writes credentials
- Register CLI → 9Router importer: offers import
- 9Router importer → 9Router database: inserts or updates
- Register CLI → Proxy validation: checks proxy
- Proxy validation → ChatGPT / OpenAI: tests access
- HTTP client → Browser profiles: selects profile
