# matheuszwilk/supertigre architecture

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

- Interactive diagram: https://gitdiagram.com/matheuszwilk/supertigre
- Repository: https://github.com/matheuszwilk/supertigre

## Overview

This is a Next.js SaaS for managing automated gaming accounts and bot operations, with user/admin dashboards, licensing and checkout, task orchestration, and integrations with gaming platforms. The principal runtime path is a user task request, queued work, account/platform automation, and live spin/status reporting. The tree and sampled files support these major domains, but most UI-to-API links and unsampled payment, licensing, and platform routes are not shown; those links are omitted rather than inferred.

Main entry points: [`src/app/api/bot/_middleware.ts`](https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/bot/_middleware.ts) (Bot API), [`src/services/site-api/pg-http-engine.ts`](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/pg-http-engine.ts) (PG Spin Engine), [`src/lib/redis.ts`](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/redis.ts) (Redis), [`src/services/site-api/client.ts`](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/client.ts) (Site API Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User and Admin"]
  node_dashboard["User Dashboard"]
  node_admin["Admin Console"]
  node_auth["User Authentication<br/>[auth.ts]"]
end

subgraph group_operations["Bot Operations"]
  node_user_tasks_api["Task API<br/>[route.ts]"]
  node_task_schema["Task Schemas<br/>[task.ts]"]
  node_task_queue["Task Queue<br/>[queue.ts]"]
  node_task_worker["Task Worker<br/>[task.worker.ts]"]
  node_bot_api["Bot API<br/>[_middleware.ts]"]
  node_bot_auth["Bot Authentication<br/>[bot-auth.ts]"]
  node_bot_schema["Bot Schemas<br/>[bot.ts]"]
end

subgraph group_platform["Site Automation"]
  node_account_service["Account Service<br/>[account-service.ts]"]
  node_site_client["Site API Client<br/>[client.ts]"]
  node_device_profile["Android Profile<br/>[android-seed.ts]"]
  node_proxy_manager["Proxy Manager<br/>[proxy-manager.ts]"]
  node_pg_engine["PG Spin Engine<br/>[pg-http-engine.ts]"]
  node_pp_engine["Pragmatic Engine<br/>[pp-http-engine.ts]"]
  node_tada_engine["TADA Engine"]
  node_tada_wasm["TADA WASM<br/>[tada-wasm.ts]"]
  node_wg_engine["WG Engine<br/>[wg-ws-engine.ts]"]
end

subgraph group_infrastructure["Runtime Infrastructure"]
  node_audit["Audit Logging<br/>[audit.ts]"]
  node_events["Live Events<br/>[events.ts]"]
  node_database[("Application Database<br/>[prisma.ts]")]
  node_redis[("Redis<br/>[redis.ts]")]
end

subgraph group_commerce["Licensing and Payments"]
  node_checkout["Checkout and PIX"]
  node_payment_worker["Payment Worker"]
  node_mercado_pago["Mercado Pago"]
  node_license_admin["License Administration<br/>[route.ts]"]
end

node_user(("User"))
node_external_platforms["Gaming Platforms"]

node_user -->|"requests tasks"| node_user_tasks_api
node_user_tasks_api -->|"validates"| node_task_schema
node_user_tasks_api -->|"enqueues"| node_task_queue
node_task_queue -->|"stores jobs"| node_redis
node_task_queue -->|"checks limits"| node_database
node_task_worker -->|"runs account work"| node_account_service
node_account_service -.->|"uses site API"| node_site_client
node_pg_engine -->|"opens game"| node_site_client
node_pg_engine -->|"derives profile"| node_device_profile
node_pg_engine -->|"gets proxy"| node_proxy_manager
node_pg_engine -->|"publishes spin reports"| node_redis
node_pp_engine -->|"opens game"| node_site_client
node_pp_engine -->|"gets proxy"| node_proxy_manager
node_pp_engine -->|"publishes spin reports"| node_redis
node_tada_engine -->|"opens game"| node_site_client
node_tada_engine -->|"precompiles"| node_tada_wasm
node_tada_engine -->|"gets proxy"| node_proxy_manager
node_wg_engine -->|"opens game"| node_site_client
node_wg_engine -->|"gets proxy"| node_proxy_manager
node_wg_engine -->|"publishes spin reports"| node_redis
node_bot_api -->|"authenticates bot"| node_bot_auth
node_bot_api -->|"records activity"| node_audit
node_bot_api -->|"checks sessions"| node_database
node_bot_api -->|"uses rate limits"| node_redis
node_bot_api -->|"validates activation"| node_bot_schema
node_bot_api -->|"publishes status"| node_events
node_events -->|"publishes events"| node_redis
node_audit -->|"writes logs"| node_database
node_auth -->|"loads user"| node_database
node_payment_worker -.->|"checks payments"| node_mercado_pago
node_payment_worker -->|"updates orders"| node_database
node_payment_worker -->|"records payment"| node_audit
node_checkout -.->|"initiates payment"| node_mercado_pago
node_admin -.->|"manages licenses"| node_license_admin
node_pg_engine -.->|"runs spins"| node_external_platforms
node_pp_engine -.->|"runs spins"| node_external_platforms
node_tada_engine -.->|"runs spins"| node_external_platforms
node_wg_engine -.->|"runs spins"| node_external_platforms

click node_dashboard "https://github.com/matheuszwilk/supertigre/tree/main/src/app/(dashboard)"
click node_admin "https://github.com/matheuszwilk/supertigre/tree/main/src/app/(admin)"
click node_user_tasks_api "https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/user/tasks/route.ts"
click node_task_schema "https://github.com/matheuszwilk/supertigre/blob/main/src/schemas/task.ts"
click node_task_queue "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/queue.ts"
click node_task_worker "https://github.com/matheuszwilk/supertigre/blob/main/src/workers/task.worker.ts"
click node_account_service "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/account-service.ts"
click node_site_client "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/client.ts"
click node_device_profile "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/android-seed.ts"
click node_proxy_manager "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/proxy-manager.ts"
click node_pg_engine "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/pg-http-engine.ts"
click node_pp_engine "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/pp-http-engine.ts"
click node_tada_engine "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/tada-http-engine.ts"
click node_tada_wasm "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/tada/tada-wasm.ts"
click node_wg_engine "https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/wg-ws-engine.ts"
click node_bot_api "https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/bot/_middleware.ts"
click node_bot_auth "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/bot-auth.ts"
click node_bot_schema "https://github.com/matheuszwilk/supertigre/blob/main/src/schemas/bot.ts"
click node_audit "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/audit.ts"
click node_events "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/events.ts"
click node_database "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/prisma.ts"
click node_redis "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/redis.ts"
click node_auth "https://github.com/matheuszwilk/supertigre/blob/main/src/lib/auth.ts"
click node_checkout "https://github.com/matheuszwilk/supertigre/tree/main/src/app/(checkout)"
click node_payment_worker "https://github.com/matheuszwilk/supertigre/blob/main/src/workers/mp-payment-worker.ts"
click node_license_admin "https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/admin/licenses/route.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_dashboard,node_admin,node_auth,node_user toneBlue
class node_user_tasks_api,node_task_schema,node_task_queue,node_task_worker,node_bot_api,node_bot_auth,node_bot_schema toneAmber
class node_account_service,node_site_client,node_device_profile,node_proxy_manager,node_pg_engine,node_pp_engine,node_tada_engine,node_tada_wasm,node_wg_engine toneMint
class node_audit,node_events,node_database,node_redis toneRose
class node_checkout,node_payment_worker,node_mercado_pago,node_license_admin,node_external_platforms toneIndigo
```

## Components

### User and Admin

- [User Dashboard](https://github.com/matheuszwilk/supertigre/tree/main/src/app/(dashboard)): `src/app/(dashboard)`
- [Admin Console](https://github.com/matheuszwilk/supertigre/tree/main/src/app/(admin)): `src/app/(admin)`
- [User Authentication](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/auth.ts): `src/lib/auth.ts`

### Bot Operations

- [Task API](https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/user/tasks/route.ts): `src/app/api/user/tasks/route.ts`
- [Task Schemas](https://github.com/matheuszwilk/supertigre/blob/main/src/schemas/task.ts): `src/schemas/task.ts`
- [Task Queue](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/queue.ts): `src/lib/queue.ts`
- [Task Worker](https://github.com/matheuszwilk/supertigre/blob/main/src/workers/task.worker.ts): `src/workers/task.worker.ts`
- [Bot API](https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/bot/_middleware.ts): `src/app/api/bot/_middleware.ts`
- [Bot Authentication](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/bot-auth.ts): `src/lib/bot-auth.ts`
- [Bot Schemas](https://github.com/matheuszwilk/supertigre/blob/main/src/schemas/bot.ts): `src/schemas/bot.ts`

### Site Automation

- [Account Service](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/account-service.ts): `src/services/site-api/account-service.ts`
- [Site API Client](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/client.ts): `src/services/site-api/client.ts`
- [Android Profile](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/android-seed.ts): `src/services/site-api/android-seed.ts`
- [Proxy Manager](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/proxy-manager.ts): `src/services/site-api/proxy-manager.ts`
- [PG Spin Engine](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/pg-http-engine.ts): `src/services/site-api/pg-http-engine.ts`
- [Pragmatic Engine](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/pp-http-engine.ts): `src/services/site-api/pp-http-engine.ts`
- [TADA Engine](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/tada-http-engine.ts): `src/services/site-api/tada-http-engine.ts`
- [TADA WASM](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/tada/tada-wasm.ts): `src/services/site-api/tada/tada-wasm.ts`
- [WG Engine](https://github.com/matheuszwilk/supertigre/blob/main/src/services/site-api/wg-ws-engine.ts): `src/services/site-api/wg-ws-engine.ts`

### Runtime Infrastructure

- [Audit Logging](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/audit.ts): `src/lib/audit.ts`
- [Live Events](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/events.ts): `src/lib/events.ts`
- [Application Database](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/prisma.ts): `src/lib/prisma.ts`
- [Redis](https://github.com/matheuszwilk/supertigre/blob/main/src/lib/redis.ts): `src/lib/redis.ts`

### Licensing and Payments

- [Checkout and PIX](https://github.com/matheuszwilk/supertigre/tree/main/src/app/(checkout)): `src/app/(checkout)`
- [Payment Worker](https://github.com/matheuszwilk/supertigre/blob/main/src/workers/mp-payment-worker.ts): `src/workers/mp-payment-worker.ts`
- **Mercado Pago**
- [License Administration](https://github.com/matheuszwilk/supertigre/blob/main/src/app/api/admin/licenses/route.ts): `src/app/api/admin/licenses/route.ts`

### Other components

- **User**
- **Gaming Platforms**

## Connections

- User → Task API: requests tasks (evidence: `src/app/api/user/tasks/route.ts`)
- Task API → Task Schemas: validates (evidence: `src/app/api/user/tasks/route.ts`)
- Task API → Task Queue: enqueues (evidence: `src/app/api/user/tasks/route.ts`)
- Task Queue → Redis: stores jobs (evidence: `src/lib/queue.ts`)
- Task Queue → Application Database: checks limits (evidence: `src/lib/queue.ts`)
- Task Worker → Account Service: runs account work (evidence: `src/workers/task.worker.ts`)
- Account Service → Site API Client: uses site API
- PG Spin Engine → Site API Client: opens game (evidence: `src/services/site-api/pg-http-engine.ts`)
- PG Spin Engine → Android Profile: derives profile (evidence: `src/services/site-api/pg-http-engine.ts`)
- PG Spin Engine → Proxy Manager: gets proxy (evidence: `src/services/site-api/pg-http-engine.ts`)
- PG Spin Engine → Redis: publishes spin reports (evidence: `src/services/site-api/pg-http-engine.ts`)
- Pragmatic Engine → Site API Client: opens game (evidence: `src/services/site-api/pp-http-engine.ts`)
- Pragmatic Engine → Proxy Manager: gets proxy (evidence: `src/services/site-api/pp-http-engine.ts`)
- Pragmatic Engine → Redis: publishes spin reports (evidence: `src/services/site-api/pp-http-engine.ts`)
- TADA Engine → Site API Client: opens game (evidence: `src/services/site-api/tada-http-engine.ts`)
- TADA Engine → TADA WASM: precompiles (evidence: `src/services/site-api/tada-http-engine.ts`)
- TADA Engine → Proxy Manager: gets proxy (evidence: `src/services/site-api/tada-http-engine.ts`)
- WG Engine → Site API Client: opens game (evidence: `src/services/site-api/wg-ws-engine.ts`)
- WG Engine → Proxy Manager: gets proxy (evidence: `src/services/site-api/wg-ws-engine.ts`)
- WG Engine → Redis: publishes spin reports (evidence: `src/services/site-api/wg-ws-engine.ts`)
- Bot API → Bot Authentication: authenticates bot (evidence: `src/app/api/bot/_middleware.ts`)
- Bot API → Audit Logging: records activity (evidence: `src/app/api/bot/_middleware.ts`)
- Bot API → Application Database: checks sessions (evidence: `src/app/api/bot/_middleware.ts`)
- Bot API → Redis: uses rate limits (evidence: `src/app/api/bot/_middleware.ts`)
- Bot API → Bot Schemas: validates activation (evidence: `src/app/api/bot/activate/route.ts`)
- Bot API → Live Events: publishes status (evidence: `src/app/api/bot/activate/route.ts`)
- Live Events → Redis: publishes events (evidence: `src/lib/events.ts`)
- Audit Logging → Application Database: writes logs (evidence: `src/lib/audit.ts`)
- User Authentication → Application Database: loads user (evidence: `src/lib/auth.ts`)
- Payment Worker → Mercado Pago: checks payments
- Payment Worker → Application Database: updates orders (evidence: `src/workers/mp-payment-worker.ts`)
- Payment Worker → Audit Logging: records payment (evidence: `src/workers/mp-payment-worker.ts`)
- Checkout and PIX → Mercado Pago: initiates payment
- Admin Console → License Administration: manages licenses
- PG Spin Engine → Gaming Platforms: runs spins
- Pragmatic Engine → Gaming Platforms: runs spins
- TADA Engine → Gaming Platforms: runs spins
- WG Engine → Gaming Platforms: runs spins
